mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
test(config) coverage: middle
This commit is contained in:
parent
81f4a207a7
commit
aa707d9afb
2 changed files with 21 additions and 3 deletions
|
|
@ -5,11 +5,14 @@ const path = require('path');
|
|||
|
||||
const test = require('tape');
|
||||
const readjson = require('readjson');
|
||||
const diff = require('sinon-called-with-diff');
|
||||
const sinon = diff(require('sinon'));
|
||||
|
||||
const root = '../../';
|
||||
const dir = root + 'server/';
|
||||
const config = require(dir + 'config');
|
||||
const {_cryptoPass} = config;
|
||||
const {apiURL} = require(root + 'common/cloudfunc');
|
||||
|
||||
const pathHomeConfig = path.join(os.homedir(), '.cloudcmd.json');
|
||||
const pathConfig = path.join(__dirname, '..', '..', 'json', 'config.json');
|
||||
|
|
@ -106,3 +109,19 @@ test('config: cryptoPass', (t) => {
|
|||
t.end();
|
||||
});
|
||||
|
||||
test('config: middle: no', (t) => {
|
||||
const {middle} = config;
|
||||
const next = sinon.stub();
|
||||
const res = null;
|
||||
const url = `${apiURL}/config`;
|
||||
const method = 'POST';
|
||||
const req = {
|
||||
url,
|
||||
method
|
||||
};
|
||||
|
||||
middle(req, res, next);
|
||||
t.ok(next.calledWith(), 'should call next');
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue