summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/dictionary-validate.js18
-rw-r--r--test/schema-validate.js18
-rw-r--r--test/test-database.js28
-rw-r--r--test/test-dictionary.js18
-rw-r--r--test/test-schema.js18
-rw-r--r--test/yomichan-test.js18
6 files changed, 114 insertions, 4 deletions
diff --git a/test/dictionary-validate.js b/test/dictionary-validate.js
index 25a5de88..14eee2ed 100644
--- a/test/dictionary-validate.js
+++ b/test/dictionary-validate.js
@@ -1,3 +1,21 @@
+/*
+ * Copyright (C) 2020 Alex Yatskov <alex@foosoft.net>
+ * Author: Alex Yatskov <alex@foosoft.net>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
const fs = require('fs');
const path = require('path');
const yomichanTest = require('./yomichan-test');
diff --git a/test/schema-validate.js b/test/schema-validate.js
index 1271a611..a4f2d94c 100644
--- a/test/schema-validate.js
+++ b/test/schema-validate.js
@@ -1,3 +1,21 @@
+/*
+ * Copyright (C) 2020 Alex Yatskov <alex@foosoft.net>
+ * Author: Alex Yatskov <alex@foosoft.net>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
const fs = require('fs');
const yomichanTest = require('./yomichan-test');
diff --git a/test/test-database.js b/test/test-database.js
index 44f409dd..35f22523 100644
--- a/test/test-database.js
+++ b/test/test-database.js
@@ -1,3 +1,21 @@
+/*
+ * Copyright (C) 2020 Alex Yatskov <alex@foosoft.net>
+ * Author: Alex Yatskov <alex@foosoft.net>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
const fs = require('fs');
const url = require('url');
const path = require('path');
@@ -72,7 +90,7 @@ class XMLHttpRequest {
const {JsonSchema} = yomichanTest.requireScript('ext/bg/js/json-schema.js', ['JsonSchema']);
const {dictFieldSplit, dictTagSanitize} = yomichanTest.requireScript('ext/bg/js/dictionary.js', ['dictFieldSplit', 'dictTagSanitize']);
-const {stringReverse, hasOwn} = yomichanTest.requireScript('ext/mixed/js/core.js', ['stringReverse', 'hasOwn'], {chrome});
+const {stringReverse} = yomichanTest.requireScript('ext/mixed/js/core.js', ['stringReverse'], {chrome});
const {requestJson} = yomichanTest.requireScript('ext/bg/js/request.js', ['requestJson'], {XMLHttpRequest});
const databaseGlobals = {
@@ -80,7 +98,6 @@ const databaseGlobals = {
JsonSchema,
requestJson,
stringReverse,
- hasOwn,
dictFieldSplit,
dictTagSanitize,
indexedDB: global.indexedDB,
@@ -109,7 +126,8 @@ function countKanjiWithCharacter(kanji, character) {
function clearDatabase(timeout) {
return new Promise((resolve, reject) => {
- const timer = setTimeout(() => {
+ let timer = setTimeout(() => {
+ timer = null;
reject(new Error(`clearDatabase failed to resolve after ${timeout}ms`));
}, timeout);
@@ -122,7 +140,9 @@ function clearDatabase(timeout) {
request.onsuccess = () => resolve2();
});
}
- clearTimeout(timer);
+ if (timer !== null) {
+ clearTimeout(timer);
+ }
resolve();
})();
});
diff --git a/test/test-dictionary.js b/test/test-dictionary.js
index b157dd5d..74f9e62b 100644
--- a/test/test-dictionary.js
+++ b/test/test-dictionary.js
@@ -1,3 +1,21 @@
+/*
+ * Copyright (C) 2020 Alex Yatskov <alex@foosoft.net>
+ * Author: Alex Yatskov <alex@foosoft.net>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
const yomichanTest = require('./yomichan-test');
const dictionaryValidate = require('./dictionary-validate');
diff --git a/test/test-schema.js b/test/test-schema.js
index 8ca63167..f4612f86 100644
--- a/test/test-schema.js
+++ b/test/test-schema.js
@@ -1,3 +1,21 @@
+/*
+ * Copyright (C) 2020 Alex Yatskov <alex@foosoft.net>
+ * Author: Alex Yatskov <alex@foosoft.net>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
const assert = require('assert');
const yomichanTest = require('./yomichan-test');
diff --git a/test/yomichan-test.js b/test/yomichan-test.js
index 939e0ad2..78bfb9c6 100644
--- a/test/yomichan-test.js
+++ b/test/yomichan-test.js
@@ -1,3 +1,21 @@
+/*
+ * Copyright (C) 2020 Alex Yatskov <alex@foosoft.net>
+ * Author: Alex Yatskov <alex@foosoft.net>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
const fs = require('fs');
const path = require('path');