mirror of
https://github.com/kou029w/websri.git
synced 2025-01-19 00:18:11 +00:00
33 lines
1.2 KiB
JavaScript
33 lines
1.2 KiB
JavaScript
|
import assert from "node:assert/strict";
|
||
|
import { test } from "node:test";
|
||
|
import { IntegrityMetadataSet } from "../../dist/index.js";
|
||
|
|
||
|
test("join() can be used", function () {
|
||
|
const integrityMetadataSet = new IntegrityMetadataSet(
|
||
|
`
|
||
|
sha384-VbxVaw0v4Pzlgrpf4Huq//A1ZTY4x6wNVJTCpkwL6hzFczHHwSpFzbyn9MNKCJ7r
|
||
|
sha512-wVJ82JPBJHc9gRkRlwyP5uhX1t9dySJr2KFgYUwM2WOk3eorlLt9NgIe+dhl1c6ilKgt1JoLsmn1H256V/eUIQ==
|
||
|
`,
|
||
|
);
|
||
|
|
||
|
assert.strictEqual(
|
||
|
integrityMetadataSet.join(),
|
||
|
"sha384-VbxVaw0v4Pzlgrpf4Huq//A1ZTY4x6wNVJTCpkwL6hzFczHHwSpFzbyn9MNKCJ7r sha512-wVJ82JPBJHc9gRkRlwyP5uhX1t9dySJr2KFgYUwM2WOk3eorlLt9NgIe+dhl1c6ilKgt1JoLsmn1H256V/eUIQ==",
|
||
|
);
|
||
|
});
|
||
|
|
||
|
test("a separator can be specified", function () {
|
||
|
const integrityMetadataSet = new IntegrityMetadataSet(
|
||
|
`
|
||
|
sha384-VbxVaw0v4Pzlgrpf4Huq//A1ZTY4x6wNVJTCpkwL6hzFczHHwSpFzbyn9MNKCJ7r
|
||
|
sha512-wVJ82JPBJHc9gRkRlwyP5uhX1t9dySJr2KFgYUwM2WOk3eorlLt9NgIe+dhl1c6ilKgt1JoLsmn1H256V/eUIQ==
|
||
|
`,
|
||
|
);
|
||
|
|
||
|
assert.strictEqual(
|
||
|
integrityMetadataSet.join("\n"),
|
||
|
`sha384-VbxVaw0v4Pzlgrpf4Huq//A1ZTY4x6wNVJTCpkwL6hzFczHHwSpFzbyn9MNKCJ7r
|
||
|
sha512-wVJ82JPBJHc9gRkRlwyP5uhX1t9dySJr2KFgYUwM2WOk3eorlLt9NgIe+dhl1c6ilKgt1JoLsmn1H256V/eUIQ==`,
|
||
|
);
|
||
|
});
|