mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
test(modulas) no modules
This commit is contained in:
parent
16e1fbd9a9
commit
3d3a479a59
2 changed files with 22 additions and 3 deletions
|
|
@ -3,12 +3,18 @@
|
|||
const path = require('path');
|
||||
const test = require('tape');
|
||||
|
||||
const diff = require('sinon-called-with-diff');
|
||||
const sinon = diff(require('sinon'));
|
||||
|
||||
const promisify = require('es6-promisify');
|
||||
const pullout = require('pullout');
|
||||
const request = require('request');
|
||||
|
||||
const modulesPath = path.join(__dirname, '..', '..', 'json', 'modules.json');
|
||||
const dir = path.join(__dirname, '..', '..');
|
||||
const modulesPath = path.join(dir, 'json', 'modules.json');
|
||||
|
||||
const localModules = require(modulesPath);
|
||||
const modulas = require(`${dir}/server/modulas`);
|
||||
|
||||
const warp = (fn, ...a) => (...b) => fn(...b, ...a);
|
||||
const _pullout = promisify(pullout);
|
||||
|
|
@ -65,3 +71,16 @@ test('cloudcmd: modules: wrong route', (t) => {
|
|||
});
|
||||
});
|
||||
|
||||
test('cloudcmd: modules: no', (t) => {
|
||||
const fn = modulas();
|
||||
const url = '/json/modules.json';
|
||||
const send = sinon.stub();
|
||||
|
||||
fn({url}, {
|
||||
send
|
||||
});
|
||||
|
||||
t.ok(send.calledWith(localModules), 'should have been called with modules');
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue