Skip to content

Commit

Permalink
test: fix mediation test
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Glastra <[email protected]>
  • Loading branch information
TimoGlastra committed Aug 21, 2021
1 parent 18a2ed4 commit 5ea2270
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions packages/core/src/modules/routing/__tests__/mediation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ describe('mediator establishment', () => {

// Initialize mediator
mediatorAgent = new Agent(mediatorConfig.config, recipientConfig.agentDependencies)
mediatorAgent.registerOutboundTransporter(new SubjectOutboundTransporter(mediatorMessages, subjectMap))
mediatorAgent.setInboundTransporter(new SubjectInboundTransporter(mediatorMessages))
mediatorAgent.registerOutboundTransport(new SubjectOutboundTransport(mediatorMessages, subjectMap))
mediatorAgent.registerInboundTransport(new SubjectInboundTransport(mediatorMessages))
await mediatorAgent.initialize()

// Create connection to use for recipient
Expand All @@ -166,8 +166,8 @@ describe('mediator establishment', () => {
{ ...recipientConfig.config, mediatorConnectionsInvite: mediatorInvitation.toUrl() },
recipientConfig.agentDependencies
)
recipientAgent.registerOutboundTransporter(new SubjectOutboundTransporter(recipientMessages, subjectMap))
recipientAgent.setInboundTransporter(new SubjectInboundTransporter(recipientMessages))
recipientAgent.registerOutboundTransport(new SubjectOutboundTransport(recipientMessages, subjectMap))
recipientAgent.registerInboundTransport(new SubjectInboundTransport(recipientMessages))
await recipientAgent.initialize()

const recipientMediator = await recipientAgent.mediationRecipient.findDefaultMediator()
Expand All @@ -192,14 +192,14 @@ describe('mediator establishment', () => {
{ ...recipientConfig.config, mediatorConnectionsInvite: mediatorInvitation.toUrl() },
recipientConfig.agentDependencies
)
recipientAgent.registerOutboundTransporter(new SubjectOutboundTransporter(recipientMessages, subjectMap))
recipientAgent.setInboundTransporter(new SubjectInboundTransporter(recipientMessages))
recipientAgent.registerOutboundTransport(new SubjectOutboundTransport(recipientMessages, subjectMap))
recipientAgent.registerInboundTransport(new SubjectInboundTransport(recipientMessages))
await recipientAgent.initialize()

// Initialize sender agent
senderAgent = new Agent(senderConfig.config, senderConfig.agentDependencies)
senderAgent.registerOutboundTransporter(new SubjectOutboundTransporter(senderMessages, subjectMap))
senderAgent.setInboundTransporter(new SubjectInboundTransporter(senderMessages))
senderAgent.registerOutboundTransport(new SubjectOutboundTransport(senderMessages, subjectMap))
senderAgent.registerInboundTransport(new SubjectInboundTransport(senderMessages))
await senderAgent.initialize()

const {
Expand All @@ -209,7 +209,8 @@ describe('mediator establishment', () => {
autoAcceptConnection: true,
})

expect(recipientInvitation.serviceEndpoint).toBe(mediatorConfig.config.endpoint)
const endpoints = mediatorConfig.config.endpoints ?? []
expect(recipientInvitation.serviceEndpoint).toBe(endpoints[0])

let senderRecipientConnection = await senderAgent.connections.receiveInvitationFromUrl(
recipientInvitation.toUrl(),
Expand Down

0 comments on commit 5ea2270

Please sign in to comment.