Skip to content

Commit cac6257

Browse files
committed
add experimental test
1 parent 577877a commit cac6257

File tree

2 files changed

+128
-1
lines changed

2 files changed

+128
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"rebuild": "npm run clear && npm run build",
1616
"test": "npm run lint && npm run test-node",
1717
"test-karma": "karma start karma.conf.cjs",
18-
"test-node-no-cov": "npm run build-test && mocha dist/test/*.spec.js && rimraf dist/test",
18+
"test-node-no-cov": "npm run build-test && mocha --timeout 20000 dist/test/*.spec.js && rimraf dist/test",
1919
"test-node": "npm run build-test && npx c8 --exclude 'dist/test/**' mocha --timeout 20000 dist/test/*.spec.js && rm -rf dist/test || true",
2020
"coveralls": "npm run test; npx c8 --exclude 'dist/test/**' report --reporter=text-lcov > ./coverage/lcov.info"
2121
},

test/Verify.experimentation.spec.ts

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
import chai from 'chai'
2+
import { verifyCredential } from '../src/Verify.js'
3+
import { knownDIDRegistries } from '../src/test-fixtures/knownDidRegistries.js';
4+
const { expect } = chai;
5+
6+
/* This is just here for convenience, as an easy way to try things
7+
during development
8+
*/
9+
10+
const didWebCredential = {
11+
"type": [
12+
"VerifiableCredential",
13+
"OpenBadgeCredential"
14+
],
15+
"name": "Teamwork Badge",
16+
"issuer": {
17+
"type": [
18+
"Profile"
19+
],
20+
"name": "Example Corp",
21+
"id": "did:web:digitalcredentials.github.io:dcc-did-web:issuer-registry-client-test"
22+
},
23+
"@context": [
24+
"https://www.w3.org/ns/credentials/v2",
25+
"https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.3.json",
26+
"https://w3id.org/security/suites/ed25519-2020/v1"
27+
],
28+
"validFrom": "2010-01-01T00:00:00Z",
29+
"credentialSubject": {
30+
"type": [
31+
"AchievementSubject"
32+
],
33+
"name": "Taylor Tuna",
34+
"achievement": {
35+
"id": "https://example.com/achievements/21st-century-skills/teamwork",
36+
"type": [
37+
"Achievement"
38+
],
39+
"name": "Masters - v2 - unrevoked",
40+
"criteria": {
41+
"narrative": "Team members are nominated for this badge by their peers and recognized upon review by Example Corp management."
42+
},
43+
"description": "This badge recognizes the development of the capacity to collaborate within a group environment."
44+
}
45+
},
46+
"id": "urn:uuid:677fe8a6cacf98774d482d07",
47+
"credentialStatus": {
48+
"id": "https://raw.githubusercontent.com/digitalcredentials/verifier-core/refs/heads/main/src/test-fixtures/status/e5WK8CbZ1GjycuPombrj#9",
49+
"type": "BitstringStatusListEntry",
50+
"statusPurpose": "revocation",
51+
"statusListCredential": "https://raw.githubusercontent.com/digitalcredentials/verifier-core/refs/heads/main/src/test-fixtures/status/e5WK8CbZ1GjycuPombrj",
52+
"statusListIndex": "9"
53+
},
54+
"proof": {
55+
"type": "Ed25519Signature2020",
56+
"created": "2025-05-05T18:25:25Z",
57+
"verificationMethod": "did:web:digitalcredentials.github.io:dcc-did-web:issuer-registry-client-test#z6MkjXe1vZvPRqFuc9nRBtZ3e1Y9XKDFSbjFAfzLfW2bD6cZ",
58+
"proofPurpose": "assertionMethod",
59+
"proofValue": "z5iDexxu7spQmDi5yrPYTqHvix3n64YBfwgLhWn9crZFf89wn14opXJZyqFpqmzuTLr8iTLaioxA48bAnH3xbdVoD"
60+
}
61+
} as any
62+
63+
const didKeyCredential = {
64+
"@context": [
65+
"https://www.w3.org/2018/credentials/v1",
66+
"https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.2.json",
67+
"https://w3id.org/security/suites/ed25519-2020/v1"
68+
],
69+
"id": "urn:uuid:2fe53dc9-b2ec-4939-9b2c-0d00f6663b6c",
70+
"issuanceDate": "2025-01-09T15:06:31Z",
71+
"type": [
72+
"VerifiableCredential",
73+
"OpenBadgeCredential"
74+
],
75+
"name": "DCC Test Credential",
76+
"issuer": {
77+
"type": [
78+
"Profile"
79+
],
80+
"id": "did:key:z6MkjoriXdbyWD25YXTed114F8hdJrLXQ567xxPHAUKxpKkS",
81+
"name": "Digital Credentials Consortium Test Issuer",
82+
"url": "https://dcconsortium.org",
83+
"image": "https://user-images.githubusercontent.com/752326/230469660-8f80d264-eccf-4edd-8e50-ea634d407778.png"
84+
},
85+
"credentialSubject": {
86+
"type": [
87+
"AchievementSubject"
88+
],
89+
"achievement": {
90+
"id": "urn:uuid:bd6d9316-f7ae-4073-a1e5-2f7f5bd22922",
91+
"type": [
92+
"Achievement"
93+
],
94+
"achievementType": "Diploma",
95+
"name": "Badge",
96+
"description": "This is a sample credential issued by the Digital Credentials Consortium to demonstrate the functionality of Verifiable Credentials for wallets and verifiers.",
97+
"criteria": {
98+
"type": "Criteria",
99+
"narrative": "This credential was issued to a student that demonstrated proficiency in the Python programming language that occurred from **February 17, 2023** to **June 12, 2023**."
100+
},
101+
"image": {
102+
"id": "https://user-images.githubusercontent.com/752326/214947713-15826a3a-b5ac-4fba-8d4a-884b60cb7157.png",
103+
"type": "Image"
104+
}
105+
},
106+
"name": "Jane Doe"
107+
},
108+
"proof": {
109+
"type": "Ed25519Signature2020",
110+
"created": "2025-05-05T19:23:07Z",
111+
"verificationMethod": "did:key:z6MkjoriXdbyWD25YXTed114F8hdJrLXQ567xxPHAUKxpKkS#z6MkjoriXdbyWD25YXTed114F8hdJrLXQ567xxPHAUKxpKkS",
112+
"proofPurpose": "assertionMethod",
113+
"proofValue": "z53hknRoyy5hazo2ZefMQHByRx289xtyJ9zmri2eWJvktNcDfcTMpC8L4aEy8Hyvw4m7Ay3JRRMDsYjSW1AAmKEHV"
114+
}
115+
} as any
116+
117+
118+
describe('tests to experiment during development work', () => {
119+
it.skip('returns oidf data', async () => {
120+
// change this however you like to test things, or more likely,
121+
// change the VC that is passed in.
122+
const result = await verifyCredential({ credential: didKeyCredential, knownDIDRegistries })
123+
console.log(JSON.stringify(result, null, 2))
124+
expect(true).to.equal(true)
125+
})
126+
})
127+

0 commit comments

Comments
 (0)