UNPKG

1.11 kBJavaScriptView Raw
1var tunnelLauncher = require('./../lib/tunnel-launcher');
2var assert = require('assert');
3
4describe('Tunnel Launcher', function() {
5
6 it('should error when trying to kill a non-existing tunnel', function(done) {
7 tunnelLauncher.kill(function(err) {
8 assert.equal(err.message, 'no active tunnel');
9 done();
10 });
11 });
12
13 it('should error when trying to download a wrong tunnel version', function(done) {
14 tunnelLauncher({ tunnelVersion: 'wrong' }, function(err, tunnel) {
15 assert.equal(tunnel, null);
16 assert.equal(err.message, 'Could not download the tunnel from TestingBot - please check your connection. Could not download https://testingbot.com/tunnel/testingbot-tunnel-wrong.jar, statusCode: 404');
17 done();
18 });
19 });
20
21 it('should correctly return an error when the tunnel returns an error', function(done) {
22 this.timeout(20000);
23 tunnelLauncher({ apiKey: 'fake', apiSecret: 'fake' }, function(err, tunnel) {
24 assert.equal(tunnel, null);
25 assert.equal(err.message, "Invalid credentials. Please supply the correct key/secret obtained from TestingBot.com");
26 done();
27 });
28 });
29
30});
\No newline at end of file