tests: rename

This commit is contained in:
tzhangchi
2023-01-03 22:20:01 +08:00
parent 069d2f7c28
commit 038dc7f923
10 changed files with 2 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
import { test, expect } from '@playwright/test';
import { getDataCenter } from './utils.js';
import 'fake-indexeddb/auto';
test.describe('attachment', () => {
test('upload blob', async () => {});
test('get blob', async () => {});
test('remove blob', async () => {});
});

View File

@@ -0,0 +1,15 @@
import { test, expect } from '@playwright/test';
import { getDataCenter } from './utils.js';
import 'fake-indexeddb/auto';
test.describe('auth', () => {
test('signin', async () => {});
test('signout', async () => {});
test('isLogin', async () => {});
test('getUserInfo', async () => {});
});

View File

@@ -0,0 +1,17 @@
import { test, expect } from '@playwright/test';
import { getDataCenter } from './utils.js';
import 'fake-indexeddb/auto';
test.describe('cloud-sync', () => {
test('get cloud sync flag of workspace ', async () => {});
test('enable cloud sync feature', async () => {});
test('close cloud sync feature', async () => {});
test('editor collaborate', async () => {});
test('editor cloud storage', async () => {});
});

View File

@@ -0,0 +1,11 @@
import { test, expect } from '@playwright/test';
import { getDataCenter } from './utils.js';
import 'fake-indexeddb/auto';
test.describe('import export', () => {
test('import workspace', async () => {});
test('export workspace', async () => {});
});

View File

@@ -0,0 +1,51 @@
import { test, expect } from '@playwright/test';
import { getDataCenter } from './utils.js';
import 'fake-indexeddb/auto';
test.describe('init data center', () => {
test('init', async () => {
const dataCenter = await getDataCenter();
expect(dataCenter).toBeTruthy();
await dataCenter.clear();
const workspace = await dataCenter.load('test1');
expect(workspace).toBeTruthy();
});
test('init singleton', async () => {
// data center is singleton
const [dc1, dc2] = await Promise.all([getDataCenter(), getDataCenter()]);
expect(dc1).toEqual(dc2);
// load same workspace will get same instance
const [ws1, ws2] = await Promise.all([
dc1.load('test1'),
dc2.load('test1'),
]);
expect(ws1).toEqual(ws2);
});
test('should init error with unknown provider', async () => {
const dc = await getDataCenter();
await dc.clear();
// load workspace with unknown provider will throw error
test.fail();
await dc.load('test2', { providerId: 'not exist provider' });
});
test.skip('init affine provider', async () => {
const dataCenter = await getDataCenter();
await dataCenter.clear();
// load workspace with affine provider
// TODO: set constant token for testing
const workspace = await dataCenter.load('6', {
providerId: 'affine',
config: { token: 'YOUR_TOKEN' },
});
expect(workspace).toBeTruthy();
});
});

View File

@@ -0,0 +1,9 @@
import { test, expect } from '@playwright/test';
import { getDataCenter } from './utils.js';
import 'fake-indexeddb/auto';
test.describe('search', () => {
test('search service', async () => {});
});

View File

@@ -0,0 +1,19 @@
import { test, expect } from '@playwright/test';
import { getDataCenter } from './utils.js';
import 'fake-indexeddb/auto';
test.describe('share', () => {
test('get the public of workspace', async () => {});
test('make workspace public', async () => {});
test('make workspace private', async () => {});
test('invite member by email', async () => {});
test('accept invite member link', async () => {});
test('members list', async () => {});
});

View File

@@ -0,0 +1,5 @@
export const getDataCenter = () => {
return import('../src/index.js').then(async dataCenter =>
dataCenter.getDataCenter(false)
);
};

View File

@@ -0,0 +1,61 @@
import { test, expect } from '@playwright/test';
import { getDataCenter } from './utils.js';
import 'fake-indexeddb/auto';
test.describe('workspace', () => {
test('list workspaces', async () => {
const dataCenter = await getDataCenter();
await dataCenter.clear();
await Promise.all([
dataCenter.load('test3'),
dataCenter.load('test4'),
dataCenter.load('test5'),
dataCenter.load('test6'),
]);
expect(await dataCenter.list()).toStrictEqual([
'test3',
'test4',
'test5',
'test6',
]);
});
test('destroy workspaces', async () => {
const dataCenter = await getDataCenter();
await dataCenter.clear();
// return new workspace if origin workspace is destroyed
const ws1 = await dataCenter.load('test7');
await dataCenter.destroy('test7');
const ws2 = await dataCenter.load('test7');
expect(ws1 !== ws2).toBeTruthy();
// return new workspace if workspace is reload
const ws3 = await dataCenter.load('test8');
const ws4 = await dataCenter.reload('test8', { providerId: 'affine' });
expect(ws3 !== ws4).toBeTruthy();
});
test('remove workspaces', async () => {
const dataCenter = await getDataCenter();
await dataCenter.clear();
// remove workspace will remove workspace data
await Promise.all([dataCenter.load('test9'), dataCenter.load('test10')]);
await dataCenter.delete('test9');
expect(await dataCenter.list()).toStrictEqual(['test10']);
});
test('create workspace', async () => {});
test('get the workspace', async () => {});
test('get workspace name', async () => {});
test('set workspace name', async () => {});
test('get workspace avatar', async () => {});
test('set workspace avatar', async () => {});
});