-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjoplin.test.js
41 lines (40 loc) · 1.49 KB
/
joplin.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
const assert = require("assert");
const { extractQuiz } = require("./joplin-exporter");
const note = require("./joplin-test-data/sample-note");
const notebookName = "Note Book Name";
const noteTags = ["tag1", "tag with spaces"];
describe("joplin exporter", function () {
describe("extractQuiz", function () {
it("should extract all 3 QA", function () {
const expected = [
{
question: "**Question:**\nQuestion one?\n",
answer:
"Answer:\nAnswer one\nImage\n![photo.jpg](:/b3a6a0a907a740c6ad9de7d440713c36)\n",
jtaID: "2020-01-11T17-37-49-563",
title: "Test Note Joplin to Anki",
notebook: "Note Book Name",
tags: ["tag1", "tag with spaces"],
},
{
question: "**Question:**\nQuestion two?\n",
answer: "Answer:\nAnswer two\nCode block\n```sh\necho $ANSWER\n```\n",
jtaID: "2020-01-11T17-40-16-643",
title: "Test Note Joplin to Anki",
notebook: "Note Book Name",
tags: ["tag1", "tag with spaces"],
},
{
question: "**Question:**\nQuestion three?\n",
answer: "Answer:\nAnswer three\n",
jtaID: "2020-01-11T17-41-12-703",
title: "Test Note Joplin to Anki",
notebook: "Note Book Name",
tags: ["tag1", "tag with spaces"],
},
];
const actual = extractQuiz(note.body, note.title, notebookName, noteTags);
assert.deepStrictEqual(actual, expected);
});
});
});