test('session unknown message', function (t) { t.plan(2) const session = new BrowserSession('abc', 30e3, '.') session.on('error', function (err) { t.is(err.message, 'Unknown message type') }) session.on('close', function () { t.pass('closed') }) session.resume() session.write({ type: 'foo' }) })
t('Connect using uri', async() => [true, await new Promise((resolve, reject) => { const sql = postgres('postgres://' + login.user + ':' + (login.pass || '') + '@localhost:5432/' + options.db, { idle_timeout: options.idle_timeout }) sql`select 1`.then(() => resolve(true), reject) })] )
arr.map(function (obj) { return { user:obj.user, pass:obj.pass, mac:mac } })
// https://github.com/defunctzombie/zuul/issues/145 test('ok', function (t) { t.pass() t.end() })
test('shorthand - get params', t => { t.plan(1) try { fastify.get('/params/:foo/:test', paramsSchema, function (req, reply) { reply.code(200).send(req.params) }) t.pass() } catch (e) { t.fail() } })
test('opts.browser.asObject defensively mitigates naughty numbers', ({ end, pass }) => { const instance = pino({ browser: { asObject: true, write: () => {} } }) const child = instance.child({ test: 'test' }) child._childLevel = -10 child.info('test') pass() // if we reached here, there was no infinite loop, so, .. pass. end() })
test('Should throw if found duplicate handler as the third parameter to the shortcut method and in options', t => { t.plan(1) const fastify = Fastify() try { fastify.get('/foo/abc', { handler: (req, res) => {} }, (req, res) => {}) t.fail() } catch (e) { t.pass() } })
test('Should throw on duplicate decorator', t => { t.plan(1) const fastify = Fastify() const fooObj = {} fastify.decorate('foo', fooObj) try { fastify.decorate('foo', fooObj) t.fail() } catch (e) { t.pass() } })
test('missing schema - head', t => { t.plan(1) try { fastify.head('/missing', function (req, reply) { reply.code(200).send(null) }) t.pass() } catch (e) { t.fail() } })
test('Fastify should throw on wrong options', t => { t.plan(2) try { Fastify('lol') t.fail() } catch (e) { t.is(e.message, 'Options must be an object') t.pass() } })
test('shorthand - head params', t => { t.plan(1) try { fastify.head('/params/:foo/:test', paramsSchema, function (req, reply) { reply.send(null) }) t.pass() } catch (e) { t.fail() } })
test('should pass when using unWritable props in the logger option', t => { t.plan(1) Fastify({ logger: Object.defineProperty({}, 'level', { value: 'info' }) }) t.pass() })
test('shorthand - get, querystring schema', t => { t.plan(1) try { fastify.get('/query', querySchema, function (req, reply) { reply.code(200).send(req.query) }) t.pass() } catch (e) { t.fail() } })
test('empty response', t => { t.plan(1) try { // no checks fastify.get('/empty', opts, function (req, reply) { reply.code(204).send() }) t.pass() } catch (e) { t.fail() } })
test('unlisted response code', t => { t.plan(1) try { fastify.get('/400', opts, function (req, reply) { reply.code(400).send({ hello: 'DOOM' }) }) t.pass() } catch (e) { t.fail() } })