1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00
unleash.unleash/src/test/e2e/api/admin/bootstrap.test.ts
2021-10-26 23:04:44 +02:00

44 lines
1.2 KiB
TypeScript

import dbInit from '../../helpers/database-init';
import getLogger from '../../../fixtures/no-logger';
import { setupAppWithAuth } from '../../helpers/test-helper';
let app;
let db;
const email = 'user@getunleash.io';
beforeAll(async () => {
db = await dbInit('ui_bootstrap_serial', getLogger);
app = await setupAppWithAuth(db.stores);
});
afterAll(async () => {
await app.destroy();
await db.destroy();
});
test('Should get ui-bootstrap data', async () => {
// login
await app.request
.post('/auth/demo/login')
.send({
email,
})
.expect(200);
// get user data
await app.request
.get('/api/admin/ui-bootstrap')
.expect(200)
.expect('Content-Type', /json/)
.expect((res) => {
const bootstrap = res.body;
expect(bootstrap.context).toBeDefined();
expect(bootstrap.featureTypes).toBeDefined();
expect(bootstrap.uiConfig).toBeDefined();
expect(bootstrap.user).toBeDefined();
expect(bootstrap.context.length).toBeGreaterThan(0);
expect(bootstrap.user.email).toBe(email);
});
});