mirror of
https://github.com/Unleash/unleash.git
synced 2024-10-18 20:09:08 +02:00
240c6a77a1
feat: options are now typed - This makes it easier to know what to send to unleash.start / unleash.create - Using a Partial to instantiate the config, then melding it with defaults to get a config object with all fields set either to their defaults or to whatever is passed in. Co-authored-by: Fredrik Strand Oseberg <fredrik.no@gmail.com> Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
'use strict';
|
|
|
|
import { createServices } from '../../services';
|
|
import { createTestConfig } from '../../../test/config/test-config';
|
|
|
|
const test = require('ava');
|
|
|
|
const supertest = require('supertest');
|
|
const { EventEmitter } = require('events');
|
|
const store = require('../../../test/fixtures/store');
|
|
|
|
const getApp = require('../../app');
|
|
|
|
const eventBus = new EventEmitter();
|
|
|
|
function getSetup() {
|
|
const base = `/random${Math.round(Math.random() * 1000)}`;
|
|
const stores = store.createStores();
|
|
const config = createTestConfig({
|
|
server: { baseUriPath: base },
|
|
});
|
|
const services = createServices(stores, config);
|
|
const app = getApp(config, stores, services, eventBus);
|
|
|
|
return { base, eventStore: stores.eventStore, request: supertest(app) };
|
|
}
|
|
|
|
test('should get empty events list via admin', t => {
|
|
t.plan(1);
|
|
const { request, base } = getSetup();
|
|
return request
|
|
.get(`${base}/api/admin/events`)
|
|
.expect('Content-Type', /json/)
|
|
.expect(200)
|
|
.expect(res => {
|
|
t.true(res.body.events.length === 0);
|
|
});
|
|
});
|