1 | 'use strict'
|
2 |
|
3 | const t = require('tap')
|
4 | const test = t.test
|
5 | const Fastify = require('..')
|
6 | const {
|
7 | kOptions
|
8 | } = require('../lib/symbols')
|
9 |
|
10 | test('root fastify instance is an object', t => {
|
11 | t.plan(1)
|
12 | t.type(Fastify(), 'object')
|
13 | })
|
14 |
|
15 | test('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 |
|
32 | test('fastify instance get invalid ajv options', t => {
|
33 | t.plan(1)
|
34 | t.throw(() => Fastify({
|
35 | ajv: {
|
36 | customOptions: 8
|
37 | }
|
38 | }))
|
39 | })
|