UNPKG

719 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()
15 store._createHasher = failHasher
16 store.hash(Buffer.from('asdf'), err => {
17 t.type(err, 'Error')
18 })
19})
20
21test('inmemory: (implementation) hash error in set()', t => {
22 t.plan(1)
23 let store = inmemory()
24 store._createHasher = failHasher
25 store.set(Buffer.from('asdf'), err => {
26 t.type(err, 'Error')
27 })
28})