From b1b33f8beb26f97d91cb282682472c65f6eccae8 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 2 Aug 2020 13:30:55 -0400 Subject: Fix fetch requests (#708) * Revert audio fetching functionality to use XMLHttpRequest * Replace requestJson * Replace requestJson * Replace requestJson * Replace requestJson and requestText * Fix tests * Include support for vulgar word searches * Remove request.js --- test/test-database.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test-database.js b/test/test-database.js index 3a090c1d..6d0aae07 100644 --- a/test/test-database.js +++ b/test/test-database.js @@ -30,7 +30,7 @@ const chrome = { removeListener() { /* NOP */ } }, getURL(path2) { - return url.pathToFileURL(path.join(__dirname, '..', 'ext', path2.replace(/^\//, ''))); + return url.pathToFileURL(path.join(__dirname, '..', 'ext', path2.replace(/^\//, ''))).href; }, sendMessage() { // NOP @@ -89,6 +89,9 @@ async function fetch(url2) { await Promise.resolve(); const content = fs.readFileSync(filePath, {encoding: null}); return { + ok: true, + status: 200, + statusText: 'OK', text: async () => Promise.resolve(content.toString('utf8')), json: async () => Promise.resolve(JSON.parse(content.toString('utf8'))) }; @@ -113,7 +116,6 @@ vm.execute([ 'bg/js/json-schema.js', 'bg/js/dictionary.js', 'bg/js/media-utility.js', - 'bg/js/request.js', 'bg/js/dictionary-importer.js', 'bg/js/database.js', 'bg/js/dictionary-database.js' -- cgit v1.2.3