1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/lib/app.test.js
2016-12-29 11:42:54 +01:00

32 lines
642 B
JavaScript

'use strict';
const test = require('ava');
const proxyquire = require('proxyquire');
const getApp = proxyquire('./app', {
'./routes': {
createAPI: () => {},
createLegacy: () => {},
},
});
test('should not throw when valid config', t => {
const app = getApp({});
t.true(typeof app.listen === 'function');
});
test('should call preHook', t => {
let called = 0;
getApp({ preHook: () => {
called++;
} });
t.true(called === 1);
});
test('should call preRouterHook', t => {
let called = 0;
getApp({ preRouterHook: () => {
called++;
} });
t.true(called === 1);
});