Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6b5f205965 |
@@ -42,8 +42,8 @@ test("a flash message's timer does not fire after cleanupPopup()", async () => {
|
||||
await wait(FLASH_MS * 5);
|
||||
});
|
||||
|
||||
// A boot onto a screen whose requests no mocked module answers: they reach the
|
||||
// boot's fetch() stub, never the internet
|
||||
// A boot onto a screen that sends a request no mocked module answers: that
|
||||
// request reaches the boot's fetch() stub, never the internet
|
||||
// (https://git.eeqj.de/sneak/AutistMask/issues/559).
|
||||
function restoringOnto(view, viewData) {
|
||||
return unversionedValidProfile({
|
||||
|
||||
@@ -261,10 +261,14 @@ async function settle() {
|
||||
async function bootPopup(stored, options) {
|
||||
jest.resetModules();
|
||||
|
||||
// Three of the modules that reach the network. None is on the path under
|
||||
// test; all would make the suite hit the internet. Every other request,
|
||||
// such as the transaction screen's Blockscout lookup and the Etherscan
|
||||
// lookup in src/shared/etherscanLabels.js, meets the fetch() stub below.
|
||||
// The RPC requests made through src/shared/balances.js go through Node's
|
||||
// own http and https modules, not fetch(), so the fetch() stub below would
|
||||
// not stop them, which is why that module stays mocked.
|
||||
// src/shared/prices.js and src/shared/transactions.js send their requests
|
||||
// through fetch(), and their mocks answer with no prices and no
|
||||
// transactions. Every request the page still sends, such as the
|
||||
// transaction screen's Blockscout lookup and the Etherscan lookup in
|
||||
// src/shared/etherscanLabels.js, meets the fetch() stub.
|
||||
jest.doMock("../../src/shared/prices", () => ({
|
||||
prices: {},
|
||||
refreshPrices: jest.fn(async () => {}),
|
||||
@@ -338,8 +342,8 @@ async function bootPopup(stored, options) {
|
||||
},
|
||||
};
|
||||
// Every fetch() the page makes fails, as it does elsewhere in the suite,
|
||||
// instead of reaching the internet. A new stub per boot, so its calls are
|
||||
// that boot's requests. Put back by cleanupPopup().
|
||||
// instead of reaching the internet. A new stub per boot, so the calls it
|
||||
// records start with that boot. Put back by cleanupPopup().
|
||||
globalThis.fetch = jest.fn(() => {
|
||||
throw new Error("tests must not perform network requests");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user