Skip to content
This repository has been archived by the owner on Jul 3, 2019. It is now read-only.

Commit

Permalink
fix(config): Add ssri config 'error' option (#146)
Browse files Browse the repository at this point in the history
* fix(config): add more ssri config options

Fixes: https://npm.community/t/npm-install-tgz-invalid-config-key-requested/2395
Ref: 10d5d9a

* test(write): integrity error test case
  • Loading branch information
larsgw authored and zkat committed Jun 17, 2019
1 parent 7799149 commit 47de8f5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions put.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const PutOpts = figgyPudding({
gid: {},
single: {},
sep: {},
error: {},
strict: {}
})

Expand Down
10 changes: 10 additions & 0 deletions test/put.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,16 @@ test('optionally memoizes data on stream insertion', t => {
})
})

test('errors if integrity errors', t => {
return BB.join(
put(CACHE, KEY, CONTENT, {
integrity: 'sha1-BaDDigEST'
}).catch(err => {
t.equal(err.code, 'EINTEGRITY', 'got error from bad integrity')
})
)
})

test('signals error if error writing to cache', t => {
return BB.join(
put(CACHE, KEY, CONTENT, {
Expand Down

0 comments on commit 47de8f5

Please # to comment.