2019-03-12 10:46:08 +01:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const test = require('ava');
|
|
|
|
const supertest = require('supertest');
|
2020-04-14 22:29:11 +02:00
|
|
|
const { EventEmitter } = require('events');
|
|
|
|
const store = require('../../../test/fixtures/store');
|
|
|
|
const getLogger = require('../../../test/fixtures/no-logger');
|
2019-03-12 10:46:08 +01:00
|
|
|
const getApp = require('../../app');
|
|
|
|
|
|
|
|
const eventBus = new EventEmitter();
|
|
|
|
|
|
|
|
const uiConfig = {
|
|
|
|
headerBackground: 'red',
|
|
|
|
slogan: 'hello',
|
|
|
|
};
|
|
|
|
|
|
|
|
function getSetup() {
|
|
|
|
const base = `/random${Math.round(Math.random() * 1000)}`;
|
|
|
|
const stores = store.createStores();
|
|
|
|
const app = getApp({
|
|
|
|
baseUriPath: base,
|
|
|
|
stores,
|
|
|
|
eventBus,
|
|
|
|
extendedPermissions: false,
|
|
|
|
ui: uiConfig,
|
2019-04-30 21:14:23 +02:00
|
|
|
getLogger,
|
2019-03-12 10:46:08 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
return {
|
|
|
|
base,
|
|
|
|
request: supertest(app),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
test('should get ui config', t => {
|
|
|
|
t.plan(2);
|
|
|
|
const { request, base } = getSetup();
|
|
|
|
return request
|
|
|
|
.get(`${base}/api/admin/ui-config`)
|
|
|
|
.expect('Content-Type', /json/)
|
|
|
|
.expect(200)
|
|
|
|
.expect(res => {
|
|
|
|
t.true(res.body.slogan === 'hello');
|
|
|
|
t.true(res.body.headerBackground === 'red');
|
|
|
|
});
|
|
|
|
});
|