Pop-up dictionary browser extension for language learning. Successor to Yomichan. (PERSONAL FORK)
1/*
2 * Copyright (C) 2023-2025 Yomitan Authors
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18import type {Summary} from '../ext/dictionary-importer';
19import type {Tag, MatchType, TermMetaType, KanjiMetaType, TermExactRequest, DictionaryCounts} from '../ext/dictionary-database';
20
21export type DatabaseTestData = {
22 expectedSummary: Summary;
23 expectedCounts: DictionaryCounts;
24 tests: {
25 findTermsBulk: FindTermsBulkTestCase[];
26 findTermsExactBulk: FindTermsExactBulkTestCase[];
27 findTermsBySequenceBulk: FindTermsBySequenceBulkTestCase[];
28 findTermMetaBulk: FindTermMetaBulkTestCase[];
29 findKanjiBulk: FindKanjiBulkTestCase[];
30 findKanjiMetaBulk: FindKanjiMetaBulkTestCase[];
31 findTagForTitle: FindTagForTitleTestCase[];
32 };
33};
34
35export type ItemCount<TKey = unknown> = [key: TKey, count: number];
36
37export type FindTermsBulkTestCase = {
38 inputs: {
39 matchType: MatchType;
40 termList: string[];
41 }[];
42 expectedResults: {
43 total: number;
44 terms: ItemCount<string>[];
45 readings: ItemCount<string>[];
46 };
47};
48
49export type FindTermsExactBulkTestCase = {
50 inputs: {
51 termList: TermExactRequest[];
52 }[];
53 expectedResults: {
54 total: number;
55 terms: ItemCount<string>[];
56 readings: ItemCount<string>[];
57 };
58};
59
60export type FindTermsBySequenceBulkTestCase = {
61 inputs: {
62 sequenceList: number[];
63 }[];
64 expectedResults: {
65 total: number;
66 terms: ItemCount<string>[];
67 readings: ItemCount<string>[];
68 };
69};
70
71export type FindTermMetaBulkTestCase = {
72 inputs: {
73 termList: string[];
74 }[];
75 expectedResults: {
76 total: number;
77 modes: ItemCount<TermMetaType>[];
78 };
79};
80
81export type FindKanjiBulkTestCase = {
82 inputs: {
83 kanjiList: string[];
84 }[];
85 expectedResults: {
86 total: number;
87 kanji: ItemCount<string>[];
88 };
89};
90
91export type FindKanjiMetaBulkTestCase = {
92 inputs: {
93 kanjiList: string[];
94 }[];
95 expectedResults: {
96 total: number;
97 modes: ItemCount<KanjiMetaType>[];
98 };
99};
100
101export type FindTagForTitleTestCase = {
102 inputs: {
103 name: string;
104 }[];
105 expectedResults: {
106 value: Tag | null;
107 };
108};