diff options
Diffstat (limited to '')
-rw-r--r-- | test/dispatcher.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/dispatcher.js b/test/dispatcher.js new file mode 100644 index 0000000..22750a1 --- /dev/null +++ b/test/dispatcher.js @@ -0,0 +1,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') +}) |