mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
feature(cloudcmd) sinon, sinon-called-with-diff -> @cloudcmd/stub
This commit is contained in:
parent
2f56d2b5ca
commit
497f7bcd40
24 changed files with 182 additions and 222 deletions
|
|
@ -2,12 +2,11 @@
|
|||
|
||||
const test = require('tape');
|
||||
const exit = require('./exit');
|
||||
const diff = require('sinon-called-with-diff');
|
||||
const sinon = diff(require('sinon'));
|
||||
const stub = require('@cloudcmd/stub');
|
||||
|
||||
test('cloudcmd: exit: process.exit', (t) => {
|
||||
const {exit:exitOriginal} = process;
|
||||
process.exit = sinon.stub();
|
||||
process.exit = stub();
|
||||
|
||||
exit();
|
||||
t.ok(process.exit.calledWith(1), 'should call process.exit');
|
||||
|
|
@ -20,8 +19,8 @@ test('cloudcmd: exit: console.error', (t) => {
|
|||
const {exit:exitOriginal} = process;
|
||||
const {error} = console;
|
||||
|
||||
console.error = sinon.stub();
|
||||
process.exit = sinon.stub();
|
||||
console.error = stub();
|
||||
process.exit = stub();
|
||||
|
||||
exit('hello world');
|
||||
t.ok(console.error.calledWith('hello world'), 'should call console.error');
|
||||
|
|
@ -36,8 +35,8 @@ test('cloudcmd: exit.error: console.error: error', (t) => {
|
|||
const {exit:exitOriginal} = process;
|
||||
const {error} = console;
|
||||
|
||||
console.error = sinon.stub();
|
||||
process.exit = sinon.stub();
|
||||
console.error = stub();
|
||||
process.exit = stub();
|
||||
|
||||
exit(Error('hello world'));
|
||||
t.ok(console.error.calledWith('hello world'), 'should call console.error');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue