Skip to content

Commit

Permalink
fix: updated tests to reflect non-bug implementation
Browse files Browse the repository at this point in the history
Signed-off-by: blu3beri <[email protected]>
  • Loading branch information
berendsliedrecht committed Nov 24, 2022
1 parent d0ce26c commit 3841a15
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions packages/core/tests/v2-proofs-auto-accept.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ describe('Auto accept present proof', () => {
await aliceAgent.wallet.delete()
})

test('Alice starts with proof proposal to Faber, both with autoacceptproof on `contentApproved`', async () => {
test('Alice starts with proof proposal to Faber, both with autoAcceptProof on `contentApproved`', async () => {
testLogger.test('Alice sends presentation proposal to Faber')

let faberProofExchangeRecordPromise = waitForProofExchangeRecord(faberAgent, {
Expand All @@ -162,11 +162,9 @@ describe('Auto accept present proof', () => {
},
})

testLogger.test('Faber waits for presentation proposal from Alice')

await faberProofExchangeRecordPromise

testLogger.test('Faber accepts presentation proposal from Alice')
const { id: proofRecordId } = await faberProofExchangeRecordPromise
await faberAgent.proofs.acceptProposal({ proofRecordId })

faberProofExchangeRecordPromise = waitForProofExchangeRecord(faberAgent, {
threadId: aliceProofExchangeRecord.threadId,
Expand All @@ -185,7 +183,7 @@ describe('Auto accept present proof', () => {
await aliceProofExchangeRecordPromise
})

test('Faber starts with proof requests to Alice, both with autoacceptproof on `contentApproved`', async () => {
test('Faber starts with proof requests to Alice, both with autoAcceptProof on `contentApproved`', async () => {
testLogger.test('Faber sends presentation request to Alice')
const attributes = {
name: new ProofAttributeInfo({
Expand All @@ -210,14 +208,6 @@ describe('Auto accept present proof', () => {
}),
}

const faberProofExchangeRecordPromise = waitForProofExchangeRecord(faberAgent, {
state: ProofState.Done,
})

const aliceProofExchangeRecordPromise = waitForProofExchangeRecord(aliceAgent, {
state: ProofState.Done,
})

await faberAgent.proofs.requestProof({
protocolVersion: 'v2',
connectionId: faberConnection.id,
Expand All @@ -232,11 +222,18 @@ describe('Auto accept present proof', () => {
},
})

testLogger.test('Faber waits for presentation from Alice')
await faberProofExchangeRecordPromise
testLogger.test('Alice waits for request from Faber')
const { id: proofRecordId } = await waitForProofExchangeRecord(aliceAgent, {
state: ProofState.RequestReceived,
})
const { proofFormats } = await aliceAgent.proofs.autoSelectCredentialsForProofRequest({ proofRecordId })
await aliceAgent.proofs.acceptRequest({ proofRecordId, proofFormats })

// Faber waits till it receives presentation ack
await waitForProofExchangeRecord(faberAgent, { state: ProofState.Done })

// Alice waits till it receives presentation ack
await aliceProofExchangeRecordPromise
await waitForProofExchangeRecord(aliceAgent, { state: ProofState.Done })
})
})
})

0 comments on commit 3841a15

Please sign in to comment.