main-spec.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. var tunnel = require('../');
  2. var helper = require('./server');
  3. var chai = require('chai');
  4. var expect = chai.expect;
  5. describe('tunnel-ssh', function () {
  6. it('should emit an error', function (done) {
  7. var config = {
  8. host: '127.0.0.1', username: process.env.USER, dstPort: 8000, localPort: 7000
  9. };
  10. tunnel(config, function () {
  11. helper.createClient(7000, '127.0.0.1', done);
  12. }).on('error', function (e) {
  13. expect(e).to.be.instanceOf(Error);
  14. done(null);
  15. });
  16. });
  17. it('brokenConfig, should callback an error', function (done) {
  18. var brokenConfig = {};
  19. tunnel(brokenConfig, function (e) {
  20. expect(e).to.be.instanceOf(Error);
  21. done();
  22. });
  23. });
  24. it('brokenConfig, should emit an error', function (done) {
  25. var brokenConfig = {};
  26. tunnel(brokenConfig).on('error', function (e) {
  27. expect(e).to.be.instanceOf(Error);
  28. done(null);
  29. });
  30. });
  31. });