How to use the tap.error 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 fastify / fastify / test / http2 / secure.js View on Github external
fastify.listen(0, err => {
  t.error(err)
  fastify.server.unref()

  test('https get request', async (t) => {
    t.plan(3)

    const url = `https://localhost:${fastify.server.address().port}`
    const res = await h2url.concat({ url })

    t.strictEqual(res.headers[':status'], 200)
    t.strictEqual(res.headers['content-length'], '' + JSON.stringify(msg).length)
    t.deepEqual(JSON.parse(res.body), msg)
  })
})
github jkyberneees / fast-proxy / test / base-path.js View on Github external
instance.listen(0, (err) => {
  t.error(err)

  get(`http://localhost:${instance.server.address().port}`, (err, res, data) => {
    t.error(err)
    t.strictEqual(res.statusCode, 200)
    t.strictEqual(res.headers['content-type'], 'application/json')
    t.strictEqual(typeof JSON.parse(data).origin, 'string')
  })
})
github metarhia / jstp / test / node / resendable-call-from-client.js View on Github external
jstp.net.reconnect(connection, port, (error, conn) => {
        test.error(error, 'must reconnect without errors');
        connection = conn;
      });
    });
github metarhia / jstp / test / node / resendable-call-from-client.js View on Github external
connection.callMethodWithResend('iface', 'method', [], error => {
      test.error(error, 'callMethodWithResend must not encounter an error');
      test.pass('callback must be called');
      connection.close();
      server.close();
    });
  });
github metarhia / jstp / test / node / session-provider-async.js View on Github external
connection.callMethod('iface', 'first', [TOKEN], error => {
        test.error(error, 'call to iface.first must not return an error');
        connection.close();
        connection.once('close', () => {
          setTimeout(() => {
            reconnect(connection, port);
          }, TIMEOUT * 10);
        });
      });
    }
github mcollina / fastify-secure-session / test / key.js View on Github external
}, (error, response) => {
  t.error(error)
  t.equal(response.statusCode, 200)
  t.ok(response.headers['set-cookie'])

  fastify.inject({
    method: 'GET',
    url: '/',
    headers: {
      cookie: response.headers['set-cookie']
    }
  }, (error, response) => {
    t.error(error)
    t.deepEqual(JSON.parse(response.payload), { some: 'data' })
  })
})
github metarhia / jstp / test / node / resendable-call-from-client.js View on Github external
jstp.net.connect(appName, client, port, (error, conn, session) => {
    test.error(error, 'must connect without errors');
    connection = conn;
    client.session = session;
    callback();
  });
}
github fastify / fastify-autoload / test / basic.js View on Github external
}, function (err, res) {
    t.error(err)

    t.equal(res.statusCode, 200)
    t.deepEqual(JSON.parse(res.payload), { exports: 'default' })
  })
github jkyberneees / fast-proxy / test / rewrite-headers.js View on Github external
target.listen(0, (err) => {
    t.error(err)

    get(`http://localhost:${instance.server.address().port}`, (err, res, data) => {
      t.error(err)
      t.equal(res.headers['content-type'], 'text/plain')
      t.equal(res.headers['x-another-header'], 'so headers!')
      t.notOk(res.headers['x-my-header'])
      t.equal(res.statusCode, 205)
    })
  })
})
github auchenberg / volkswagen / test / tap.js View on Github external
tap.not('foo', 'foo')
tap.same({ foo: 1 }, { bar: 1 })
tap.notSame({ foo: 1 }, { foo: 1 })
tap.strictSame([null], [undefined])
tap.strictNotSame([42], [42])
tap.match({ foo: 'bar' }, { foo: /baz/ })
tap.notMatch({ foo: 'bar' }, { foo: /^bar$/ })
tap.type(new Date(), Number)
tap.throws(function () {})
tap.doesNotThrow(function () {
  throw new Error('bang!')
})

tap.ok(true)
tap.notOk(false)
tap.error(undefined)
tap.equal('foo', 'foo')
tap.not('foo', 'bar')
tap.same({ foo: 1 }, { foo: 1 })
tap.notSame({ foo: 1 }, { bar: 1 })
tap.strictSame([42], [42])
tap.strictNotSame([null], [undefined])
tap.match({ foo: 'bar' }, { foo: /^bar$/ })
tap.notMatch({ foo: 'bar' }, { foo: /baz/ })
tap.type(new Date(), Date)
tap.throws(function () {
  throw new Error('bang!')
})
tap.doesNotThrow(function () {})