Merge remote-tracking branch 'origin/master' into feat/cloud-sync-saika

This commit is contained in:
alt0
2023-01-09 15:38:25 +08:00
106 changed files with 196 additions and 653 deletions

View File

@@ -1 +1 @@
export * from './local';
export * from './local.js';

View File

@@ -1,10 +1,10 @@
import { describe, test, expect } from 'vitest';
import { Workspaces } from '../../workspaces';
import { LocalProvider } from './local';
import { test, expect } from '@playwright/test';
import { Workspaces } from '../../workspaces/index.js';
import { LocalProvider } from './local.js';
import 'fake-indexeddb/auto';
import { BlobStorage } from '@blocksuite/store';
describe('local provider', () => {
test.describe.serial('local provider', () => {
const workspaces = new Workspaces();
const provider = new LocalProvider({
workspaces: workspaces.createScope(),
@@ -46,7 +46,12 @@ describe('local provider', () => {
test('delete workspace', async () => {
expect(workspaces.workspaces.length).toEqual(1);
await provider.deleteWorkspace(workspaces.workspaces[0].id);
expect(workspaces.workspaces.length).toEqual(0);
/**
* FIXME
* Running following code will crash the worker, and get error like next line:
* InvalidStateError: An operation was called on an object on which it is not allowed or at a time when it is not allowed. Also occurs if a request is made on a source object that has been deleted or removed. Use TransactionInactiveError or ReadOnlyError when possible, as they are more specific variations of InvalidStateError.
* */
// await provider.deleteWorkspace(workspaces.workspaces[0].id);
// expect(workspaces.workspaces.length).toEqual(0);
});
});

View File

@@ -1,11 +1,11 @@
import { BaseProvider } from '../base';
import { BaseProvider } from '../base.js';
import type { ProviderConstructorParams } from '../base';
import { varStorage as storage } from 'lib0/storage';
import { Workspace as WS, WorkspaceMeta } from '../../types';
import { Workspace, uuidv4 } from '@blocksuite/store';
import { IndexedDBProvider } from '../indexeddb';
import { IndexedDBProvider } from '../indexeddb.js';
import assert from 'assert';
import { getDefaultHeadImgBlob } from '../../utils';
import { getDefaultHeadImgBlob } from '../../utils/index.js';
const WORKSPACE_KEY = 'workspaces';

View File

@@ -1,2 +1,2 @@
export { Workspaces } from './workspaces';
export { Workspaces } from './workspaces.js';
export type { WorkspacesScope, WorkspacesChangeEvent } from './workspaces';

View File

@@ -1,8 +1,8 @@
import { describe, test, expect } from 'vitest';
import { Workspaces } from './workspaces';
import { test, expect } from '@playwright/test';
import { Workspaces } from './workspaces.js';
import type { WorkspacesChangeEvent } from './workspaces';
describe('workspaces observable', () => {
test.describe.serial('workspaces observable', () => {
const workspaces = new Workspaces();
const scope = workspaces.createScope();