chore(server): data mocking and seeding (#10864)

This commit is contained in:
liuyi
2025-03-17 14:15:34 +08:00
committed by GitHub
parent 81af7a0571
commit 0f83566504
24 changed files with 449 additions and 82 deletions
@@ -41,7 +41,7 @@ test('change email', async t => {
const u1Email = 'u1@affine.pro';
const u2Email = 'u2@affine.pro';
await app.signup(u1Email);
await app.signupV1(u1Email);
const primitiveMailCount = await getCurrentMailMessageCount();
await sendChangeEmail(app, u1Email, 'affine.pro');
@@ -101,7 +101,7 @@ test('set and change password', async t => {
if (mail.hasConfigured()) {
const u1Email = 'u1@affine.pro';
const u1 = await app.signup(u1Email);
const u1 = await app.signupV1(u1Email);
const primitiveMailCount = await getCurrentMailMessageCount();
@@ -153,7 +153,7 @@ test('should revoke token after change user identify', async t => {
const u1Email = 'u1@affine.pro';
const u2Email = 'u2@affine.pro';
const u1 = await app.signup(u1Email);
const u1 = await app.signupV1(u1Email);
{
const user = await currentUser(app);
@@ -190,7 +190,7 @@ test('should revoke token after change user identify', async t => {
const u3Email = 'u3333@affine.pro';
await app.logout();
const u3 = await app.signup(u3Email);
const u3 = await app.signupV1(u3Email);
{
const user = await currentUser(app);
@@ -164,7 +164,7 @@ test('should be able to sign out', async t => {
test('should be able to correct user id cookie', async t => {
const { app } = t.context;
const u1 = await app.signup('u1@affine.pro');
const u1 = await app.signupV1('u1@affine.pro');
const req = app.GET('/api/auth/session');
let cookies = req.get('cookie') as unknown as string[];
@@ -229,8 +229,8 @@ test('should be able to sign in another account in one session', async t => {
test('should be able to sign out multiple accounts in one session', async t => {
const { app } = t.context;
const u1 = await app.signup('u1@affine.pro');
const u2 = await app.signup('u2@affine.pro');
const u1 = await app.signupV1('u1@affine.pro');
const u2 = await app.signupV1('u2@affine.pro');
// sign out u2
await app.GET(`/api/auth/sign-out?user_id=${u2.id}`).expect(200);