blob: 22750a1e81ccd0721901865bc6fe5e5cc8861090 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
'use strict'
const t = require('tap')
const { test } = t
const Dispatcher = require('../lib/dispatcher')
class PoorImplementation extends Dispatcher {}
test('dispatcher implementation', (t) => {
t.plan(6)
const dispatcher = new Dispatcher()
t.throws(() => dispatcher.dispatch(), Error, 'throws on unimplemented dispatch')
t.throws(() => dispatcher.close(), Error, 'throws on unimplemented close')
t.throws(() => dispatcher.destroy(), Error, 'throws on unimplemented destroy')
const poorImplementation = new PoorImplementation()
t.throws(() => poorImplementation.dispatch(), Error, 'throws on unimplemented dispatch')
t.throws(() => poorImplementation.close(), Error, 'throws on unimplemented close')
t.throws(() => poorImplementation.destroy(), Error, 'throws on unimplemented destroy')
})
|