File tree Expand file tree Collapse file tree 1 file changed +19
-8
lines changed
Expand file tree Collapse file tree 1 file changed +19
-8
lines changed Original file line number Diff line number Diff line change 11import { inject } from 'vitest' ;
2+
3+ import type { Agent } from '~/agent' ;
24import { createAgent } from '~/tsky' ;
35
4- /**
5- * Get Agent instance for testing accounts.
6- * There are `@alice.test` and `@bob.test` now.
7- * @param handle - handle name for test agent (without `@`)
8- */
9- export async function getTestAgent ( handle : 'alice.test' | 'bob.test' ) {
10- const agent = await createAgent (
6+ type Handle = 'alice.test' | 'bob.test' ;
7+
8+ const testAgents : Record < Handle , Agent > = {
9+ 'alice.test' : await createTestAgent ( 'alice.test' ) ,
10+ 'bob.test' : await createTestAgent ( 'bob.test' ) ,
11+ } ;
12+
13+ function createTestAgent ( handle : Handle ) {
14+ return createAgent (
1115 {
1216 identifier : handle ,
1317 password : 'password' ,
1418 } ,
1519 { service : inject ( 'testPdsUrl' ) } ,
1620 ) ;
21+ }
1722
18- return agent ;
23+ /**
24+ * Get Agent instance for testing accounts.
25+ * There are `@alice.test` and `@bob.test` now.
26+ * @param handle - handle name for test agent (without `@`)
27+ */
28+ export async function getTestAgent ( handle : Handle ) {
29+ return testAgents [ handle ] ;
1930}
You can’t perform that action at this time.
0 commit comments