-
Notifications
You must be signed in to change notification settings - Fork 87
[REFACTOR] React to HTML plugin #856
[REFACTOR] React to HTML plugin #856
Conversation
Size Change: 0 B Total Size: 681 kB ℹ️ View Unchanged
|
@@ -1,5 +1,5 @@ | |||
/* | |||
* Copyright 2019 American Express Travel Related Services Company, Inc. | |||
* Copyright 2022 American Express Travel Related Services Company, Inc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not need to be updated
expect(response.body).toContain('Sorry, we are unable to load this page at this time. Please try again later.'); | ||
}); | ||
|
||
it('invites the user to try again if the status code is 404', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why try again on a 404?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the "try again" is related to the message that's being rendered: "Please try again later." (see
it('invites the user to try again if the status code is 404', () => { |
res.timeout = timeout; | ||
return res; | ||
.then((reply) => { | ||
// eslint-disable-next-line no-param-reassign |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comment explaining any rules being disabled
jest.spyOn(console, 'log').mockImplementation(() => {}); | ||
jest.spyOn(console, 'error').mockImplementation(() => {}); | ||
jest.spyOn(console, 'warn').mockImplementationOnce(() => {}); | ||
jest.spyOn(console, 'info').mockImplementation(() => { }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this a lint error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just copy/paste from another test
it('warns if url cannot be fetched', async () => { | ||
const fetchError = new Error('getaddrinfo ENOTFOUND'); | ||
global.fetch = jest.fn(() => Promise.reject(fetchError)); | ||
test('calls the expected hooks to render html', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use it
rather than test
throughout
@@ -53,10 +52,10 @@ const renderForStaticMarkupSpy = jest.spyOn(reactRendering, 'renderForStaticMark | |||
|
|||
describe('createRequestHtmlFragment', () => { | |||
jest.spyOn(console, 'error').mockImplementation(() => {}); | |||
console.error = jest.fn(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be needed
Description
Fastify plugin that takes care of creating the redux store, converting react into html, and responding
Motivation and Context
This is part of the ExpressJS -> Fastify migration. The plugin allows us to simply reply with
reply.sendHtml()
from any routeHow Has This Been Tested?
Manual, Unit Testing, Integration Testing
Types of Changes
Checklist:
What is the Impact to Developers Using One App?