2021-08-12 15:04:37 +02:00
|
|
|
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 () => {
|
2021-09-13 10:23:57 +02:00
|
|
|
db = await dbInit('ui_bootstrap_serial', getLogger);
|
2021-08-12 15:04:37 +02:00
|
|
|
app = await setupAppWithAuth(db.stores);
|
|
|
|
});
|
|
|
|
|
|
|
|
afterAll(async () => {
|
|
|
|
await app.destroy();
|
|
|
|
await db.destroy();
|
|
|
|
});
|
|
|
|
|
|
|
|
test('Should get ui-bootstrap data', async () => {
|
|
|
|
// login
|
|
|
|
await app.request
|
2021-10-26 23:04:44 +02:00
|
|
|
.post('/auth/demo/login')
|
2021-08-12 15:04:37 +02:00
|
|
|
.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);
|
|
|
|
});
|
|
|
|
});
|