1 | require('../lib/test-basics')('inmemory', require('../inmemory')())
|
2 |
|
3 | const test = require('tap').test
|
4 | const inmemory = require('../inmemory')
|
5 | const through = require('through2')
|
6 |
|
7 | const failHasher = (algo, cb) => {
|
8 | process.nextTick(() => cb(new Error('Test Error')))
|
9 | return through(() => {})
|
10 | }
|
11 |
|
12 | test('inmemory: (implementation) hash error in hash()', t => {
|
13 | t.plan(1)
|
14 | let store = inmemory('noop', failHasher)
|
15 | store.hash(Buffer.from('asdf'), err => {
|
16 | t.type(err, 'Error')
|
17 | })
|
18 | })
|
19 |
|
20 | test('inmemory: (implementation) hash error in set()', t => {
|
21 | t.plan(1)
|
22 | let store = inmemory('noop', failHasher)
|
23 | store.set(Buffer.from('asdf'), err => {
|
24 | t.type(err, 'Error')
|
25 | })
|
26 | })
|