Skip to content

Commit

Permalink
Updated ssh transport test to use end event rather than close
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Pigott committed Jan 4, 2016
1 parent 1668be7 commit c1e583c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/test.transport.ssh.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ describe('transport/ssh', function() {
SSH2_EXEC_STREAM_MOCK.on.withArgs('data').firstCall.args[1]('output');
SSH2_EXEC_STREAM_MOCK.on.withArgs('data').lastCall.args[1]('output'); // byline mock
SSH2_EXEC_STREAM_MOCK.on.withArgs('exit').lastCall.args[1](0);
SSH2_EXEC_STREAM_MOCK.on.withArgs('close').lastCall.args[1]();
SSH2_EXEC_STREAM_MOCK.on.withArgs('end').lastCall.args[1]();
});

var result = ssh._exec('command');
Expand Down Expand Up @@ -237,7 +237,7 @@ describe('transport/ssh', function() {

SSH2_EXEC_STREAM_MOCK.on.withArgs('data').lastCall.args[1]('output'); // byline mock
SSH2_EXEC_STREAM_MOCK.on.withArgs('exit').lastCall.args[1](0);
SSH2_EXEC_STREAM_MOCK.on.withArgs('close').lastCall.args[1]();
SSH2_EXEC_STREAM_MOCK.on.withArgs('end').lastCall.args[1]();
});

ssh._exec('echo "hello world"');
Expand All @@ -249,7 +249,7 @@ describe('transport/ssh', function() {

SSH2_EXEC_STREAM_MOCK.on.withArgs('data').lastCall.args[1]('output'); // byline mock
SSH2_EXEC_STREAM_MOCK.on.withArgs('exit').lastCall.args[1](0);
SSH2_EXEC_STREAM_MOCK.on.withArgs('close').lastCall.args[1]();
SSH2_EXEC_STREAM_MOCK.on.withArgs('end').lastCall.args[1]();
});

ssh._exec('echo "hello world"', { silent: false });
Expand All @@ -271,7 +271,7 @@ describe('transport/ssh', function() {
SSH2_EXEC_STREAM_MOCK.on.withArgs('data').firstCall.args[1]('silent\n');
SSH2_EXEC_STREAM_MOCK.on.withArgs('data').lastCall.args[1]('silent\n'); // byline mock
SSH2_EXEC_STREAM_MOCK.on.withArgs('exit').lastCall.args[1](0);
SSH2_EXEC_STREAM_MOCK.on.withArgs('close').lastCall.args[1]();
SSH2_EXEC_STREAM_MOCK.on.withArgs('end').lastCall.args[1]();
});

var result = ssh._exec('echo "silent"', { silent: true });
Expand Down Expand Up @@ -303,7 +303,7 @@ describe('transport/ssh', function() {
// byline mock
SSH2_EXEC_STREAM_MOCK.stderr.on.withArgs('data').lastCall.args[1]('not found\n');
SSH2_EXEC_STREAM_MOCK.on.withArgs('exit').lastCall.args[1](127);
SSH2_EXEC_STREAM_MOCK.on.withArgs('close').lastCall.args[1]();
SSH2_EXEC_STREAM_MOCK.on.withArgs('end').lastCall.args[1]();
});

var result = ssh._exec('invalid-command', { failsafe: true });
Expand Down Expand Up @@ -334,7 +334,7 @@ describe('transport/ssh', function() {
// byline mock
SSH2_EXEC_STREAM_MOCK.stderr.on.withArgs('data').lastCall.args[1]('not found\n');
SSH2_EXEC_STREAM_MOCK.on.withArgs('exit').lastCall.args[1](127);
SSH2_EXEC_STREAM_MOCK.on.withArgs('close').lastCall.args[1]();
SSH2_EXEC_STREAM_MOCK.on.withArgs('end').lastCall.args[1]();
});

expect(function() {
Expand Down Expand Up @@ -362,7 +362,7 @@ describe('transport/ssh', function() {
setImmediate(function() {
SSH2_EXEC_STUB.lastCall.args[2](null, SSH2_EXEC_STREAM_MOCK);

SSH2_EXEC_STREAM_MOCK.on.withArgs('close').lastCall.args[1]();
SSH2_EXEC_STREAM_MOCK.on.withArgs('end').lastCall.args[1]();
});

ssh._exec('echo "test"', { exec: EXEC_OPTIONS });
Expand Down

0 comments on commit c1e583c

Please sign in to comment.