summaryrefslogtreecommitdiff
path: root/test/test-schema.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-03-04 21:24:39 -0500
committerGitHub <noreply@github.com>2020-03-04 21:24:39 -0500
commit421b60db0f6f132cbc5993488041846055a76d11 (patch)
treeb2b28efc8ed7651c63ca2e728096ab79c6e6ab06 /test/test-schema.js
parent6e47b4e241594d68384f62b1faa34c86f85addbf (diff)
parent7a51a0fbde445e346a83982dd6a16ce164521e26 (diff)
Merge pull request #387 from toasted-nutbread/yomichan-vm
Abstract Yomichan extension script execution
Diffstat (limited to 'test/test-schema.js')
-rw-r--r--test/test-schema.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/test/test-schema.js b/test/test-schema.js
index f4612f86..5f9915fd 100644
--- a/test/test-schema.js
+++ b/test/test-schema.js
@@ -17,9 +17,11 @@
*/
const assert = require('assert');
-const yomichanTest = require('./yomichan-test');
+const {VM} = require('./yomichan-vm');
-const {JsonSchema} = yomichanTest.requireScript('ext/bg/js/json-schema.js', ['JsonSchema']);
+const vm = new VM();
+vm.execute('bg/js/json-schema.js');
+const JsonSchema = vm.get('JsonSchema');
function testValidate1() {
@@ -138,7 +140,7 @@ function testGetValidValueOrDefault1() {
for (const [value, expected] of testData) {
const actual = JsonSchema.getValidValueOrDefault(schema, value);
- assert.deepStrictEqual(actual, expected);
+ vm.assert.deepStrictEqual(actual, expected);
}
}
@@ -177,7 +179,7 @@ function testGetValidValueOrDefault2() {
for (const [value, expected] of testData) {
const actual = JsonSchema.getValidValueOrDefault(schema, value);
- assert.deepStrictEqual(actual, expected);
+ vm.assert.deepStrictEqual(actual, expected);
}
}
@@ -235,7 +237,7 @@ function testGetValidValueOrDefault3() {
for (const [value, expected] of testData) {
const actual = JsonSchema.getValidValueOrDefault(schema, value);
- assert.deepStrictEqual(actual, expected);
+ vm.assert.deepStrictEqual(actual, expected);
}
}