Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DaevMithran committed Oct 8, 2024
1 parent c51f4e3 commit b4002fd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
10 changes: 8 additions & 2 deletions src/types/swagger-api-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,16 @@
* type: string
* example: [https://schema.org/schema.jsonld, https://veramo.io/contexts/profile/v1]
* parentAccreditation:
* description: DID Url of the parent Verifiable Accreditation.
* description: DID Url of the parent Verifiable Accreditation, required for accredit/attest operation.
* type: string
* rootAuthorization:
* description: DID Url of the root Verifiable Accreditation.
* description: DID Url of the root Verifiable Accreditation, required for accredit/attest operation.
* type: string
* trustFramework:
* description: Name or Type of the Trust Framework, required for authorize operation.
* type: string
* trustFrameworkId:
* description: Url of the Trust Framework, required for authorize operation.
* type: string
* type:
* description: Optional properties to be included in the `type` property of the Accreditation.
Expand Down
33 changes: 17 additions & 16 deletions tests/e2e/sequential/accreditation/revocation-flow.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,41 @@ import { CONTENT_TYPE, PAYLOADS_PATH } from '../../constants';

test.use({ storageState: 'playwright/.auth/user.json' });

let jwtCredential: VerifiableCredential;
let didUrl: string;

test(' Issue an Accreditation with revocation statuslist', async ({ request }) => {
const payload = JSON.parse(
fs.readFileSync(`${PAYLOADS_PATH.ACCREDITATION}/authorize-jwt-revocation.json`, 'utf-8')
);
const response = await request.post(`/trust-registry/accreditation/issue?accreditationType=authorize`, {
const issueResponse = await request.post(`/trust-registry/accreditation/issue?accreditationType=authorize`, {
data: JSON.stringify(payload),
headers: {
'Content-Type': CONTENT_TYPE.APPLICATION_JSON,
},
});
jwtCredential = await response.json();
expect(response).toBeOK();
expect(response.status()).toBe(StatusCodes.OK);
expect(jwtCredential.proof.type).toBe('JwtProof2020');
expect(jwtCredential.proof).toHaveProperty('jwt');
expect(typeof jwtCredential.issuer === 'string' ? jwtCredential.issuer : jwtCredential.issuer.id).toBe(
const { didUrls, accreditation } = await issueResponse.json();
didUrl = didUrls[0];
expect(issueResponse).toBeOK();
expect(issueResponse.status()).toBe(StatusCodes.OK);
expect(accreditation.proof.type).toBe('JwtProof2020');
expect(accreditation.proof).toHaveProperty('jwt');
expect(typeof accreditation.issuer === 'string' ? accreditation.issuer : accreditation.issuer.id).toBe(
payload.issuerDid
);
expect(jwtCredential.type).toContain('VerifiableCredential');
expect(jwtCredential.credentialSubject.id).toBe(payload.subjectDid);
expect(jwtCredential.credentialStatus).toMatchObject({
expect(accreditation.type).toContain('VerifiableCredential');
expect(accreditation.credentialSubject.id).toBe(payload.subjectDid);
expect(accreditation.credentialStatus).toMatchObject({

Check failure on line 32 in tests/e2e/sequential/accreditation/revocation-flow.spec.ts

View workflow job for this annotation

GitHub Actions / Build & Test / Build Node.js

[Logged In User Tests] › sequential/accreditation/revocation-flow.spec.ts:11:1 › Issue an Accreditation with revocation statuslist

1) [Logged In User Tests] › sequential/accreditation/revocation-flow.spec.ts:11:1 › Issue an Accreditation with revocation statuslist Error: expect(received).toMatchObject(expected) Matcher error: received value must be a non-null object Received has value: undefined 30 | expect(accreditation.type).toContain('VerifiableCredential'); 31 | expect(accreditation.credentialSubject.id).toBe(payload.subjectDid); > 32 | expect(accreditation.credentialStatus).toMatchObject({ | ^ 33 | type: 'StatusList2021Entry', 34 | statusPurpose: 'revocation', 35 | }); at /home/runner/work/studio/studio/tests/e2e/sequential/accreditation/revocation-flow.spec.ts:32:41

Check failure on line 32 in tests/e2e/sequential/accreditation/revocation-flow.spec.ts

View workflow job for this annotation

GitHub Actions / Build & Test / Build Node.js

[Logged In User Tests] › sequential/accreditation/revocation-flow.spec.ts:11:1 › Issue an Accreditation with revocation statuslist

1) [Logged In User Tests] › sequential/accreditation/revocation-flow.spec.ts:11:1 › Issue an Accreditation with revocation statuslist Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: expect(received).toMatchObject(expected) Matcher error: received value must be a non-null object Received has value: undefined 30 | expect(accreditation.type).toContain('VerifiableCredential'); 31 | expect(accreditation.credentialSubject.id).toBe(payload.subjectDid); > 32 | expect(accreditation.credentialStatus).toMatchObject({ | ^ 33 | type: 'StatusList2021Entry', 34 | statusPurpose: 'revocation', 35 | }); at /home/runner/work/studio/studio/tests/e2e/sequential/accreditation/revocation-flow.spec.ts:32:41

Check failure on line 32 in tests/e2e/sequential/accreditation/revocation-flow.spec.ts

View workflow job for this annotation

GitHub Actions / Build & Test / Build Node.js

[Logged In User Tests] › sequential/accreditation/revocation-flow.spec.ts:11:1 › Issue an Accreditation with revocation statuslist

1) [Logged In User Tests] › sequential/accreditation/revocation-flow.spec.ts:11:1 › Issue an Accreditation with revocation statuslist Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: expect(received).toMatchObject(expected) Matcher error: received value must be a non-null object Received has value: undefined 30 | expect(accreditation.type).toContain('VerifiableCredential'); 31 | expect(accreditation.credentialSubject.id).toBe(payload.subjectDid); > 32 | expect(accreditation.credentialStatus).toMatchObject({ | ^ 33 | type: 'StatusList2021Entry', 34 | statusPurpose: 'revocation', 35 | }); at /home/runner/work/studio/studio/tests/e2e/sequential/accreditation/revocation-flow.spec.ts:32:41
type: 'StatusList2021Entry',
statusPurpose: 'revocation',
});
expect(jwtCredential.credentialStatus).toHaveProperty('statusListIndex');
expect(jwtCredential.credentialStatus).toHaveProperty('id');
expect(accreditation.credentialStatus).toHaveProperty('statusListIndex');
expect(accreditation.credentialStatus).toHaveProperty('id');
});

test(" Verify a Accreditation's revocation status", async ({ request }) => {
const response = await request.post(`/trust-registry/accreditation/verify?verifyStatus=true`, {
data: JSON.stringify({
credential: jwtCredential,
didUrl,
}),
headers: {
'Content-Type': CONTENT_TYPE.APPLICATION_JSON,
Expand All @@ -55,7 +56,7 @@ test(" Verify a Accreditation's revocation status", async ({ request }) => {
test(' Verify a Accreditation status after revocation', async ({ request }) => {
const response = await request.post(`/trust-registry/accreditation/revoke?publish=true`, {
data: JSON.stringify({
credential: jwtCredential,
didUrl,
}),
headers: {
'Content-Type': CONTENT_TYPE.APPLICATION_JSON,
Expand All @@ -69,7 +70,7 @@ test(' Verify a Accreditation status after revocation', async ({ request }) => {

const verificationResponse = await request.post(`/trust-registry/accreditation/verify?verifyStatus=true`, {
data: JSON.stringify({
credential: jwtCredential,
didUrl,
}),
headers: {
'Content-Type': CONTENT_TYPE.APPLICATION_JSON,
Expand Down

0 comments on commit b4002fd

Please sign in to comment.