How to use the tap.assertNot function in tap

To help you get started, we’ve selected a few tap examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github metarhia / jstp / test / node / default-reconnector-backoff.js View on Github external
(error, connection) => {
      test.assertNot(error, 'must connect to server and perform handshake');

      connection.on('error', () => {
        // dismiss
      });

      server.kill('SIGTERM');

      connection.on('reconnectAttempt', () => {
        test.pass('must attempt to reconnect');
      });

      setTimeout(() => {
        connection.close();
      }, WAITING_TIME);
    }
  );
github metarhia / jstp / test / node / regress-gh-313.js View on Github external
(err, connection) => {
      test.assertNot(err, 'must connect successfully');

      test.assert(
        net.isIP(connection.remoteAddress),
        'remoteAddress must be an IP address'
      );

      connection.close();
      server.close();
    }
  );
github metarhia / jstp / test / node / regress-gh-217.js View on Github external
(error, connection) => {
      tap.assertNot(error, 'client must connect successfully');

      connection.close();

      setTimeout(() => {
        server.close();
      }, HANDSHAKE_TIMEOUT + 100);
    }
  );
github metarhia / jstp / test / node / reconnection.js View on Github external
(error, conn) => {
        test.assertNot(error, 'must connect to server and perform handshake');
        connection = conn;
        done();
      }
    );
github metarhia / jstp / test / node / get-server-address-tcp.js View on Github external
'use strict';

const test = require('tap');

const jstp = require('../..');

const app = new jstp.Application('name', {});

const server = jstp.net.createServer([app]);

test.assertNot(
  server.address(),
  'must return null address if server is not listening'
);

server.listen(() => {
  const port = server.address().port;
  test.ok(
    port > 0 && port < 65536,
    'must return correct port number upon listening'
  );
  server.close();
});
github metarhia / jstp / test / node / resendable-call-from-server-to-closed-client.js View on Github external
jstp.net.connect(appName, client, port, 'localhost', (error, connection) => {
    test.assertNot(error, 'must connect to server');

    const serverConnection = server.getClientsArray()[0];

    connection.close();
    serverConnection.callMethodWithResend('iface', 'method', [], error => {
      test.assertNot(error, 'must not return an error');
      connection.close();
      server.close();
      test.end();
    });

    const port = server.address().port;
    client.session = connection.session;

    jstp.net.reconnect(connection, port, 'localhost', (error, conn) => {
      test.assertNot(error, 'must reconnect to server');
github metarhia / jstp / test / node / get-server-address-ipc.js View on Github external
let triedToUnlink = false;

server.on('close', () => {
  fs.unlink(config.path, () => {
    triedToUnlink = true;
  });
});

process.on('exit', () => {
  if (!triedToUnlink) {
    fs.unlinkSync(config.path);
  }
});

test.assertNot(
  server.address(),
  'must return null address if server is not listening'
);

server.listen(config.path, () => {
  test.strictEqual(
    server.address(),
    config.path,
    'must return correct path address upon listening'
  );
  server.close();
});
github metarhia / jstp / test / node / resendable-call-from-server-to-closed-client.js View on Github external
jstp.net.reconnect(connection, port, 'localhost', (error, conn) => {
      test.assertNot(error, 'must reconnect to server');
      connection = conn;
    });
  });
github metarhia / jstp / test / node / resendable-call-from-closed-client.js View on Github external
(error, connection, api) => {
      test.assertNot(error, 'must connect to server');

      connection.close();
      api.iface.method(error => {
        test.assertNot(error, 'must not return an error');
        connection.close();
        server.close();
      }, true);

      const port = server.address().port;

      jstp.net.reconnect(connection, port, 'localhost', (error, conn) => {
        test.assertNot(error, 'must reconnect to server');
        connection = conn;
      });
    }
  );
github metarhia / jstp / test / node / connection-call.js View on Github external
(error, conn) => {
        test.assertNot(error, 'must connect to server and perform handshake');
        connection = conn;
        done();
      }
    );