Skip to content

Commit 1d698fb

Browse files
committed
test: add helper method getTestAgent() for @alice.test and @bob.test
1 parent 2364613 commit 1d698fb

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

packages/client/src/test-utils.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { inject } from 'vitest';
2+
import { createAgent } from '~/tsky';
3+
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(
11+
{
12+
identifier: handle,
13+
password: 'password',
14+
},
15+
{ service: inject('testPdsUrl') },
16+
);
17+
18+
return agent;
19+
}

packages/client/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"verbatimModuleSyntax": true,
3232
"skipLibCheck": true
3333
},
34-
"include": ["./src/**/*", "globalSetup.ts"],
34+
"include": ["./src/**/*", "globalSetup.ts", "test-utils.ts"],
3535
"typedocOptions": {
3636
"out": "./docs",
3737
"theme": "default",

0 commit comments

Comments
 (0)