1 | 'use strict'
|
2 |
|
3 | const t = require('tap')
|
4 | const test = t.test
|
5 | const proxyquire = require('proxyquire')
|
6 | const server = proxyquire('../../lib/server', { http2: null })
|
7 | const Fastify = proxyquire('../..', { './lib/server.js': server })
|
8 |
|
9 | test('should throw when http2 module cannot be found', t => {
|
10 | t.plan(1)
|
11 | try {
|
12 | Fastify({ http2: true })
|
13 | t.fail('fastify did not throw expected error')
|
14 | } catch (err) {
|
15 | t.equal(err.message, 'FST_ERR_HTTP2_INVALID_VERSION: HTTP2 is available only from node >= 8.8.1')
|
16 | }
|
17 | })
|