Skip to content

Commit

Permalink
refactor!: remove duplicate tests from v2-indy-oob-proof-proposal
Browse files Browse the repository at this point in the history
Signed-off-by: Pritam Singh <[email protected]>
  • Loading branch information
Zzocker committed Mar 15, 2023
1 parent b501b18 commit a822161
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 334 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,8 @@ export class V1ProofProtocol extends BaseProofProtocol implements ProofProtocol<
let proofRecord = await this.findByThreadAndConnectionId(agentContext, proofRequestMessage.threadId, connection?.id)

if (!proofRecord) {
// Proof request not bound to any connection: requests_attach in OOB msg
// Proof request bound to a proofRecord by threadId: proof proposal in OOB msg
// TODO integrate with oob module
proofRecord = await this.findByThreadAndConnectionId(messageContext.agentContext, proofRequestMessage.threadId)
if (proofRecord) proofRecord.connectionId = connection?.id
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { EventReplaySubject } from '../../../../../../core/tests'
import type { AnonCredsTestsAgent } from '../../../../../tests/legacyAnonCredsSetup'

import { ProofState } from '../../../../../../core/src'
import { testLogger, waitForProofExchangeRecord } from '../../../../../../core/tests'
import { waitForProofExchangeRecordSubject, testLogger, waitForProofExchangeRecord } from '../../../../../../core/tests'
import { issueLegacyAnonCredsCredential, setupAnonCredsTests } from '../../../../../tests/legacyAnonCredsSetup'
import { V1PresentationMessage, V1ProposePresentationMessage, V1RequestPresentationMessage } from '../messages'

Expand Down Expand Up @@ -166,7 +166,7 @@ describe('Present Proof', () => {
})
await faberAgent.oob.receiveInvitation(outOfBandInvitation)
testLogger.test('Faber waits for proof proposal message from Alice')
let faberProofExchangeRecord = await waitForProofExchangeRecord(faberAgent, {
let faberProofExchangeRecord = await waitForProofExchangeRecordSubject(faberReplay, {
state: ProofState.ProposalReceived,
})

Expand All @@ -178,7 +178,7 @@ describe('Present Proof', () => {

// ALice waits for presentation request from Faber
testLogger.test('Alice waits for presentation request from Faber')
let aliceProofExchangeRecord = await waitForProofExchangeRecord(aliceAgent, {
let aliceProofExchangeRecord = await waitForProofExchangeRecordSubject(aliceReplay, {
state: ProofState.RequestReceived,
})
expect(aliceProofExchangeRecord.connectionId).not.toBeNull()
Expand All @@ -195,7 +195,7 @@ describe('Present Proof', () => {

// Faber waits for the presentation from Alice
testLogger.test('Faber waits for presentation from Alice')
faberProofExchangeRecord = await waitForProofExchangeRecord(faberAgent, {
faberProofExchangeRecord = await waitForProofExchangeRecordSubject(faberReplay, {
threadId: aliceProofExchangeRecord.threadId,
state: ProofState.PresentationReceived,
})
Expand All @@ -208,7 +208,7 @@ describe('Present Proof', () => {

// Alice waits utils she received a presentation acknowledgement
testLogger.test('Alice waits until she receives a presentation acknowledgement')
aliceProofExchangeRecord = await waitForProofExchangeRecord(aliceAgent, {
aliceProofExchangeRecord = await waitForProofExchangeRecordSubject(aliceReplay, {
threadId: aliceProofExchangeRecord.threadId,
state: ProofState.Done,
})
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/modules/proofs/ProofsApiOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export interface ProposeProofOptions<PPs extends ProofProtocol[] = ProofProtocol
}

/**
* Interface for ProofsApi.createProofProposal. Will create an out of band request.
* Interface for ProofsApi.createProofProposal. Will create an out of band proposal.
*/
export interface CreateProofProposalOptions<PPs extends ProofProtocol[] = ProofProtocol[]> extends BaseOptions {
protocolVersion: ProofsProtocolVersionType<PPs>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,8 @@ export class V2ProofProtocol<PFs extends ProofFormatService[] = ProofFormatServi
)

if (!proofRecord) {
// Proof request not bound to any connection: requests_attach in OOB msg
// Proof request bound to a proofRecord by threadId: proof proposal in OOB msg
// TODO integrate with oob module
proofRecord = await this.findByThreadAndConnectionId(messageContext.agentContext, requestMessage.threadId)
if (proofRecord) proofRecord.connectionId = connection?.id
}
Expand Down
Loading

0 comments on commit a822161

Please sign in to comment.