diff --git a/.eslintrc.json b/.eslintrc.json index 387135f7fe..b7e21216dc 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -57,7 +57,7 @@ "plugins": ["@typescript-eslint"] }, { - "files": ["./tools/ui-components/**/*.test.[jt]s?(x)"], + "files": ["./tools/ui-components/**/*.test.[jt]s?(x)", "./client/**/*.test.[jt]s?(x)"], "extends": ["plugin:testing-library/react", "plugin:jest-dom/recommended"] } ] diff --git a/client/src/components/Header/Header.test.js b/client/src/components/Header/Header.test.js index 0ee47e5f37..3554eab7f1 100644 --- a/client/src/components/Header/Header.test.js +++ b/client/src/components/Header/Header.test.js @@ -25,8 +25,8 @@ describe('', () => { it('renders to the DOM', () => { const shallow = new ShallowRenderer(); shallow.render(); - const result = shallow.getRenderOutput(); - expect(result).toBeTruthy(); + const view = shallow.getRenderOutput(); + expect(view).toBeTruthy(); }); }); @@ -48,14 +48,14 @@ describe('', () => { }; const shallow = new ShallowRenderer(); shallow.render(); - const result = shallow.getRenderOutput(); + const view = shallow.getRenderOutput(); expect( - hasDonateNavItem(result) && - hasSignInNavItem(result) && - hasCurriculumNavItem(result) && - hasForumNavItem(result) && - hasNewsNavItem(result) && - hasRadioNavItem(result) + hasDonateNavItem(view) && + hasSignInNavItem(view) && + hasCurriculumNavItem(view) && + hasForumNavItem(view) && + hasNewsNavItem(view) && + hasRadioNavItem(view) ).toBeTruthy(); }); @@ -76,15 +76,15 @@ describe('', () => { }; const shallow = new ShallowRenderer(); shallow.render(); - const result = shallow.getRenderOutput(); + const view = shallow.getRenderOutput(); expect( - hasDonateNavItem(result) && - hasCurriculumNavItem(result) && - hasProfileAndSettingsNavItems(result, landingPageProps.user.username) && - hasForumNavItem(result) && - hasNewsNavItem(result) && - hasRadioNavItem(result) && - hasSignOutNavItem(result) + hasDonateNavItem(view) && + hasCurriculumNavItem(view) && + hasProfileAndSettingsNavItems(view, landingPageProps.user.username) && + hasForumNavItem(view) && + hasNewsNavItem(view) && + hasRadioNavItem(view) && + hasSignOutNavItem(view) ).toBeTruthy(); }); @@ -105,15 +105,15 @@ describe('', () => { }; const shallow = new ShallowRenderer(); shallow.render(); - const result = shallow.getRenderOutput(); + const view = shallow.getRenderOutput(); expect( - hasThanksForDonating(result) && - hasCurriculumNavItem(result) && - hasProfileAndSettingsNavItems(result, landingPageProps.user.username) && - hasForumNavItem(result) && - hasNewsNavItem(result) && - hasRadioNavItem(result) && - hasSignOutNavItem(result) + hasThanksForDonating(view) && + hasCurriculumNavItem(view) && + hasProfileAndSettingsNavItems(view, landingPageProps.user.username) && + hasForumNavItem(view) && + hasNewsNavItem(view) && + hasRadioNavItem(view) && + hasSignOutNavItem(view) ).toBeTruthy(); }); }); @@ -131,8 +131,8 @@ describe('', () => { const shallow = new ShallowRenderer(); shallow.render(); - const componentTree = shallow.getRenderOutput(); - expect(avatarHasClass(componentTree, 'default-border')).toBeTruthy(); + const view = shallow.getRenderOutput(); + expect(avatarHasClass(view, 'default-border')).toBeTruthy(); }); it('has avatar with gold border for donating users', () => { @@ -147,9 +147,9 @@ describe('', () => { }; const shallow = new ShallowRenderer(); shallow.render(); - const componentTree = shallow.getRenderOutput(); + const view = shallow.getRenderOutput(); - expect(avatarHasClass(componentTree, 'gold-border')).toBeTruthy(); + expect(avatarHasClass(view, 'gold-border')).toBeTruthy(); }); it('has avatar with blue border for top contributors', () => { @@ -165,9 +165,9 @@ describe('', () => { const shallow = new ShallowRenderer(); shallow.render(); - const componentTree = shallow.getRenderOutput(); + const view = shallow.getRenderOutput(); - expect(avatarHasClass(componentTree, 'blue-border')).toBeTruthy(); + expect(avatarHasClass(view, 'blue-border')).toBeTruthy(); }); it('has avatar with purple border for donating top contributors', () => { const topDonatingContributorUserProps = { @@ -182,8 +182,8 @@ describe('', () => { }; const shallow = new ShallowRenderer(); shallow.render(); - const componentTree = shallow.getRenderOutput(); - expect(avatarHasClass(componentTree, 'purple-border')).toBeTruthy(); + const view = shallow.getRenderOutput(); + expect(avatarHasClass(view, 'purple-border')).toBeTruthy(); }); }); diff --git a/client/src/components/Intro/Intro.test.js b/client/src/components/Intro/Intro.test.js index c4601007d0..e638b653b8 100644 --- a/client/src/components/Intro/Intro.test.js +++ b/client/src/components/Intro/Intro.test.js @@ -16,7 +16,19 @@ describe('', () => { const container = rendererCreateWithRedux( ).root; + + /** + * This rules had to be disabled because the new lint rules are throwing false positives here. + * They were interpreting react-test-renderer functions as @testing-library/react functions. + */ + // eslint-disable-next-line testing-library/await-async-query expect(container.findAllByType('blockquote').length === 0).toBeTruthy(); + + /** + * This rules had to be disabled because the new lint rules are throwing false positives here. + * They were interpreting react-test-renderer functions as @testing-library/react functions. + */ + // eslint-disable-next-line testing-library/await-async-query expect(container.findAllByType('h1').length === 1).toBeTruthy(); }); @@ -24,7 +36,19 @@ describe('', () => { const container = rendererCreateWithRedux( ).root; + + /** + * This rules had to be disabled because the new lint rules are throwing false positives here. + * They were interpreting react-test-renderer functions as @testing-library/react functions. + */ + // eslint-disable-next-line testing-library/await-async-query expect(container.findAllByType('blockquote').length === 1).toBeTruthy(); + + /** + * This rules had to be disabled because the new lint rules are throwing false positives here. + * They were interpreting react-test-renderer functions as @testing-library/react functions. + */ + // eslint-disable-next-line testing-library/await-async-query expect(container.findAllByType('h1').length === 1).toBeTruthy(); }); }); diff --git a/client/src/components/app-mount-notifier.test.tsx b/client/src/components/app-mount-notifier.test.tsx index ababbe5a39..240a42dd71 100644 --- a/client/src/components/app-mount-notifier.test.tsx +++ b/client/src/components/app-mount-notifier.test.tsx @@ -42,6 +42,7 @@ describe('AppMountNotifier', () => { setup(langCode); await waitFor(() => { + /* eslint-disable-next-line testing-library/no-node-access */ expect(document.querySelector('html')).toHaveAttribute( 'lang', langCode diff --git a/client/src/components/formHelpers/Form.test.js b/client/src/components/formHelpers/Form.test.js index 1dbb3a57f0..d61660efee 100644 --- a/client/src/components/formHelpers/Form.test.js +++ b/client/src/components/formHelpers/Form.test.js @@ -1,5 +1,5 @@ import React from 'react'; -import { render, fireEvent } from '@testing-library/react'; +import { render, fireEvent, screen } from '@testing-library/react'; import Form from './Form'; @@ -21,17 +21,17 @@ const defaultTestProps = { }; test('should render', () => { - const { getByLabelText, getByText } = render(
); + render(); - const nameInput = getByLabelText(/name Label/); + const nameInput = screen.getByLabelText(/name Label/); expect(nameInput).not.toBeRequired(); expect(nameInput).toHaveAttribute('type', 'text'); - const websiteInput = getByLabelText(/WebSite label/); + const websiteInput = screen.getByLabelText(/WebSite label/); expect(websiteInput).toBeRequired(); expect(websiteInput).toHaveAttribute('type', 'url'); - const button = getByText(/submit/i); + const button = screen.getByText(/submit/i); expect(button).toHaveAttribute('type', 'submit'); expect(button).toBeDisabled(); }); @@ -40,7 +40,7 @@ test('should render with default values', () => { const websiteValue = 'http://mysite.com'; const nameValue = 'John'; - const { getByLabelText, getByText } = render( + render( { /> ); - const nameInput = getByLabelText(/name Label/); + const nameInput = screen.getByLabelText(/name Label/); expect(nameInput).toHaveValue(nameValue); - const websiteInput = getByLabelText(/WebSite label/); + const websiteInput = screen.getByLabelText(/WebSite label/); expect(websiteInput).toHaveValue(websiteValue); - const button = getByText(/submit/i); + const button = screen.getByText(/submit/i); expect(button).toBeEnabled(); }); @@ -66,13 +66,13 @@ test('should submit', () => { }; const websiteValue = 'http://mysite.com'; - const { getByLabelText, getByText } = render(); + render(); - const websiteInput = getByLabelText(/WebSite label/); + const websiteInput = screen.getByLabelText(/WebSite label/); fireEvent.change(websiteInput, { target: { value: websiteValue } }); expect(websiteInput).toHaveValue(websiteValue); - const button = getByText(/submit/i); + const button = screen.getByText(/submit/i); expect(button).toBeEnabled(); fireEvent.click(button); diff --git a/client/src/components/formHelpers/block-save-button.test.tsx b/client/src/components/formHelpers/block-save-button.test.tsx index 6f891e22f6..7324bc006c 100644 --- a/client/src/components/formHelpers/block-save-button.test.tsx +++ b/client/src/components/formHelpers/block-save-button.test.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { render } from '@testing-library/react'; +import { render, screen } from '@testing-library/react'; import BlockSaveButton from './block-save-button'; @@ -10,14 +10,14 @@ test(' snapshot', () => { }); test('Button text should default to the correct translation key', () => { - const { getByRole } = render(); + render(); - expect(getByRole('button')).toHaveTextContent('buttons.save'); + expect(screen.getByRole('button')).toHaveTextContent('buttons.save'); }); test('Button text should match "children"', () => { const testText = 'My Text Here'; - const { getByRole } = render({testText}); + render({testText}); - expect(getByRole('button')).toHaveTextContent(testText); + expect(screen.getByRole('button')).toHaveTextContent(testText); }); diff --git a/client/src/components/helpers/__snapshots__/loader.test.tsx.snap b/client/src/components/helpers/__snapshots__/loader.test.tsx.snap index 2008f8e0aa..6dab24a565 100644 --- a/client/src/components/helpers/__snapshots__/loader.test.tsx.snap +++ b/client/src/components/helpers/__snapshots__/loader.test.tsx.snap @@ -3,6 +3,7 @@ exports[` matches the fullScreen render snapshot 1`] = `
matches the fullScreen render snapshot 1`] = ` exports[` matches to the default render snapshot 1`] = `
', () => { }); it('adds the correct class when given a fullScreen prop', () => { - const { container } = render(); - expect(container.firstChild).toHaveClass('full-screen-wrapper'); + render(); + const fccLoader = screen.getByTestId('fcc-loader'); + expect(fccLoader).toHaveClass('full-screen-wrapper'); }); /** @@ -22,12 +23,14 @@ describe('', () => { */ it('matches to the default render snapshot', () => { - const { container } = render(); - expect(container.firstChild).toMatchSnapshot(); + render(); + const fccLoader = screen.getByTestId('fcc-loader'); + expect(fccLoader).toMatchSnapshot(); }); it('matches the fullScreen render snapshot', () => { - const { container } = render(); - expect(container.firstChild).toMatchSnapshot(); + render(); + const fccLoader = screen.getByTestId('fcc-loader'); + expect(fccLoader).toMatchSnapshot(); }); }); diff --git a/client/src/components/helpers/loader.tsx b/client/src/components/helpers/loader.tsx index e39561e7d9..9e5aa9b2aa 100644 --- a/client/src/components/helpers/loader.tsx +++ b/client/src/components/helpers/loader.tsx @@ -17,7 +17,10 @@ function Loader({ fullScreen, timeout }: LoaderProps): JSX.Element { return () => clearTimeout(timerId); }, [setShowSpinner, showSpinner, timeout]); return ( -
+
{showSpinner && }
); diff --git a/client/src/components/landing/Landing.test.js b/client/src/components/landing/Landing.test.js index b4fe430a57..9e4e5a26b1 100644 --- a/client/src/components/landing/Landing.test.js +++ b/client/src/components/landing/Landing.test.js @@ -10,8 +10,8 @@ describe('', () => { it('renders when visiting index page and logged out', () => { const shallow = new ShallowRenderer(); shallow.render(); - const result = shallow.getRenderOutput(); - expect(result.type.displayName === 'Landing').toBeTruthy(); + const view = shallow.getRenderOutput(); + expect(view.type.displayName === 'Landing').toBeTruthy(); }); }); diff --git a/client/src/components/profile/Profile.test.tsx b/client/src/components/profile/Profile.test.tsx index b18ce9f08a..224cfd751f 100644 --- a/client/src/components/profile/Profile.test.tsx +++ b/client/src/components/profile/Profile.test.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { render } from '@testing-library/react'; +import { render, screen } from '@testing-library/react'; import Profile from './Profile'; @@ -55,9 +55,9 @@ const notMyProfileProps = { describe('', () => { it('renders the report button on another persons profile', () => { - const { getByText } = render(); + render(); - const reportButton: HTMLElement = getByText('buttons.flag-user'); + const reportButton: HTMLElement = screen.getByText('buttons.flag-user'); expect(reportButton).toHaveAttribute('href', '/user/string/report-user'); }); diff --git a/client/src/components/profile/components/HeatMap.test.tsx b/client/src/components/profile/components/HeatMap.test.tsx index 99cf53bea7..61ff1d4649 100644 --- a/client/src/components/profile/components/HeatMap.test.tsx +++ b/client/src/components/profile/components/HeatMap.test.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { render } from '@testing-library/react'; +import { render, screen } from '@testing-library/react'; import HeatMap from './HeatMap'; @@ -41,15 +41,15 @@ describe('', () => { */ it('calculates the correct longest streak', () => { - const { getByTestId } = render(); - expect(getByTestId('longest-streak').textContent).toContain( + render(); + expect(screen.getByTestId('longest-streak')).toHaveTextContent( 'profile.longest-streak' ); }); it('calculates the correct current streak', () => { - const { getByTestId } = render(); - expect(getByTestId('current-streak').textContent).toContain( + render(); + expect(screen.getByTestId('current-streak')).toHaveTextContent( 'profile.current-streak' ); }); diff --git a/client/src/components/profile/components/TimeLine.test.tsx b/client/src/components/profile/components/TimeLine.test.tsx index 2c57aaedcf..966911d5b9 100644 --- a/client/src/components/profile/components/TimeLine.test.tsx +++ b/client/src/components/profile/components/TimeLine.test.tsx @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ /* eslint-disable @typescript-eslint/no-unsafe-call */ import React from 'react'; -import { render } from '@testing-library/react'; +import { render, screen } from '@testing-library/react'; import TimeLine from './TimeLine'; import { useStaticQuery } from 'gatsby'; @@ -45,29 +45,25 @@ beforeEach(() => { describe('', () => { it('Render button when only solution is present', () => { // @ts-ignore - const { container } = render(); - - expect( - container.querySelector('#btn-for-5e46f802ac417301a38fb92b') - ).toHaveAttribute('href', 'https://github.com/freeCodeCamp/freeCodeCamp'); + render(); + const showViewButton = screen.getByRole('link', { name: 'buttons.view' }); + expect(showViewButton).toHaveAttribute( + 'href', + 'https://github.com/freeCodeCamp/freeCodeCamp' + ); }); it('Render button when both githubLink and solution is present', () => { // @ts-ignore - const { container } = render(); + render(); - const linkList = container.querySelector( - '#dropdown-for-5e4f5c4b570f7e3a4949899f + ul' - ); - // @ts-ignore - const links = linkList.querySelectorAll('a'); - - expect(links[0]).toHaveAttribute( + const menuItems = screen.getAllByRole('menuitem'); + expect(menuItems).toHaveLength(2); + expect(menuItems[0]).toHaveAttribute( 'href', 'https://github.com/freeCodeCamp/freeCodeCamp1' ); - - expect(links[1]).toHaveAttribute( + expect(menuItems[1]).toHaveAttribute( 'href', 'https://github.com/freeCodeCamp/freeCodeCamp2' ); @@ -75,9 +71,9 @@ describe('', () => { it('rendering the correct button when files is present', () => { // @ts-ignore - const { getByText } = render(); + render(); - const button = getByText('buttons.show-code'); + const button = screen.getByText('buttons.show-code'); expect(button).toBeInTheDocument(); }); }); diff --git a/client/src/components/search/searchBar/SearchBar.test.tsx b/client/src/components/search/searchBar/SearchBar.test.tsx index 8363083af7..bbbed09661 100644 --- a/client/src/components/search/searchBar/SearchBar.test.tsx +++ b/client/src/components/search/searchBar/SearchBar.test.tsx @@ -5,10 +5,10 @@ import { SearchBar } from './search-bar'; describe('', () => { it('renders to the DOM', () => { - const shallow = ShallowRenderer.createRenderer(); - shallow.render(); - const result = shallow.getRenderOutput(); - expect(result).toBeTruthy(); + const utils = ShallowRenderer.createRenderer(); + utils.render(); + const view = utils.getRenderOutput(); + expect(view).toBeTruthy(); }); /* Todo: When e2e testing is in place, diff --git a/client/src/components/settings/Certification.test.js b/client/src/components/settings/Certification.test.js index cdf10fd4e9..bc6ad4d0c8 100644 --- a/client/src/components/settings/Certification.test.js +++ b/client/src/components/settings/Certification.test.js @@ -1,5 +1,5 @@ import React from 'react'; -import { render } from '@testing-library/react'; +import { render, screen } from '@testing-library/react'; import { Provider } from 'react-redux'; import { createStore } from '../../redux/createStore'; @@ -15,75 +15,64 @@ describe('', () => { // shallow rendering does not render children component // form buttons are not included in shallow render it('Should render show cert button for claimed legacy cert', () => { - const { container } = renderWithRedux( - - ); + renderWithRedux(); expect( - container.querySelector( - 'a[href="/certification/developmentuser/legacy-data-visualization"]' - ) - ).toHaveTextContent('buttons.show-cert'); - }); - - it('Should link show cert button to the claimed legacy cert', () => { - const { container } = renderWithRedux( - + screen.getByRole('link', { + name: 'buttons.show-cert' + }) + ).toHaveAttribute( + 'href', + '/certification/developmentuser/legacy-data-visualization' ); - - expect( - container.querySelector( - 'a[href="/certification/developmentuser/legacy-data-visualization"]' - ) - ).toBeInTheDocument(); }); // full forms with unclaimed certs should not shallow render show cert button it('Should not render show cert button for unclaimed cert with completed projects', () => { - const { container } = renderWithRedux( - - ); + renderWithRedux(); - expect( - container.querySelector( - 'a[href="/certification/developmentuser/legacy-back-end"]' - ) - ).not.toHaveTextContent('buttons.show-cert'); + const allClaimedCerts = screen.getAllByRole('link', { + name: 'buttons.show-cert' + }); + + allClaimedCerts.forEach(cert => { + expect(cert).not.toHaveAttribute( + 'href', + '/certification/developmentuser/legacy-back-end' + ); + }); }); // empty forms with unclaimed certs should not shallow render show cert button it('Should not render show cert button for cert with no completed projects', () => { - const { container } = renderWithRedux( - - ); + renderWithRedux(); - expect( - container.querySelector( - 'a[href="/certification/developmentuser/legacy-front-end"]' - ) - ).not.toHaveTextContent('buttons.show-cert'); + const allClaimedCerts = screen.getAllByRole('link', { + name: 'buttons.show-cert' + }); + + allClaimedCerts.forEach(cert => { + expect(cert).not.toHaveAttribute( + 'href', + '/certification/developmentuser/legacy-front-end' + ); + }); }); it('Render button when only solution is present', () => { - const { container } = renderWithRedux( - - ); + renderWithRedux(); expect( - container.querySelector('#btn-for-5e46f802ac417301a38fb92b') + screen.getByRole('link', { + name: 'buttons.show-solution' + }) ).toHaveAttribute('href', 'https://github.com/freeCodeCamp/freeCodeCamp'); }); it('Render button when both githubLink and solution is present', () => { - const { container } = renderWithRedux( - - ); - - const linkList = container.querySelector( - '#dropdown-for-5e4f5c4b570f7e3a4949899f + ul' - ); - const links = linkList.querySelectorAll('a'); + renderWithRedux(); + const links = screen.getAllByRole('menuitem'); expect(links[0]).toHaveAttribute( 'href', 'https://github.com/freeCodeCamp/freeCodeCamp1' @@ -96,11 +85,9 @@ describe('', () => { }); it('rendering the correct button when files is present', () => { - const { getByText } = renderWithRedux( - - ); + renderWithRedux(); - const button = getByText('buttons.show-code'); + const button = screen.getByText('buttons.show-code'); expect(button).toBeInTheDocument(); }); }); diff --git a/client/src/components/settings/Honesty.test.js b/client/src/components/settings/Honesty.test.js index 6ae2884e4e..7cd60a56e7 100644 --- a/client/src/components/settings/Honesty.test.js +++ b/client/src/components/settings/Honesty.test.js @@ -13,16 +13,16 @@ describe('', () => { const componentToRender = ( ); - const component = renderer.render(componentToRender); - expect(component).toMatchSnapshot('Honesty'); + const view = renderer.render(componentToRender); + expect(view).toMatchSnapshot('Honesty'); }); test(' snapshot when isHonest is true', () => { const componentToRender = ( ); - const component = renderer.render(componentToRender); - expect(component).toMatchSnapshot('HonestyAccepted'); + const view = renderer.render(componentToRender); + expect(view).toMatchSnapshot('HonestyAccepted'); }); test('should call updateIsHonest method on clicking agree button', () => { @@ -30,6 +30,11 @@ describe('', () => { ).root; + /** + * This rules had to be disabled because the new lint rules are throwing false positives here. + * They were interpreting react-test-renderer functions as @testing-library/react functions. + */ + // eslint-disable-next-line testing-library/await-async-query root.findByType(Button).props.onClick(); expect(updateIsHonestMock).toHaveBeenCalledWith({ isHonest: true }); }); diff --git a/client/src/templates/Challenges/components/__snapshots__/completion-modal-body.test.tsx.snap b/client/src/templates/Challenges/components/__snapshots__/completion-modal-body.test.tsx.snap index 5e9fe99584..731152dc19 100644 --- a/client/src/templates/Challenges/components/__snapshots__/completion-modal-body.test.tsx.snap +++ b/client/src/templates/Challenges/components/__snapshots__/completion-modal-body.test.tsx.snap @@ -12,6 +12,7 @@ exports[` matches snapshot 1`] = ` matches snapshot 1`] = `
', () => { }); test('renders with 0% width initially', () => { - const { container } = render(); - expect(container.querySelector('.progress-bar-percent')).toHaveAttribute( - 'style', - 'width: 0%;' - ); + render(); + expect(screen.getByTestId('fcc-progress-bar-percent')).toHaveStyle({ + width: '0%' + }); }); test('has the correct width after animation', () => { - const { container } = render(); + render(); - fireEvent.animationEnd( - container.querySelector('.completion-success-icon') as HTMLElement - ); + fireEvent.animationEnd(screen.getByTestId('fcc-completion-success-icon')); jest.runAllTimers(); - expect(container.querySelector('.progress-bar-percent')).toHaveAttribute( - 'style', - `width: ${props.completedPercent}%;` - ); + expect(screen.getByTestId('fcc-progress-bar-percent')).toHaveStyle({ + width: `${props.completedPercent}%` + }); }); }); }); diff --git a/client/src/templates/Challenges/components/completion-modal-body.tsx b/client/src/templates/Challenges/components/completion-modal-body.tsx index a6e0541b65..a1b4196959 100644 --- a/client/src/templates/Challenges/components/completion-modal-body.tsx +++ b/client/src/templates/Challenges/components/completion-modal-body.tsx @@ -77,6 +77,7 @@ export class CompletionModalBody extends PureComponent<
{ setTimeout(() => { this.animateProgressBar(completedPercent); @@ -94,6 +95,7 @@ export class CompletionModalBody extends PureComponent<
diff --git a/client/utils/gatsby/layoutSelector.test.js b/client/utils/gatsby/layoutSelector.test.js index 728feca9ab..e4da7366d5 100644 --- a/client/utils/gatsby/layoutSelector.test.js +++ b/client/utils/gatsby/layoutSelector.test.js @@ -22,10 +22,10 @@ function getComponentNameAndProps(elementType, pathname) { } }); shallow.render({LayoutReactComponent}); - const renderedComponent = shallow.getRenderOutput(); + const view = shallow.getRenderOutput(); return { - props: renderedComponent.props, - name: renderedComponent.type.WrappedComponent.displayName + props: view.props, + name: view.type.WrappedComponent.displayName }; }