-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is going to be used in Pacote to upgrade the Fetcher.integrity value with the data that comes out of cacache, but in such a way that we don't accidentally suppress integrity errors. PR-URL: #4 Credit: @isaacs Close: #4 Reviewed-by: @isaacs
- Loading branch information
Showing
3 changed files
with
73 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const ssri = require('../') | ||
const t = require('tap') | ||
|
||
const i = ssri.parse('sha1-foo') | ||
const o = ssri.parse('sha512-bar') | ||
i.merge(o) | ||
t.equal(i.toString(), 'sha1-foo sha512-bar', 'added second algo') | ||
t.throws(() => i.merge(ssri.parse('sha1-baz')), { | ||
message: 'hashes do not match, cannot update integrity' | ||
}) | ||
i.merge(o) | ||
i.merge(ssri.parse('sha1-foo')) | ||
t.equal(i.toString(), 'sha1-foo sha512-bar', 'did not duplicate') |