This repository was archived by the owner on Oct 1, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathopenAttestationRevocationStore.test.ts
More file actions
75 lines (74 loc) · 2.92 KB
/
openAttestationRevocationStore.test.ts
File metadata and controls
75 lines (74 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import { openAttestationRevocationStore } from "./openAttestationRevocationStore";
import { verificationBuilder } from "../verificationBuilder";
import { documentRopstenValidWithDocumentStore } from "../../../test/fixtures/v2/documentRopstenValidWithDocumentStore";
import { documentRopstenRevocationStoreNotRevoked, documentRopstenRevocationStoreRevoked } from "./revocationStore";
const verify = verificationBuilder([openAttestationRevocationStore]);
describe("OpenAttestationRevocationStore", () => {
describe("v2", () => {
it("should return a skipped fragment when document store is used", async () => {
const fragment = await verify(documentRopstenValidWithDocumentStore, { network: "ropsten" });
expect(fragment).toStrictEqual([
{
name: "OpenAttestationRevocationStore",
type: "DOCUMENT_STATUS",
reason: {
code: 4,
codeString: "SKIPPED",
message: 'Document issuers doesn\'t have "revocationStore"',
},
status: "SKIPPED",
},
]);
});
it("should return a valid fragment when revocation store is used and the document is not revoked", async () => {
const fragment = await verify(documentRopstenRevocationStoreNotRevoked, { network: "ropsten" });
expect(fragment).toStrictEqual([
{
name: "OpenAttestationRevocationStore",
type: "DOCUMENT_STATUS",
status: "VALID",
data: {
details: [
{
address: "0x8Fc57204c35fb9317D91285eF52D6b892EC08cD3",
revoked: false,
},
],
revokedOnAny: false,
},
},
]);
});
it("should return a invalid fragment when revocation store is used and the document is not revoked", async () => {
const fragment = await verify(documentRopstenRevocationStoreRevoked, { network: "ropsten" });
expect(fragment).toStrictEqual([
{
name: "OpenAttestationRevocationStore",
type: "DOCUMENT_STATUS",
reason: {
code: 1,
codeString: "DOCUMENT_REVOKED",
message:
"Certificate 0x856924fa2cf3374bf64697eb0dcf38d0251ff18aedae2bbc193398e8bb11fbd1 has been revoked under contract 0x8Fc57204c35fb9317D91285eF52D6b892EC08cD3",
},
status: "INVALID",
data: {
details: [
{
address: "0x8Fc57204c35fb9317D91285eF52D6b892EC08cD3",
reason: {
code: 1,
codeString: "DOCUMENT_REVOKED",
message:
"Certificate 0x856924fa2cf3374bf64697eb0dcf38d0251ff18aedae2bbc193398e8bb11fbd1 has been revoked under contract 0x8Fc57204c35fb9317D91285eF52D6b892EC08cD3",
},
revoked: true,
},
],
revokedOnAny: true,
},
},
]);
});
});
});