1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

add hook tests

This commit is contained in:
sveisvei 2016-12-29 11:42:54 +01:00 committed by Ivar Conradi Østhus
parent 2f1680d9c0
commit 17c58e77f2
2 changed files with 32 additions and 0 deletions

31
lib/app.test.js Normal file
View File

@ -0,0 +1,31 @@
'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);
});

View File

@ -85,6 +85,7 @@
"eslint": "^3.11.1",
"eslint-config-finn": "^1.0.0-beta.1",
"nyc": "^9.0.1",
"proxyquire": "^1.7.10",
"sinon": "^1.17.5",
"superagent": "^2.3.0",
"supertest": "^2.0.1",