Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix: test case for delete workspace

alt0f7ff8f29b8a8
diff --git a/packages/data-center/src/provider/local/local.spec.ts b/packages/data-center/src/provider/local/local.spec.ts
index f6a7c764ec..d1778f5b0f 100644
--- a/packages/data-center/src/provider/local/local.spec.ts
+++ b/packages/data-center/src/provider/local/local.spec.ts
@@ -48,10 +48,13 @@ test.describe.serial('local provider', () => {
expect(workspaces.workspaces.length).toEqual(1);
/**
* FIXME
- * Running following code will crash the worker, and get error like next line:
+ * If we don't wrap setTimeout,
+ * Running deleteWorkspace 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);
+ setTimeout(async () => {
+ await provider.deleteWorkspace(workspaces.workspaces[0].id);
+ expect(workspaces.workspaces.length).toEqual(0);
+ }, 10);
});
});