Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
chore(package): bump holocron to 1.8.1 (#1129)
Browse files Browse the repository at this point in the history
Co-authored-by: Jonny Adshead <JAdshead@users.noreply.github.com>
  • Loading branch information
drewcur and JAdshead authored Sep 22, 2023
1 parent f46a222 commit 075638a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
16 changes: 12 additions & 4 deletions __tests__/server/middleware/pwa/offline.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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(() => {
Expand All @@ -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(() => <RootModule />);
setStateConfig({
rootModuleName: {
server: rootModuleName,
Expand Down Expand Up @@ -100,7 +106,7 @@ describe('offline middleware', () => {
const middleware = createOfflineMiddleware(oneApp);
const req = createRequest();
const res = createResponse();
registerModule('root-module', () => (
const RootModule = () => (
<React.Fragment>
<Helmet>
<link rel="manifest" href="manifest.webmanifest" />
Expand All @@ -109,7 +115,9 @@ describe('offline middleware', () => {
hello
</p>
</React.Fragment>
));
);
registerModule('root-module', RootModule);
RenderModule.mockImplementation(() => <RootModule />);

await expect(middleware(req, res)).resolves.toBeUndefined();
expect(req.appHtml).toEqual('<p>hello</p>');
Expand Down
9 changes: 5 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 075638a

Please sign in to comment.