mirror of
https://github.com/fergalmoran/dss.web.git
synced 2026-02-15 12:34:17 +00:00
36 lines
755 B
JavaScript
36 lines
755 B
JavaScript
'use strict';
|
|
|
|
var proxyquire = require('proxyquire').noPreserveCache();
|
|
|
|
var thingCtrlStub = {
|
|
index: 'thingCtrl.index'
|
|
};
|
|
|
|
var routerStub = {
|
|
get: sinon.spy()
|
|
};
|
|
|
|
// require the index with our stubbed out modules
|
|
var thingIndex = proxyquire('./index.js', {
|
|
express: {
|
|
Router() {
|
|
return routerStub;
|
|
}
|
|
},
|
|
'./thing.controller': thingCtrlStub
|
|
});
|
|
|
|
describe('Thing API Router:', function() {
|
|
it('should return an express router instance', function() {
|
|
expect(thingIndex).to.equal(routerStub);
|
|
});
|
|
|
|
describe('GET /api/things', function() {
|
|
it('should route to thing.controller.index', function() {
|
|
expect(routerStub.get
|
|
.withArgs('/', 'thingCtrl.index')
|
|
).to.have.been.calledOnce;
|
|
});
|
|
});
|
|
});
|