aboutsummaryrefslogtreecommitdiff
path: root/test/dictionary-data-validate.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/dictionary-data-validate.test.js')
-rw-r--r--test/dictionary-data-validate.test.js15
1 files changed, 8 insertions, 7 deletions
diff --git a/test/dictionary-data-validate.test.js b/test/dictionary-data-validate.test.js
index b09e4ae0..a8d9f1ab 100644
--- a/test/dictionary-data-validate.test.js
+++ b/test/dictionary-data-validate.test.js
@@ -19,19 +19,19 @@
import {fileURLToPath} from 'node:url';
import path from 'path';
import {describe, it} from 'vitest';
+import {createDictionaryArchiveData} from '../dev/dictionary-archive-util.js';
import * as dictionaryValidate from '../dev/dictionary-validate.js';
-import {createDictionaryArchive} from '../dev/util.js';
const dirname = path.dirname(fileURLToPath(import.meta.url));
/**
* @param {string} dictionary
* @param {string} [dictionaryName]
- * @returns {import('jszip')}
+ * @returns {Promise<ArrayBuffer>}
*/
-function createTestDictionaryArchive(dictionary, dictionaryName) {
+async function createTestDictionaryArchiveData(dictionary, dictionaryName) {
const dictionaryDirectory = path.join(dirname, 'data', 'dictionaries', dictionary);
- return createDictionaryArchive(dictionaryDirectory, dictionaryName);
+ return await createDictionaryArchiveData(dictionaryDirectory, dictionaryName);
}
describe('Dictionary validation', () => {
@@ -47,11 +47,12 @@ describe('Dictionary validation', () => {
const schemas = dictionaryValidate.getSchemas();
describe.each(testCases)('Test dictionary $name', ({name, valid}) => {
it(`should be ${valid ? 'valid' : 'invalid'}`, async ({expect}) => {
- const archive = createTestDictionaryArchive(name);
+ const archive = await createTestDictionaryArchiveData(name);
+ const promise = dictionaryValidate.validateDictionary(null, archive, schemas);
await (
valid ?
- expect(dictionaryValidate.validateDictionary(null, archive, schemas)).resolves.not.toThrow() :
- expect(dictionaryValidate.validateDictionary(null, archive, schemas)).rejects.toThrow()
+ expect(promise).resolves.not.toThrow() :
+ expect(promise).rejects.toThrow()
);
});
});