mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
27 lines
722 B
TypeScript
27 lines
722 B
TypeScript
import assert from 'assert';
|
|
import { test, expect } from '@playwright/test';
|
|
|
|
import { getDataCenter, waitOnce } from '../utils.js';
|
|
|
|
import 'fake-indexeddb/auto';
|
|
|
|
test.describe('Search', () => {
|
|
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']])
|
|
);
|
|
});
|
|
});
|