mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-28 00:06:53 +01:00
d1fd5d3900
* fix: e2e tests should only set up one database per test file * fix: Allow e2e-tests to reset db content
36 lines
869 B
JavaScript
36 lines
869 B
JavaScript
'use strict';
|
|
|
|
const test = require('ava');
|
|
const { setupApp } = require('../../helpers/test-helper');
|
|
const dbInit = require('../../helpers/database-init');
|
|
const getLogger = require('../../../fixtures/no-logger');
|
|
|
|
let stores;
|
|
|
|
test.before(async () => {
|
|
const db = await dbInit('event_api_serial', getLogger);
|
|
stores = db.stores;
|
|
});
|
|
|
|
test.after(async () => {
|
|
await stores.db.destroy();
|
|
});
|
|
|
|
test.serial('returns events', async t => {
|
|
t.plan(0);
|
|
const request = await setupApp(stores);
|
|
return request
|
|
.get('/api/admin/events')
|
|
.expect('Content-Type', /json/)
|
|
.expect(200);
|
|
});
|
|
|
|
test.serial('returns events given a name', async t => {
|
|
t.plan(0);
|
|
const request = await setupApp(stores);
|
|
return request
|
|
.get('/api/admin/events/myname')
|
|
.expect('Content-Type', /json/)
|
|
.expect(200);
|
|
});
|