summaryrefslogtreecommitdiff
path: root/test/database.test.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2023-11-30 20:00:46 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2023-11-30 20:00:46 -0500
commit338d210b66006189a0b775e8bd524c1cc11c2d9a (patch)
tree12fbd7eb03dcbb7ffcf270a1e7f9a8ee0cf53996 /test/database.test.js
parent43bc4e3015a7b6c4f4941c4b6327a7445b356f1c (diff)
Update paths
Diffstat (limited to 'test/database.test.js')
-rw-r--r--test/database.test.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/database.test.js b/test/database.test.js
index ee818467..30854d55 100644
--- a/test/database.test.js
+++ b/test/database.test.js
@@ -18,12 +18,15 @@
import {IDBFactory, IDBKeyRange} from 'fake-indexeddb';
import path from 'path';
+import {fileURLToPath} from 'node:url';
import {beforeEach, describe, expect, test, vi} from 'vitest';
import {createDictionaryArchive} from '../dev/util.js';
import {DictionaryDatabase} from '../ext/js/language/dictionary-database.js';
import {DictionaryImporterMediaLoader} from '../ext/js/language/dictionary-importer-media-loader.js';
import {DictionaryImporter} from '../ext/js/language/dictionary-importer.js';
+const dirname = path.dirname(fileURLToPath(import.meta.url));
+
vi.stubGlobal('IDBKeyRange', IDBKeyRange);
vi.mock('../ext/js/language/dictionary-importer-media-loader.js');
@@ -34,7 +37,7 @@ vi.mock('../ext/js/language/dictionary-importer-media-loader.js');
* @returns {import('jszip')}
*/
function createTestDictionaryArchive(dictionary, dictionaryName) {
- const dictionaryDirectory = path.join(__dirname, 'data', 'dictionaries', dictionary);
+ const dictionaryDirectory = path.join(dirname, 'data', 'dictionaries', dictionary);
return createDictionaryArchive(dictionaryDirectory, dictionaryName);
}