From dab31d724dcc45cb3dfed87d8eed442e6526b147 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Thu, 16 Jan 2020 14:01:15 +0000 Subject: [PATCH] Support uri option in request mock --- __mocks__/browser-request.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/__mocks__/browser-request.js b/__mocks__/browser-request.js index 45f83a1763..8038262091 100644 --- a/__mocks__/browser-request.js +++ b/__mocks__/browser-request.js @@ -1,14 +1,15 @@ const en = require("../src/i18n/strings/en_EN"); module.exports = jest.fn((opts, cb) => { - if (opts.url.endsWith("languages.json")) { + const url = opts.url || opts.uri; + if (url && url.endsWith("languages.json")) { cb(undefined, {status: 200}, JSON.stringify({ "en": { "fileName": "en_EN.json", "label": "English", }, })); - } else if (opts.url.endsWith("en_EN.json")) { + } else if (url && url.endsWith("en_EN.json")) { cb(undefined, {status: 200}, JSON.stringify(en)); } else { cb(undefined, {status: 404}, "");