mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 05:14:54 +00:00
test: search api
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 () => {});
|
||||
|
||||
|
||||
@@ -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('share', () => {
|
||||
|
||||
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 service', async () => {});
|
||||
test('search service', 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,10 @@
|
||||
import { Signal } from '@blocksuite/store';
|
||||
|
||||
export const getDataCenter = () => {
|
||||
return import('../src/index.js').then(async dataCenter =>
|
||||
dataCenter.getDataCenter(false)
|
||||
);
|
||||
};
|
||||
|
||||
export const waitOnce = <T>(signal: Signal<T>) =>
|
||||
new Promise<T>(resolve => signal.once(val => resolve(val)));
|
||||
|
||||
Reference in New Issue
Block a user