* Install fresh mock.module() interceptors for the four modules * client-src/index.js loads at evaluation time. * @returns {void}
()
| 23 | * @returns {void} |
| 24 | */ |
| 25 | function installMocks() { |
| 26 | log = { |
| 27 | log: { info: fn(), warn: fn(), error: fn() }, |
| 28 | logEnabledFeatures: fn(), |
| 29 | setLogLevel: fn(), |
| 30 | }; |
| 31 | logMockCtx = mock.module("../../client-src/utils/log.js", { |
| 32 | namedExports: log, |
| 33 | }); |
| 34 | |
| 35 | socket = fn(); |
| 36 | socketMockCtx = mock.module("../../client-src/socket.js", { |
| 37 | defaultExport: socket, |
| 38 | }); |
| 39 | |
| 40 | const send = fn(); |
| 41 | overlay = { send }; |
| 42 | overlayMockCtx = mock.module("../../client-src/overlay.js", { |
| 43 | namedExports: { |
| 44 | createOverlay: () => overlay, |
| 45 | formatProblem: (item) => ({ |
| 46 | header: "HEADER warning", |
| 47 | body: `BODY: ${item}`, |
| 48 | }), |
| 49 | }, |
| 50 | }); |
| 51 | |
| 52 | sendMessage = fn(); |
| 53 | sendMessageMockCtx = mock.module("../../client-src/utils/sendMessage.js", { |
| 54 | defaultExport: sendMessage, |
| 55 | }); |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Tear down the mock.module() interceptors installed by installMocks(). |
no outgoing calls
no test coverage detected
searching dependent graphs…