mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
test(exit) test/server -> server/exit.spec
This commit is contained in:
parent
f4a0624470
commit
2b9fca8485
1 changed files with 3 additions and 2 deletions
|
|
@ -1,33 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
const test = require('tape');
|
||||
const exit = require('../../server/exit');
|
||||
const diff = require('sinon-called-with-diff');
|
||||
const sinon = diff(require('sinon'));
|
||||
|
||||
test('cloudcmd: exit: process.exit', (t) => {
|
||||
const {exit:exitOriginal} = process;
|
||||
process.exit = sinon.stub();
|
||||
|
||||
exit();
|
||||
t.ok(process.exit.calledWith(1), 'should call process.exit');
|
||||
process.exit = exitOriginal;
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('cloudcmd: exit: console.error', (t) => {
|
||||
const {exit:exitOriginal} = process;
|
||||
const {error} = console;
|
||||
|
||||
console.error = sinon.stub();
|
||||
process.exit = sinon.stub();
|
||||
|
||||
exit('hello world');
|
||||
t.ok(console.error.calledWith('hello world'), 'should call console.error');
|
||||
|
||||
process.exit = exitOriginal;
|
||||
console.error = error;
|
||||
|
||||
t.end();
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue