UNPKG

664 BJavaScriptView Raw
1'use strict'
2
3const t = require('tap')
4const test = t.test
5const Fastify = require('..')
6const {
7 kOptions
8} = require('../lib/symbols')
9
10test('root fastify instance is an object', t => {
11 t.plan(1)
12 t.type(Fastify(), 'object')
13})
14
15test('fastify instance should contains ajv options', t => {
16 t.plan(1)
17 const fastify = Fastify({
18 ajv: {
19 customOptions: {
20 nullable: false
21 }
22 }
23 })
24 t.same(fastify[kOptions].ajv, {
25 customOptions: {
26 nullable: false
27 },
28 plugins: []
29 })
30})
31
32test('fastify instance get invalid ajv options', t => {
33 t.plan(1)
34 t.throw(() => Fastify({
35 ajv: {
36 customOptions: 8
37 }
38 }))
39})