UNPKG

668 BJavaScriptView Raw
1'use strict'
2
3const t = require('tap')
4const test = t.test
5const fastify = require('..')()
6
7const noop = () => {}
8const opts = {
9 schema: {
10 response: {
11 '2xx': {
12 type: 'object',
13 properties: {
14 hello: {
15 type: 'string'
16 }
17 }
18 }
19 }
20 }
21}
22
23test('chainable - get', t => {
24 t.plan(1)
25 t.type(fastify.get('/', opts, noop), fastify)
26})
27
28test('chainable - post', t => {
29 t.plan(1)
30 t.type(fastify.post('/', opts, noop), fastify)
31})
32
33test('chainable - route', t => {
34 t.plan(1)
35 t.type(fastify.route({
36 method: 'GET',
37 url: '/other',
38 schema: opts.schema,
39 handler: noop
40 }), fastify)
41})