-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(askar): in memory wallet creation (#1498)
Signed-off-by: Ariel Gentile <gentilester@gmail.com>
- Loading branch information
Showing
4 changed files
with
118 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* eslint-disable @typescript-eslint/no-non-null-assertion */ | ||
import type { SubjectMessage } from '../../../tests/transport/SubjectInboundTransport' | ||
|
||
import { Agent } from '@aries-framework/core' | ||
import { Subject } from 'rxjs' | ||
|
||
import { describeRunInNodeVersion } from '../../../tests/runInVersion' | ||
import { SubjectInboundTransport } from '../../../tests/transport/SubjectInboundTransport' | ||
import { SubjectOutboundTransport } from '../../../tests/transport/SubjectOutboundTransport' | ||
|
||
import { e2eTest, getSqliteAgentOptions } from './helpers' | ||
|
||
const aliceInMemoryAgentOptions = getSqliteAgentOptions( | ||
'AgentsAlice', | ||
{ | ||
endpoints: ['rxjs:alice'], | ||
}, | ||
true | ||
) | ||
const bobInMemoryAgentOptions = getSqliteAgentOptions( | ||
'AgentsBob', | ||
{ | ||
endpoints: ['rxjs:bob'], | ||
}, | ||
true | ||
) | ||
|
||
// FIXME: Re-include in tests when Askar NodeJS wrapper performance is improved | ||
describeRunInNodeVersion([18], 'Askar In Memory agents', () => { | ||
let aliceAgent: Agent | ||
let bobAgent: Agent | ||
|
||
afterAll(async () => { | ||
if (bobAgent) { | ||
await bobAgent.shutdown() | ||
await bobAgent.wallet.delete() | ||
} | ||
|
||
if (aliceAgent) { | ||
await aliceAgent.shutdown() | ||
await aliceAgent.wallet.delete() | ||
} | ||
}) | ||
|
||
test('In memory Askar wallets E2E test', async () => { | ||
const aliceMessages = new Subject<SubjectMessage>() | ||
const bobMessages = new Subject<SubjectMessage>() | ||
|
||
const subjectMap = { | ||
'rxjs:alice': aliceMessages, | ||
'rxjs:bob': bobMessages, | ||
} | ||
|
||
aliceAgent = new Agent(aliceInMemoryAgentOptions) | ||
aliceAgent.registerInboundTransport(new SubjectInboundTransport(aliceMessages)) | ||
aliceAgent.registerOutboundTransport(new SubjectOutboundTransport(subjectMap)) | ||
await aliceAgent.initialize() | ||
|
||
bobAgent = new Agent(bobInMemoryAgentOptions) | ||
bobAgent.registerInboundTransport(new SubjectInboundTransport(bobMessages)) | ||
bobAgent.registerOutboundTransport(new SubjectOutboundTransport(subjectMap)) | ||
await bobAgent.initialize() | ||
|
||
await e2eTest(aliceAgent, bobAgent) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters