mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-29 00:20:04 +01:00
fix: undefined content type when syncing
(fixes streetwriters/notesnook#785)
This commit is contained in:
27
packages/core/__tests__/content.test.js
Normal file
27
packages/core/__tests__/content.test.js
Normal 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();
|
||||
}));
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user