fix: undefined content type when syncing

(fixes streetwriters/notesnook#785)
This commit is contained in:
thecodrr
2022-08-15 11:25:57 +05:00
parent 87b778db94
commit 268a0d74a4
2 changed files with 29 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
import { groupArray } from "../utils/grouping";
import {
StorageInterface,
databaseTest,
noteTest,
groupedTest,
TEST_NOTE,
TEST_NOTEBOOK,
IMG_CONTENT,
} from "./utils";
beforeEach(() => {
StorageInterface.clear();
});
test("adding a deleted content should not throw", () =>
databaseTest().then(async (db) => {
await expect(
db.content.add({
remote: true,
deleted: true,
dateEdited: new Date(),
id: "hello",
data: "YOYO!",
})
).resolves.toBeUndefined();
}));

View File

@@ -1,6 +1,8 @@
import { Tiptap } from "./tiptap";
export function getContentFromData(type, data) {
if (!type) return null;
switch (type) {
case "tiptap":
return new Tiptap(data);