1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-11-01 19:07:38 +01:00
unleash.unleash/src/test/e2e/routes/routes.test.ts
Ivar Conradi Østhus 815a75a5b4
Wip/environments (#880)
Adds environment support

This PR adds environments as a first-class concept in Unleash.

It necessitated a full rewrite on how we connect feature <-> strategy, as well as a rethink on which levels environments makes sense.

This enables PUTs on strategy configurations for a feature, since all strategies now have ids.

This also updates export/import format. The importer handles both formats, but export is no longer possible in version 1 of the export format, only in version 2, with strategy configurations for a feature as a separate object.

Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
Co-authored-by: Fredrik Oseberg <fredrik.no@gmail.com>
Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
2021-07-07 10:46:50 +02:00

48 lines
1.2 KiB
TypeScript

import { setupAppWithBaseUrl } from '../helpers/test-helper';
import dbInit from '../helpers/database-init';
let db;
let app;
beforeAll(async () => {
db = await dbInit('routes_test_serial');
app = await setupAppWithBaseUrl(db.stores);
});
afterAll(async () => {
await app.destroy();
if (db != null) {
await db.destroy();
}
});
test('hitting a baseUri path returns HTML document', async () => {
expect.assertions(0);
await app.request
.get('/hosted')
.expect(200)
.expect('Content-Type', 'text/html; charset=utf-8');
});
test('hitting an api path that does not exist returns 404', async () => {
expect.assertions(0);
await app.request.get('/api/i-dont-exist').expect(404);
});
test('hitting an /admin/api returns HTML document', async () => {
expect.assertions(0);
await app.request
.get('/admin/api')
.expect(200)
.expect('Content-Type', 'text/html; charset=utf-8');
});
test('hitting a non-api returns HTML document', async () => {
expect.assertions(0);
await app.request
.get('/hosted/i-dont-exist')
.expect(200)
.expect('Content-Type', 'text/html; charset=utf-8');
});