UNPKG

685 BJavaScriptView Raw
1require('../lib/test-basics')('inmemory', require('../inmemory')())
2
3const test = require('tap').test
4const inmemory = require('../inmemory')
5const through = require('through2')
6
7const failHasher = (algo, cb) => {
8 process.nextTick(() => cb(new Error('Test Error')))
9 return through(() => {})
10}
11
12test('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
20test('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})