diff --git a/__tests__/server/middleware/pwa/offline.spec.jsx b/__tests__/server/middleware/pwa/offline.spec.jsx
index 71df81649..c1780190a 100644
--- a/__tests__/server/middleware/pwa/offline.spec.jsx
+++ b/__tests__/server/middleware/pwa/offline.spec.jsx
@@ -20,7 +20,7 @@
import React from 'react';
import { Helmet } from 'react-helmet';
-import { registerModule } from 'holocron';
+import { RenderModule, registerModule } from 'holocron';
import { createRequest, createResponse } from 'node-mocks-http';
import oneApp from '../../../../src/universal';
@@ -36,6 +36,10 @@ jest.mock('fs', () => ({
existsSync: () => false,
readFileSync: (filePath) => Buffer.from(filePath.endsWith('noop.js') ? '[service-worker-noop-script]' : '[service-worker-script]'),
}));
+jest.mock('holocron', () => ({
+ ...jest.requireActual('holocron'),
+ RenderModule: jest.fn(),
+}));
describe('offline middleware', () => {
beforeAll(() => {
@@ -48,7 +52,9 @@ describe('offline middleware', () => {
global.fetch = jest.fn(() => Promise.resolve({}));
const rootModuleName = 'root-module';
- registerModule(rootModuleName, () => React.createElement('p', null, 'Hi there'));
+ const RootModule = () => React.createElement('p', null, 'Hi there');
+ registerModule(rootModuleName, RootModule);
+ RenderModule.mockImplementation(() =>
hello
'); diff --git a/package-lock.json b/package-lock.json index d9b522594..3c12d101c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,7 +41,7 @@ "express-prom-bundle": "^6.6.0", "flat": "^5.0.2", "helmet": "^3.22.0", - "holocron": "^1.7.0", + "holocron": "^1.8.1", "holocron-module-route": "^1.2.1", "immutable": "^4.0.0", "ip": "^1.1.5", @@ -13556,9 +13556,9 @@ } }, "node_modules/holocron": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/holocron/-/holocron-1.7.0.tgz", - "integrity": "sha512-gz88zT+JuIWC19o+7tgFl9whUqrCS5TGFga2QSJU3CLLYzlYMf1UsW13lGE1QjBIQDDwYlwPY2+FSUeejeg9mg==", + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/holocron/-/holocron-1.8.1.tgz", + "integrity": "sha512-jIR6tYjyZyODpc7D8TGddyoTFy3bTJ/5aClHHp9PR5R5QfmmHra+wpN6mkKi7R5+w3LPrbE1bK5NLZ4hdAZ5IA==", "dependencies": { "@americanexpress/vitruvius": "^2.0.0", "hoist-non-react-statics": "^3.3.0", @@ -13570,6 +13570,7 @@ "redux-thunk": "^2.1.0", "require-from-string": "^1.2.1", "reselect": "^4.0.0", + "semver": "^7.3.8", "shallowequal": "^1.1.0", "ssri": "^7.0.1" }, diff --git a/package.json b/package.json index 51af87a85..aca801d81 100644 --- a/package.json +++ b/package.json @@ -109,7 +109,7 @@ "express-prom-bundle": "^6.6.0", "flat": "^5.0.2", "helmet": "^3.22.0", - "holocron": "^1.7.0", + "holocron": "^1.8.1", "holocron-module-route": "^1.2.1", "immutable": "^4.0.0", "ip": "^1.1.5",