Skip to content

Commit 0308826

Browse files
committed
add a test
Signed-off-by: Morgan Kleene <[email protected]>
1 parent a0485ca commit 0308826

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

lib/tests/mocha/unit/assertions.spec.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// tests for assertions.ts
22

3+
34
import { expect } from 'chai';
45

56
import * as assertions from '../../../tdf3/src/assertions.js';
@@ -21,5 +22,33 @@ describe('assertions', () => {
2122
})
2223
).to.be.true;
2324
});
25+
26+
it('normalizes assertions', async () => {
27+
let assertion: any = {
28+
appliesToState: "unencrypted",
29+
id: "system-metadata",
30+
binding: {
31+
method: "jws",
32+
signature: "test-signature"
33+
},
34+
signingKey: {
35+
"alg": "ES256",
36+
"key": new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]),
37+
},
38+
scope: "payload",
39+
statement: {
40+
format: "json",
41+
schema: "system-metadata-v1",
42+
value: "{\"tdf_spec_version\":\"4.3.0\",\"creation_date\":\"2025-07-23T09:25:51.255364+02:00\",\"operating_system\":\"Mac OS X\",\"sdk_version\":\"Java-0.8.2-SNAPSHOT\",\"java_version\":\"17.0.14\",\"architecture\":\"aarch64\"}"
43+
},
44+
type: "other"
45+
};
46+
47+
let h1 = await assertions.hash(assertion);
48+
delete assertion.signingKey;
49+
let h2 = await assertions.hash(assertion);
50+
51+
expect(h1).to.equal(h2);
52+
});
2453
});
2554
});

0 commit comments

Comments
 (0)