Skip to content

Commit

Permalink
log fetch attempts and run gitlab ci for this branch
Browse files Browse the repository at this point in the history
  • Loading branch information
finn-tbd committed Jul 26, 2023
1 parent 8e9eb6d commit 71db750
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tests-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- vc-ssi-integration-tests
pull_request:
branches:
- main
Expand Down
32 changes: 18 additions & 14 deletions packages/web5/tests/web5-vc-ssi.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let SSIBaseURL = process.env.SSI_BASE_URL || 'https://ssi.tbddev.org';

let did: string;
let vcApi: VcApi;
let testAgent;
let testAgent: TestAgent;
let testProfileOptions: TestProfileOptions;

describe('web5.vc.ssi', () => {
Expand All @@ -34,32 +34,36 @@ describe('web5.vc.ssi', () => {
await testAgent.closeStorage();
});

describe('verifiable credentials send to ssi', () => {
describe('create', () => {
it('SSI-verifiable VC', async () => {
describe('validated against ssi', () => {
describe('create and validate', () => {
it('a verifiable credential', async () => {

console.log('creating vc');
const credentialSubject = {firstName: 'alice'};
const result = await vcApi.create(credentialSubject);
expect(result.status.code).to.equal(202);
expect(result.status.detail).to.equal('Accepted');
expect(result.record).to.exist;

let ssiResponse = await fetch(SSIBaseURL + '/v1/credentials/verification',
{
method: 'PUT',
console.log('created vc, verifiying it against SSI');

body: JSON.stringify({
'credentialJwt': await result.record?.data.text(),
}),
}
);
let ssiResponse = await loggableFetch(SSIBaseURL + '/v1/credentials/verification', {
method : 'PUT',
body : JSON.stringify({'credentialJwt': await result.record?.data.text()}),
});

let ssiVerified = await ssiResponse.json();

console.log(ssiVerified);

expect(ssiVerified.verified).to.be.true;
});

});
});
});
});

function loggableFetch(url: string, init?: RequestInit | undefined): Promise<Response> {
let method = init?.method || 'GET';
console.log(method, ' ', url);
return fetch(url, init);
}

0 comments on commit 71db750

Please sign in to comment.