Skip to content

Commit

Permalink
Fix wrapper tests
Browse files Browse the repository at this point in the history
Signed-off-by: Miroslav Kovar <[email protected]>
  • Loading branch information
mirgee committed Jul 12, 2021
1 parent 4ef95e2 commit 8cadbe3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
8 changes: 4 additions & 4 deletions wrappers/node/test/suite1/ariesvcx-connection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@ describe('Connection:', () => {
});

describe('updateState:', () => {
it(`throws error when not initialized`, async () => {
let caught_error
it('throws error when not initialized', async () => {
let caught_error;
const connection = new (Connection as any)();
try {
await connection.updateState();
} catch (err) {
caught_error = err
caught_error = err;
}
assert.isNotNull(caught_error)
assert.isNotNull(caught_error);
});

it(`returns ${ConnectionStateType.Null}: not connected`, async () => {
Expand Down
13 changes: 8 additions & 5 deletions wrappers/node/test/suite1/ariesvcx-disclosed-proof.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,16 @@ describe('DisclosedProof', () => {
});

describe('updateState:', () => {
it(`returns ${ProverStateType.Initial}: not initialized`, async () => {
it('Throws error when not initialized', async () => {
let caught_error;
const disclosedProof = new (DisclosedProof as any)();
const connection = await createConnectionInviterRequested();
const state1 = await disclosedProof.updateStateV2(connection);
const state2 = await disclosedProof.getState();
assert.equal(state1, state2);
assert.equal(state2, ProverStateType.Initial);
try {
await disclosedProof.updateStateV2(connection);
} catch (err) {
caught_error = err;
}
assert.isNotNull(caught_error);
});

it(`returns ${ProverStateType.Initial}: created`, async () => {
Expand Down
13 changes: 8 additions & 5 deletions wrappers/node/test/suite1/ariesvcx-proof.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,16 @@ describe('Proof:', () => {
});

describe('updateState:', () => {
it(`returns ${VerifierStateType.Initial}: created`, async () => {
it(`throws error when not initialized`, async () => {
let caught_error;
const proof = new Proof(null as any, {} as any);
const connection = await createConnectionInviterRequested();
const state1 = await proof.updateStateV2(connection);
const state2 = await proof.getState();
assert.equal(state1, state2);
assert.equal(state2, VerifierStateType.Initial);
try {
await proof.updateStateV2(connection);
} catch (err) {
caught_error = err;
}
assert.isNotNull(caught_error);
});
});

Expand Down

0 comments on commit 8cadbe3

Please sign in to comment.