aboutsummaryrefslogtreecommitdiff
path: root/test/dictionary-data-validate.test.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2024-02-27 07:14:20 -0500
committerGitHub <noreply@github.com>2024-02-27 12:14:20 +0000
commitc4fea2251606fb0b3d0d761a544dac578f3d9048 (patch)
tree3dbd85877f0d7b3d9de78ace7809e809a7a212d4 /test/dictionary-data-validate.test.js
parent2e9ea19207a7410f929bb908759d48cb2340f29c (diff)
Update to zip.js for tests (#698)
* Use zip.js * Set compression level to 0 * Update comments
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()
);
});
});