aboutsummaryrefslogtreecommitdiff
path: root/test/options-util.test.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2023-12-19 00:33:38 -0500
committerGitHub <noreply@github.com>2023-12-19 05:33:38 +0000
commit1ced9aafc00c10992bab8bd3f1b6b1397f05b7b9 (patch)
tree305bb2b3bfc7fc3b051ee1cd3d1c35f442af0de4 /test/options-util.test.js
parent5f96276fda93dcad39f2165fd3c8d890aa5f9be5 (diff)
Make JSON.parse usage safer (#373)
* Make JSON.parse usage safer * Fix any type * Add readResponseJson * Use readResponseJson * Additional updates * Rename files * Add types
Diffstat (limited to 'test/options-util.test.js')
-rw-r--r--test/options-util.test.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/options-util.test.js b/test/options-util.test.js
index f2ffa36c..41185756 100644
--- a/test/options-util.test.js
+++ b/test/options-util.test.js
@@ -22,6 +22,7 @@ import fs from 'fs';
import url, {fileURLToPath} from 'node:url';
import path from 'path';
import {expect, test, vi} from 'vitest';
+import {parseJson} from '../dev/json.js';
import {OptionsUtil} from '../ext/js/data/options-util.js';
import {TemplatePatcher} from '../ext/js/templates/template-patcher.js';
@@ -40,7 +41,7 @@ async function fetch(url2) {
status: 200,
statusText: 'OK',
text: async () => Promise.resolve(content.toString('utf8')),
- json: async () => Promise.resolve(JSON.parse(content.toString('utf8')))
+ json: async () => Promise.resolve(parseJson(content.toString('utf8')))
};
}
/** @type {import('dev/vm').PseudoChrome} */