Skip to content

Commit

Permalink
Fixes how RED.start is restored in test
Browse files Browse the repository at this point in the history
  • Loading branch information
hlapp committed Mar 5, 2017
1 parent c2c629d commit 8e520a5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/02.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ test('can inject wait into RED.start()', function(t) {
test('arguments with which RED.start() is called are passed on', function(t) {
t.plan(5);

let funcToRestore = RED.start;
let stub = sinon.stub(RED, "start");
stub.returns(Promise.resolve(42));

Expand All @@ -104,12 +105,12 @@ test('arguments with which RED.start() is called are passed on', function(t) {
return RED.start("one", "two", "three");
}).then(() => {
let call = stub.getCall(1);
RED.start = funcToRestore; // should precede last test = this is async
t.deepEqual(call.args, ["one", "two", "three"],
'correctly passes through multiple arguments');
t.equal(call.thisValue, RED, '"this" is set to RED');
RED.start.restore();
}).catch((err) => {
RED.start.restore();
RED.start = funcToRestore;
failAndEnd(t)(err);
});
});

0 comments on commit 8e520a5

Please sign in to comment.