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

View File

@@ -40,7 +40,7 @@ test.after.always(async () => {
});
test('should set blobs', async t => {
await app.signup('u1@affine.pro');
await app.signupV1('u1@affine.pro');
const workspace = await createWorkspace(app);
@@ -63,7 +63,7 @@ test('should set blobs', async t => {
});
test('should list blobs', async t => {
await app.signup('u1@affine.pro');
await app.signupV1('u1@affine.pro');
const workspace = await createWorkspace(app);
const blobs = await listBlobs(app, workspace.id);
@@ -81,7 +81,7 @@ test('should list blobs', async t => {
});
test('should auto delete blobs when workspace is deleted', async t => {
await app.signup('u1@affine.pro');
await app.signupV1('u1@affine.pro');
const workspace = await createWorkspace(app);
const buffer1 = Buffer.from([0, 0]);
@@ -100,7 +100,7 @@ test('should auto delete blobs when workspace is deleted', async t => {
});
test('should calc blobs size', async t => {
await app.signup('u1@affine.pro');
await app.signupV1('u1@affine.pro');
const workspace = await createWorkspace(app);
@@ -114,7 +114,7 @@ test('should calc blobs size', async t => {
});
test('should calc all blobs size', async t => {
await app.signup('u1@affine.pro');
await app.signupV1('u1@affine.pro');
const workspace1 = await createWorkspace(app);
@@ -135,7 +135,7 @@ test('should calc all blobs size', async t => {
});
test('should reject blob exceeded limit', async t => {
await app.signup('u1@affine.pro');
await app.signupV1('u1@affine.pro');
const workspace1 = await createWorkspace(app);
await model.add(workspace1.id, 'team_plan_v1', 'test', RESTRICTED_QUOTA);
@@ -147,7 +147,7 @@ test('should reject blob exceeded limit', async t => {
});
test('should reject blob exceeded quota', async t => {
await app.signup('u1@affine.pro');
await app.signupV1('u1@affine.pro');
const workspace = await createWorkspace(app);
await model.add(workspace.id, 'team_plan_v1', 'test', RESTRICTED_QUOTA);
@@ -159,7 +159,7 @@ test('should reject blob exceeded quota', async t => {
});
test('should accept blob even storage out of quota if workspace has unlimited feature', async t => {
await app.signup('u1@affine.pro');
await app.signupV1('u1@affine.pro');
const workspace = await createWorkspace(app);
await model.add(workspace.id, 'team_plan_v1', 'test', RESTRICTED_QUOTA);

View File

@@ -31,7 +31,7 @@ test.before(async t => {
const db = app.get(PrismaClient);
t.context.u1 = await app.signup('u1@affine.pro');
t.context.u1 = await app.signupV1('u1@affine.pro');
t.context.db = db;
t.context.app = app;
t.context.storage = app.get(WorkspaceBlobStorage);