ci: fix all tests

This commit is contained in:
thecodrr
2020-03-02 13:11:45 +05:00
parent 168e50b0cc
commit f1644add76
3 changed files with 12 additions and 8 deletions

View File

@@ -37,11 +37,11 @@ test("get delta of note", () =>
test("delete note", () =>
noteTest().then(async ({ db, id }) => {
let notebookId = await db.notebooks.add(TEST_NOTEBOOK);
let topic = await db.notebooks
.notebook(notebookId)
.topics.topic("General")
.add(id);
let { id: notebookId } = await db.notebooks.add(TEST_NOTEBOOK);
let topics = db.notebooks.notebook(notebookId).topics;
let topic = topics.topic("General");
await topic.add(id);
topic = topics.topic("General");
expect(topic.all.findIndex(v => v.id === id)).toBeGreaterThan(-1);
await db.notes.delete(id);
expect(db.notes.note(id)).toBeUndefined();
@@ -272,11 +272,12 @@ test("add note to topic", () =>
test("duplicate note to topic should not be added", () =>
noteTest().then(async ({ db, id }) => {
let notebookId = await db.notebooks.add({ title: "Hello" });
let { id: notebookId } = await db.notebooks.add({ title: "Hello" });
let topics = db.notebooks.notebook(notebookId).topics;
await topics.add("Home");
let topic = topics.topic("Home");
await topic.add(id);
topic = topics.topic("Home");
expect(topic.all.length).toBe(1);
}));

View File

@@ -10,7 +10,7 @@ beforeEach(() => StorageInterface.clear());
test("delete a note", () =>
noteTest().then(async ({ db, id }) => {
let nbId = await db.notebooks.add(TEST_NOTEBOOK);
let { id: nbId } = await db.notebooks.add(TEST_NOTEBOOK);
await db.notebooks
.notebook(nbId)
.topics.topic("General")

View File

@@ -26,7 +26,10 @@ const notebookTest = (notebook = TEST_NOTEBOOK) =>
});
var TEST_NOTE = {
content: { delta: "I am a delta", text: "I am a text" }
content: {
delta: { ops: [{ type: "insert", text: "I am a delta" }] },
text: "I am a text"
}
};
const LONG_TEXT =