From cda04b576db3ba058c315be606d38dcacca2a8f6 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Tue, 23 Mar 2021 22:44:20 -0400 Subject: [PATCH] Update simple test (#1551) * Test null for simple mode * Update test data --- test/data/anki-note-builder-test-results.json | 263 +----------------- test/test-anki-note-builder.js | 2 +- 2 files changed, 2 insertions(+), 263 deletions(-) diff --git a/test/data/anki-note-builder-test-results.json b/test/data/anki-note-builder-test-results.json index 9b7c7f65..cf80d6a6 100644 --- a/test/data/anki-note-builder-test-results.json +++ b/test/data/anki-note-builder-test-results.json @@ -998,268 +998,7 @@ }, { "name": "Search using different modes", - "results": [ - { - "audio": "", - "clipboard-image": "", - "clipboard-text": "", - "cloze-body": "打ち込む", - "cloze-prefix": "cloze-prefix", - "cloze-suffix": "cloze-suffix", - "conjugation": "", - "dictionary": "Test Dictionary 2", - "document-title": "title", - "expression": "打ち込む", - "frequencies": "", - "furigana": "む", - "furigana-plain": "打[う]ち 込[こ]む", - "glossary": "
(tag1, tag2, Test Dictionary 2)
", - "glossary-brief": "
", - "glossary-no-dictionary": "
(tag1, tag2)
", - "pitch-accents": "No pitch accent data", - "pitch-accent-graphs": "No pitch accent data", - "pitch-accent-positions": "No pitch accent data", - "reading": "うちこむ", - "screenshot": "", - "sentence": "cloze-prefix打ち込むcloze-suffix", - "tags": "tag1, tag2", - "url": "url:" - }, - { - "audio": "", - "clipboard-image": "", - "clipboard-text": "", - "cloze-body": "打ち込む", - "cloze-prefix": "cloze-prefix", - "cloze-suffix": "cloze-suffix", - "conjugation": "", - "dictionary": "Test Dictionary 2", - "document-title": "title", - "expression": "打ち込む", - "frequencies": "", - "furigana": "む", - "furigana-plain": "打[ぶ]ち 込[こ]む", - "glossary": "
(tag1, tag2, Test Dictionary 2)
", - "glossary-brief": "
", - "glossary-no-dictionary": "
(tag1, tag2)
", - "pitch-accents": "No pitch accent data", - "pitch-accent-graphs": "No pitch accent data", - "pitch-accent-positions": "No pitch accent data", - "reading": "ぶちこむ", - "screenshot": "", - "sentence": "cloze-prefix打ち込むcloze-suffix", - "tags": "tag1, tag2", - "url": "url:" - }, - { - "audio": "", - "clipboard-image": "", - "clipboard-text": "", - "cloze-body": "打ち込む", - "cloze-prefix": "cloze-prefix", - "cloze-suffix": "cloze-suffix", - "conjugation": "", - "dictionary": "Test Dictionary 2", - "document-title": "title", - "expression": "打ち込む", - "frequencies": "", - "furigana": "む", - "furigana-plain": "打[う]ち 込[こ]む", - "glossary": "
(tag1, tag2, Test Dictionary 2)
", - "glossary-brief": "
", - "glossary-no-dictionary": "
(tag1, tag2)
", - "pitch-accents": "No pitch accent data", - "pitch-accent-graphs": "No pitch accent data", - "pitch-accent-positions": "No pitch accent data", - "reading": "うちこむ", - "screenshot": "", - "sentence": "cloze-prefix打ち込むcloze-suffix", - "tags": "tag1, tag2", - "url": "url:" - }, - { - "audio": "", - "clipboard-image": "", - "clipboard-text": "", - "cloze-body": "打ち込む", - "cloze-prefix": "cloze-prefix", - "cloze-suffix": "cloze-suffix", - "conjugation": "", - "dictionary": "Test Dictionary 2", - "document-title": "title", - "expression": "打ち込む", - "frequencies": "", - "furigana": "む", - "furigana-plain": "打[ぶ]ち 込[こ]む", - "glossary": "
(tag1, tag2, Test Dictionary 2)
", - "glossary-brief": "
", - "glossary-no-dictionary": "
(tag1, tag2)
", - "pitch-accents": "No pitch accent data", - "pitch-accent-graphs": "No pitch accent data", - "pitch-accent-positions": "No pitch accent data", - "reading": "ぶちこむ", - "screenshot": "", - "sentence": "cloze-prefix打ち込むcloze-suffix", - "tags": "tag1, tag2", - "url": "url:" - }, - { - "audio": "", - "clipboard-image": "", - "clipboard-text": "", - "cloze-body": "打ち", - "cloze-prefix": "cloze-prefix", - "cloze-suffix": "cloze-suffix", - "conjugation": "masu stem", - "dictionary": "Test Dictionary 2", - "document-title": "title", - "expression": "打つ", - "frequencies": "", - "furigana": "つ", - "furigana-plain": "打[う]つ", - "glossary": "
(tag1, tag2, Test Dictionary 2)
", - "glossary-brief": "
", - "glossary-no-dictionary": "
(tag1, tag2)
", - "pitch-accents": "No pitch accent data", - "pitch-accent-graphs": "No pitch accent data", - "pitch-accent-positions": "No pitch accent data", - "reading": "うつ", - "screenshot": "", - "sentence": "cloze-prefix打ちcloze-suffix", - "tags": "tag1, tag2", - "url": "url:" - }, - { - "audio": "", - "clipboard-image": "", - "clipboard-text": "", - "cloze-body": "打ち", - "cloze-prefix": "cloze-prefix", - "cloze-suffix": "cloze-suffix", - "conjugation": "masu stem", - "dictionary": "Test Dictionary 2", - "document-title": "title", - "expression": "打つ", - "frequencies": "", - "furigana": "つ", - "furigana-plain": "打[ぶ]つ", - "glossary": "
(tag1, tag2, Test Dictionary 2)
", - "glossary-brief": "
", - "glossary-no-dictionary": "
(tag1, tag2)
", - "pitch-accents": "No pitch accent data", - "pitch-accent-graphs": "No pitch accent data", - "pitch-accent-positions": "No pitch accent data", - "reading": "ぶつ", - "screenshot": "", - "sentence": "cloze-prefix打ちcloze-suffix", - "tags": "tag1, tag2", - "url": "url:" - }, - { - "audio": "", - "clipboard-image": "", - "clipboard-text": "", - "cloze-body": "打ち", - "cloze-prefix": "cloze-prefix", - "cloze-suffix": "cloze-suffix", - "conjugation": "masu stem", - "dictionary": "Test Dictionary 2", - "document-title": "title", - "expression": "打つ", - "frequencies": "", - "furigana": "つ", - "furigana-plain": "打[う]つ", - "glossary": "
(tag1, tag2, Test Dictionary 2)
", - "glossary-brief": "
", - "glossary-no-dictionary": "
(tag1, tag2)
", - "pitch-accents": "No pitch accent data", - "pitch-accent-graphs": "No pitch accent data", - "pitch-accent-positions": "No pitch accent data", - "reading": "うつ", - "screenshot": "", - "sentence": "cloze-prefix打ちcloze-suffix", - "tags": "tag1, tag2", - "url": "url:" - }, - { - "audio": "", - "clipboard-image": "", - "clipboard-text": "", - "cloze-body": "打ち", - "cloze-prefix": "cloze-prefix", - "cloze-suffix": "cloze-suffix", - "conjugation": "masu stem", - "dictionary": "Test Dictionary 2", - "document-title": "title", - "expression": "打つ", - "frequencies": "", - "furigana": "つ", - "furigana-plain": "打[ぶ]つ", - "glossary": "
(tag1, tag2, Test Dictionary 2)
", - "glossary-brief": "
", - "glossary-no-dictionary": "
(tag1, tag2)
", - "pitch-accents": "No pitch accent data", - "pitch-accent-graphs": "No pitch accent data", - "pitch-accent-positions": "No pitch accent data", - "reading": "ぶつ", - "screenshot": "", - "sentence": "cloze-prefix打ちcloze-suffix", - "tags": "tag1, tag2", - "url": "url:" - }, - { - "audio": "", - "clipboard-image": "", - "clipboard-text": "", - "cloze-body": "打", - "cloze-prefix": "cloze-prefix", - "cloze-suffix": "cloze-suffix", - "conjugation": "", - "dictionary": "Test Dictionary 2", - "document-title": "title", - "expression": "打", - "frequencies": "", - "furigana": "", - "furigana-plain": "打[だ]", - "glossary": "
(tag1, tag2, Test Dictionary 2)
", - "glossary-brief": "
", - "glossary-no-dictionary": "
(tag1, tag2)
", - "pitch-accents": "No pitch accent data", - "pitch-accent-graphs": "No pitch accent data", - "pitch-accent-positions": "No pitch accent data", - "reading": "だ", - "screenshot": "", - "sentence": "cloze-prefix打cloze-suffix", - "tags": "tag1, tag2", - "url": "url:" - }, - { - "audio": "", - "clipboard-image": "", - "clipboard-text": "", - "cloze-body": "打", - "cloze-prefix": "cloze-prefix", - "cloze-suffix": "cloze-suffix", - "conjugation": "", - "dictionary": "Test Dictionary 2", - "document-title": "title", - "expression": "打", - "frequencies": "", - "furigana": "ダース", - "furigana-plain": "打[ダース]", - "glossary": "
(tag1, tag2, Test Dictionary 2)
", - "glossary-brief": "
", - "glossary-no-dictionary": "
(tag1, tag2)
", - "pitch-accents": "No pitch accent data", - "pitch-accent-graphs": "No pitch accent data", - "pitch-accent-positions": "No pitch accent data", - "reading": "ダース", - "screenshot": "", - "sentence": "cloze-prefix打cloze-suffix", - "tags": "tag1, tag2", - "url": "url:" - } - ] + "results": null }, { "name": "Search using different modes", diff --git a/test/test-anki-note-builder.js b/test/test-anki-note-builder.js index f28bebef..deee5b6c 100644 --- a/test/test-anki-note-builder.js +++ b/test/test-anki-note-builder.js @@ -194,7 +194,7 @@ async function main() { const {name, mode, text} = test; const options = vm.buildOptions(optionsPresets, test.options); const [definitions] = clone(await vm.translator.findTerms(mode, text, options)); - const results = clone(await getRenderResults(definitions, 'terms', mode, templates, AnkiNoteBuilder, write)); + const results = mode !== 'simple' ? clone(await getRenderResults(definitions, 'terms', mode, templates, AnkiNoteBuilder, write)) : null; actualResults1.push({name, results}); if (!write) { assert.deepStrictEqual(results, expected1.results);