2016-09-05 16:50:52 +02:00
|
|
|
'use strict';
|
|
|
|
|
2016-11-13 15:41:35 +01:00
|
|
|
const test = require('ava');
|
2016-11-13 20:33:23 +01:00
|
|
|
const store = require('./fixtures/store');
|
2016-09-05 16:50:52 +02:00
|
|
|
const supertest = require('supertest');
|
2016-11-13 15:41:35 +01:00
|
|
|
const logger = require('../../../lib/logger');
|
2016-11-13 21:07:14 +01:00
|
|
|
const getApp = require('../../../lib/app');
|
2016-09-05 16:50:52 +02:00
|
|
|
|
2016-11-30 23:41:57 +01:00
|
|
|
const { EventEmitter } = require('events');
|
|
|
|
const eventBus = new EventEmitter();
|
|
|
|
|
2016-11-13 15:41:35 +01:00
|
|
|
test.beforeEach(() => {
|
|
|
|
logger.setLevel('FATAL');
|
|
|
|
});
|
2016-09-05 16:50:52 +02:00
|
|
|
|
2016-11-13 15:41:35 +01:00
|
|
|
test('should add version numbers for /stategies', t => {
|
|
|
|
const stores = store.createStores();
|
2016-11-13 21:07:14 +01:00
|
|
|
const app = getApp({
|
2016-11-13 15:41:35 +01:00
|
|
|
baseUriPath: '',
|
|
|
|
stores,
|
2016-11-30 23:41:57 +01:00
|
|
|
eventBus,
|
2016-09-05 16:50:52 +02:00
|
|
|
});
|
|
|
|
|
2016-11-13 15:41:35 +01:00
|
|
|
const request = supertest(app);
|
|
|
|
|
|
|
|
return request
|
|
|
|
.get('/api/strategies')
|
|
|
|
.expect('Content-Type', /json/)
|
|
|
|
.expect(200)
|
|
|
|
.expect((res) => {
|
|
|
|
t.true(res.body.version === 1);
|
|
|
|
});
|
2016-09-05 16:50:52 +02:00
|
|
|
});
|