Skip to content

Commit b45a2bc

Browse files
committedOct 3, 2019
test: coverage for last few lines of content/write.js
1 parent 025d585 commit b45a2bc

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
 

‎test/content.write.js

+22
Original file line numberDiff line numberDiff line change
@@ -241,3 +241,25 @@ test('checks the size of stream data if opts.size provided', (t) => {
241241
return w.promise().then(() => t.ok(int3, 'got a digest'))
242242
})
243243
})
244+
245+
test('only one algorithm for now', t => {
246+
t.throws(() => write(CACHE, 'foo', { algorithms: [1, 2] }), {
247+
message: 'opts.algorithms only supports a single algorithm for now'
248+
})
249+
t.end()
250+
})
251+
252+
test('writes to cache with default options', t =>
253+
t.resolveMatch(write(CACHE, 'foo'), {
254+
size: 3,
255+
integrity: {
256+
sha512: [
257+
{
258+
source: 'sha512-9/u6bgY2+JDlb7vzKD5STG+jIErimDgtYkdB0NxmODJuKCxBvl5CVNiCB3LFUYosWowMf37aGVlKfrU5RT4e1w==',
259+
digest: '9/u6bgY2+JDlb7vzKD5STG+jIErimDgtYkdB0NxmODJuKCxBvl5CVNiCB3LFUYosWowMf37aGVlKfrU5RT4e1w==',
260+
algorithm: 'sha512',
261+
options: []
262+
}
263+
]
264+
}
265+
}))

0 commit comments

Comments
 (0)
Please sign in to comment.