mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-15 05:37:32 +00:00
chore(editor): move legacy doc collection to test workspace (#9507)
This commit is contained in:
@@ -18,7 +18,11 @@ import {
|
||||
} from '@blocksuite/affine-model';
|
||||
import { propertyModelPresets } from '@blocksuite/data-view/property-pure-presets';
|
||||
import type { BlockModel, Doc } from '@blocksuite/store';
|
||||
import { DocCollection, IdGeneratorType, Schema } from '@blocksuite/store';
|
||||
import { Schema } from '@blocksuite/store';
|
||||
import {
|
||||
createAutoIncrementIdGenerator,
|
||||
TestWorkspace,
|
||||
} from '@blocksuite/store/test';
|
||||
import { beforeEach, describe, expect, test } from 'vitest';
|
||||
|
||||
const AffineSchemas = [
|
||||
@@ -29,7 +33,7 @@ const AffineSchemas = [
|
||||
];
|
||||
|
||||
function createTestOptions() {
|
||||
const idGenerator = IdGeneratorType.AutoIncrement;
|
||||
const idGenerator = createAutoIncrementIdGenerator();
|
||||
const schema = new Schema();
|
||||
schema.register(AffineSchemas);
|
||||
return { id: 'test-collection', idGenerator, schema };
|
||||
@@ -37,7 +41,7 @@ function createTestOptions() {
|
||||
|
||||
function createTestDoc(docId = 'doc0') {
|
||||
const options = createTestOptions();
|
||||
const collection = new DocCollection(options);
|
||||
const collection = new TestWorkspace(options);
|
||||
collection.meta.initialize();
|
||||
const doc = collection.createDoc({ id: docId });
|
||||
doc.load();
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import {
|
||||
DocCollection,
|
||||
Job,
|
||||
type JobMiddleware,
|
||||
Schema,
|
||||
} from '@blocksuite/store';
|
||||
import { Job, type JobMiddleware, Schema } from '@blocksuite/store';
|
||||
import { TestWorkspace } from '@blocksuite/store/test';
|
||||
|
||||
import { defaultImageProxyMiddleware } from '../../_common/transformers/middlewares.js';
|
||||
import { AffineSchemas } from '../../schemas.js';
|
||||
@@ -25,7 +21,7 @@ export function createJob(middlewares?: JobMiddleware[]) {
|
||||
const testMiddlewares = middlewares ?? [];
|
||||
testMiddlewares.push(defaultImageProxyMiddleware);
|
||||
const schema = new Schema().register(AffineSchemas);
|
||||
const docCollection = new DocCollection({ schema });
|
||||
const docCollection = new TestWorkspace({ schema });
|
||||
docCollection.meta.initialize();
|
||||
return new Job({
|
||||
schema,
|
||||
|
||||
Reference in New Issue
Block a user