feat: sqlite subdocument (#2816)

Co-authored-by: Alex Yang <himself65@outlook.com>
This commit is contained in:
Peng XiaoandAlex Yang authored and GitHub committed 2023-06-27 07:40:37 +00:00
1 parent 4307e1eb6b
commit 05452bb297
30 files changed
+842 -426

No files matched your search

@@ -107,6 +107,7 @@ describe('indexeddb provider', () => {
})
.register(AffineSchemas)
.register(__unstableSchemas);
// data should only contain updates for the root doc
data.updates.forEach(({ update }) => {
Workspace.Y.applyUpdate(testWorkspace.doc, update);
});
@@ -125,19 +126,6 @@ describe('indexeddb provider', () => {
}
expect(workspace.doc.toJSON()).toEqual(testWorkspace.doc.toJSON());
}
const secondWorkspace = new Workspace({
id,
})
.register(AffineSchemas)
.register(__unstableSchemas);
const provider2 = createIndexedDBProvider(secondWorkspace.doc, rootDBName);
provider2.connect();
await provider2.whenSynced;
const page = secondWorkspace.getPage('page0');
assertExists(page);
await page.waitForLoaded();
expect(workspace.doc.toJSON()).toEqual(secondWorkspace.doc.toJSON());
});
test('disconnect suddenly', async () => {
@@ -423,6 +411,7 @@ describe('subDoc', () => {
provider.disconnect();
json2 = doc.toJSON();
}
// the following line compares {} with {}
expect(json1['']['1'].toJSON()).toEqual(json2['']['1'].toJSON());
expect(json1['']['2']).toEqual(json2['']['2']);
});