mirror of
https://github.com/mmumshad/ansible-playable.git
synced 2025-03-09 23:38:54 +00:00
Feature - Integrate System API to view logs in UI
This commit is contained in:
parent
1690470269
commit
bf6c8743c5
15 changed files with 353 additions and 26 deletions
49
server/api/system/index.spec.js
Normal file
49
server/api/system/index.spec.js
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
'use strict';
|
||||
|
||||
/* globals sinon, describe, expect, it */
|
||||
|
||||
var proxyquire = require('proxyquire').noPreserveCache();
|
||||
|
||||
var systemCtrlStub = {
|
||||
serverLogs: 'systemCtrl.serverLogs',
|
||||
apiLogs: 'systemCtrl.apiLogs'
|
||||
};
|
||||
|
||||
var routerStub = {
|
||||
get: sinon.spy(),
|
||||
serverLogs: sinon.spy(),
|
||||
apiLogs: sinon.spy()
|
||||
};
|
||||
|
||||
// require the index with our stubbed out modules
|
||||
var systemIndex = proxyquire('./index.js', {
|
||||
express: {
|
||||
Router() {
|
||||
return routerStub;
|
||||
}
|
||||
},
|
||||
'./system.controller': systemCtrlStub
|
||||
});
|
||||
|
||||
describe('System API Router:', function() {
|
||||
it('should return an express router instance', function() {
|
||||
expect(systemIndex).to.equal(routerStub);
|
||||
});
|
||||
|
||||
describe('GET /api/system/logs/server', function() {
|
||||
it('should route to system.controller.serverLogs', function() {
|
||||
expect(routerStub.get
|
||||
.withArgs('/logs/server', 'systemCtrl.serverLogs')
|
||||
).to.have.been.calledOnce;
|
||||
});
|
||||
});
|
||||
|
||||
describe('GET /api/system/logs/api', function() {
|
||||
it('should route to system.controller.apiLogs', function() {
|
||||
expect(routerStub.get
|
||||
.withArgs('/logs/api', 'systemCtrl.apiLogs')
|
||||
).to.have.been.calledOnce;
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue