mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 20:38:52 +00:00
## Features - https://github.com/toeverything/BlockSuite/pull/7340 @pengx17 - https://github.com/toeverything/BlockSuite/pull/7334 @EYHN - https://github.com/toeverything/BlockSuite/pull/7339 @donteatfriedrice - https://github.com/toeverything/BlockSuite/pull/7328 @zzj3720 - https://github.com/toeverything/BlockSuite/pull/7324 @Flrande - https://github.com/toeverything/BlockSuite/pull/7297 @pengx17 - https://github.com/toeverything/BlockSuite/pull/7318 @CatsJuice ## Bugfix - https://github.com/toeverything/BlockSuite/pull/7343 @Saul-Mirone - https://github.com/toeverything/BlockSuite/pull/7345 @donteatfriedrice - https://github.com/toeverything/BlockSuite/pull/7341 @donteatfriedrice - https://github.com/toeverything/BlockSuite/pull/7342 @zzj3720 - https://github.com/toeverything/BlockSuite/pull/7329 @CatsJuice - https://github.com/toeverything/BlockSuite/pull/7337 @fundon - https://github.com/toeverything/BlockSuite/pull/7333 @fundon - https://github.com/toeverything/BlockSuite/pull/7326 @akumatus - https://github.com/toeverything/BlockSuite/pull/7325 @Flrande - https://github.com/toeverything/BlockSuite/pull/7323 @zzj3720 - https://github.com/toeverything/BlockSuite/pull/7312 @golok727 - https://github.com/toeverything/BlockSuite/pull/7317 @CatsJuice - https://github.com/toeverything/BlockSuite/pull/7319 @akumatus ## Refactor - https://github.com/toeverything/BlockSuite/pull/7327 @Flrande - https://github.com/toeverything/BlockSuite/pull/7320 @Flrande ## Misc - https://github.com/toeverything/BlockSuite/pull/7303 @fundon - https://github.com/toeverything/BlockSuite/pull/7321 @Saul-Mirone
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
import { WorkspaceFlavour } from '@affine/env/workspace';
|
|
import type { Doc as BlockSuiteDoc } from '@blocksuite/store';
|
|
import {
|
|
configureTestingInfraModules,
|
|
DocsService,
|
|
Framework,
|
|
WorkspacesService,
|
|
} from '@toeverything/infra';
|
|
|
|
import { configureCommonModules } from './modules';
|
|
|
|
export async function configureTestingEnvironment() {
|
|
const framework = new Framework();
|
|
|
|
configureCommonModules(framework);
|
|
configureTestingInfraModules(framework);
|
|
|
|
const frameworkProvider = framework.provider();
|
|
|
|
const workspaceManager = frameworkProvider.get(WorkspacesService);
|
|
|
|
const { workspace } = workspaceManager.open({
|
|
metadata: await workspaceManager.create(
|
|
WorkspaceFlavour.LOCAL,
|
|
async ws => {
|
|
ws.meta.initialize();
|
|
const initDoc = async (page: BlockSuiteDoc) => {
|
|
page.load();
|
|
const pageBlockId = page.addBlock('affine:page', {
|
|
title: new page.Text(''),
|
|
});
|
|
const frameId = page.addBlock('affine:note', {}, pageBlockId);
|
|
page.addBlock('affine:paragraph', {}, frameId);
|
|
};
|
|
await initDoc(ws.createDoc({ id: 'page0' }));
|
|
}
|
|
),
|
|
});
|
|
|
|
await workspace.engine.waitForDocSynced();
|
|
|
|
const { doc } = workspace.scope.get(DocsService).open('page0');
|
|
|
|
return { framework: frameworkProvider, workspace, doc };
|
|
}
|