test(server): utils (#10028)

This commit is contained in:
forehalo
2025-02-10 06:35:11 +00:00
parent 8f6b512cfd
commit c3f5b4abb4
40 changed files with 1577 additions and 2222 deletions
@@ -55,8 +55,9 @@ const test = ava as TestFn<{
json: CopilotCheckJsonExecutor;
};
}>;
let userId: string;
test.beforeEach(async t => {
test.before(async t => {
const module = await createTestingModule({
imports: [
ConfigModule.forRoot({
@@ -99,17 +100,19 @@ test.beforeEach(async t => {
};
});
test.afterEach.always(async t => {
await t.context.module.close();
});
let userId: string;
test.beforeEach(async t => {
const { auth } = t.context;
Sinon.restore();
const { module, auth, prompt } = t.context;
await module.initTestingDB();
await prompt.onModuleInit();
const user = await auth.signUp('test@affine.pro', '123456');
userId = user.id;
});
test.after.always(async t => {
await t.context.module.close();
});
// ==================== prompt ====================
test('should be able to manage prompt', async t => {