mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-18 02:21:51 +08:00
Merge branch 'origin/feat/cloud-sync' into 'feat/cloud-sync'
This commit is contained in:
@@ -5,9 +5,9 @@ import { getDataCenter } from './utils.js';
|
||||
import 'fake-indexeddb/auto';
|
||||
|
||||
test.describe('Auth', () => {
|
||||
test('signin', async () => {});
|
||||
test('sign in', async () => {});
|
||||
|
||||
test('signout', async () => {});
|
||||
test('sign out', async () => {});
|
||||
|
||||
test('isLogin', async () => {});
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { getDataCenter } from './utils.js';
|
||||
import 'fake-indexeddb/auto';
|
||||
|
||||
test.describe('Cloud Sync', () => {
|
||||
test('get cloud the sync flag of workspace ', async () => {});
|
||||
test('get cloud the sync flag of workspace', async () => {});
|
||||
|
||||
test('enable [cloud sync feature]', async () => {});
|
||||
|
||||
@@ -13,7 +13,7 @@ test.describe('Cloud Sync', () => {
|
||||
|
||||
test('editor cloud storage', async () => {});
|
||||
|
||||
test('cloud sync is in-progresss', async () => {});
|
||||
test('cloud sync is in-progress', async () => {});
|
||||
|
||||
test('cloud sync is completed', async () => {});
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ test.describe('Collaborate', () => {
|
||||
|
||||
test('collaborate workspace name', async () => {});
|
||||
|
||||
test('collaborate workspace avator', async () => {});
|
||||
test('collaborate workspace avatar', async () => {});
|
||||
|
||||
test('collaborate workspace list', async () => {});
|
||||
});
|
||||
|
||||
@@ -11,7 +11,7 @@ test.describe('Permission', () => {
|
||||
|
||||
test('make workspace private', async () => {});
|
||||
|
||||
test('unlogin user open the public workspace ', async () => {});
|
||||
test('un-login user open the public workspace ', async () => {});
|
||||
|
||||
test('unlogin user open the private workspace ', async () => {});
|
||||
test('un-login user open the private workspace ', async () => {});
|
||||
});
|
||||
|
||||
@@ -1,9 +1,26 @@
|
||||
import assert from 'assert';
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
import { getDataCenter } from './utils.js';
|
||||
import { getDataCenter, waitOnce } from './utils.js';
|
||||
|
||||
import 'fake-indexeddb/auto';
|
||||
|
||||
test.describe('Search', () => {
|
||||
test('search result', async () => {});
|
||||
test('search result', async () => {
|
||||
const dc = await getDataCenter();
|
||||
const workspace = await dc.load('test');
|
||||
|
||||
assert(workspace);
|
||||
workspace.createPage('test');
|
||||
await waitOnce(workspace.signals.pageAdded);
|
||||
const page = workspace.getPage('test');
|
||||
assert(page);
|
||||
|
||||
const text = new page.Text(page, 'hello world');
|
||||
const blockId = page.addBlock({ flavour: 'affine:paragraph', text });
|
||||
|
||||
expect(workspace.search('hello')).toStrictEqual(
|
||||
new Map([[blockId, 'test']])
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
export const getDataCenter = () => {
|
||||
return import('../src/index.js').then(async dataCenter =>
|
||||
dataCenter.getDataCenter(false)
|
||||
);
|
||||
import { Signal } from '@blocksuite/store';
|
||||
|
||||
export const getDataCenter = async () => {
|
||||
const dataCenter = await import('../src/index.js');
|
||||
return await dataCenter.getDataCenter(false);
|
||||
};
|
||||
|
||||
export const waitOnce = <T>(signal: Signal<T>) =>
|
||||
new Promise<T>(resolve => signal.once(val => resolve(val)));
|
||||
|
||||
@@ -4,8 +4,18 @@ import { getDataCenter } from './utils.js';
|
||||
|
||||
import 'fake-indexeddb/auto';
|
||||
|
||||
test.describe('Workspace', () => {
|
||||
test('list workspaces', async () => {
|
||||
test.describe('workspace', () => {
|
||||
test('create', async () => {});
|
||||
|
||||
test('load', async () => {});
|
||||
|
||||
test('get workspace name', async () => {});
|
||||
test('set workspace name', async () => {});
|
||||
|
||||
test('get workspace avatar', async () => {});
|
||||
test('set workspace avatar', async () => {});
|
||||
|
||||
test('list', async () => {
|
||||
const dataCenter = await getDataCenter();
|
||||
await dataCenter.clear();
|
||||
|
||||
@@ -16,14 +26,23 @@ test.describe('Workspace', () => {
|
||||
dataCenter.load('test6'),
|
||||
]);
|
||||
|
||||
expect(await dataCenter.list()).toStrictEqual([
|
||||
'test3',
|
||||
'test4',
|
||||
'test5',
|
||||
'test6',
|
||||
]);
|
||||
expect(await dataCenter.list()).toStrictEqual({
|
||||
test3: { local: true },
|
||||
test4: { local: true },
|
||||
test5: { local: true },
|
||||
test6: { local: true },
|
||||
});
|
||||
|
||||
await dataCenter.reload('test3', { providerId: 'affine' });
|
||||
expect(await dataCenter.list()).toStrictEqual({
|
||||
test3: { affine: true, local: true },
|
||||
test4: { local: true },
|
||||
test5: { local: true },
|
||||
test6: { local: true },
|
||||
});
|
||||
});
|
||||
test('destroy workspaces', async () => {
|
||||
|
||||
test('destroy', async () => {
|
||||
const dataCenter = await getDataCenter();
|
||||
await dataCenter.clear();
|
||||
|
||||
@@ -39,23 +58,13 @@ test.describe('Workspace', () => {
|
||||
expect(ws3 !== ws4).toBeTruthy();
|
||||
});
|
||||
|
||||
test('remove workspaces', async () => {
|
||||
test('remove', 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']);
|
||||
expect(await dataCenter.list()).toStrictEqual({ test10: { local: true } });
|
||||
});
|
||||
|
||||
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 () => {});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user