diff --git a/src/__tests__/pages/_error.test.tsx b/src/__tests__/pages/_error.test.tsx index 81d2fa419..b3c2a89c1 100644 --- a/src/__tests__/pages/_error.test.tsx +++ b/src/__tests__/pages/_error.test.tsx @@ -29,7 +29,7 @@ describe('custom error page', () => { render() }) - it('renders the custom error page,', () => { + test('renders the custom error page,', () => { expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent('1024') expect(screen.getByRole('heading', { level: 2 })).toHaveTextContent( 'Houston, we have a problem' @@ -39,7 +39,7 @@ describe('custom error page', () => { ) }) - it('renders a back button', async () => { + test('renders a back button', async () => { const user = userEvent.setup() const backButton = screen.getByRole('button', { @@ -51,7 +51,7 @@ describe('custom error page', () => { expect(mockBack).toHaveBeenCalled() }) - it('renders feedback links', async () => { + test('renders feedback links', async () => { const feedbackLink = screen.getByText('feedback@ussforbit.us') expect(feedbackLink).toBeVisible() expect(feedbackLink).toHaveAttribute('href') @@ -71,7 +71,7 @@ describe('custom error page', () => { ) }) - it('tests getInitialProps', async () => { + test('tests getInitialProps', async () => { const getInitialProps = CustomError.getInitialProps expect(getInitialProps).toBeDefined() expect(getInitialProps).toBeInstanceOf(Function) @@ -82,7 +82,7 @@ describe('custom error page', () => { expect(result).toEqual({ statusCode: 404 }) }) - it('tests getInitialProps with no statusCode', async () => { + test('tests getInitialProps with no statusCode', async () => { const getInitialProps = CustomError.getInitialProps expect(getInitialProps).toBeDefined() expect(getInitialProps).toBeInstanceOf(Function) @@ -145,7 +145,7 @@ describe('custom error page without status code', () => { render() }) - it('renders the custom error page,', () => { + test('renders the custom error page,', () => { expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent('500') }) }) diff --git a/src/__tests__/pages/login-notice.test.tsx b/src/__tests__/pages/login-notice.test.tsx index 66cb1afe8..8fb7f8541 100644 --- a/src/__tests__/pages/login-notice.test.tsx +++ b/src/__tests__/pages/login-notice.test.tsx @@ -11,22 +11,22 @@ describe('LoginNotice page', () => { render() }) - it('renders the login notice', () => { + test('renders the login notice', () => { expect(screen.getByRole('heading', { level: 3 })).toHaveTextContent( 'Notice' ) }) - it('renders the agree button', () => { + test('renders the agree button', () => { expect(screen.getByRole('link')).toHaveTextContent('I agree') }) - it('returns the LoginLayout in getLayout', () => { + test('returns the LoginLayout in getLayout', () => { const page = 'page' expect(LoginNotice.getLayout(page)).toEqual(page) }) - it('returns the expected props in getServerSideProps', async () => { + test('returns the expected props in getServerSideProps', async () => { const response = await getStaticProps() expect(response).toEqual({ props: { diff --git a/src/__tests__/pages/update-browser.test.tsx b/src/__tests__/pages/update-browser.test.tsx index a8724099e..819f9c33b 100644 --- a/src/__tests__/pages/update-browser.test.tsx +++ b/src/__tests__/pages/update-browser.test.tsx @@ -15,7 +15,7 @@ describe('Update browser page', () => { render() }) - it('renders the update browser page,', () => { + test('renders the update browser page,', () => { expect(screen.getByRole('heading', { level: 2 })).toHaveTextContent( 'I’m sorry, Dave. I’m afraid you can’t use that outdated browser.' ) @@ -34,7 +34,7 @@ describe('Update browser page', () => { ).toHaveAttribute('href', FIREFOX_DOWNLOAD) }) - it('has no a11y violations', async () => { + test('has no a11y violations', async () => { // Bug with NextJS Link + axe :( // https://github.com/nickcolley/jest-axe/issues/95#issuecomment-758921334 await act(async () => { @@ -43,7 +43,7 @@ describe('Update browser page', () => { }) }) - it('returns the ErrorLayout in getLayout', () => { + test('returns the ErrorLayout in getLayout', () => { const page = 'page' expect(UpdateBrowser.getLayout(page)).toEqual( @@ -52,7 +52,7 @@ describe('Update browser page', () => { ) }) - it('returns the expected props in getServerSideProps', async () => { + test('returns the expected props in getServerSideProps', async () => { const response = await getStaticProps() expect(response).toEqual({ props: { diff --git a/src/components/AnnouncementDate/AnnouncementDate.test.tsx b/src/components/AnnouncementDate/AnnouncementDate.test.tsx index 9d91310f1..1b63cdfbf 100644 --- a/src/components/AnnouncementDate/AnnouncementDate.test.tsx +++ b/src/components/AnnouncementDate/AnnouncementDate.test.tsx @@ -9,7 +9,7 @@ import React from 'react' import AnnouncementDate from './AnnouncementDate' describe('AnnouncementDate component', () => { - it('renders the component', () => { + test('renders the component', () => { render() expect(screen.getByText('17 MAY')).toBeInTheDocument() diff --git a/src/components/ArticleDateIcon/ArticleDateIcon.test.tsx b/src/components/ArticleDateIcon/ArticleDateIcon.test.tsx index 894595bdc..d5c9420fb 100644 --- a/src/components/ArticleDateIcon/ArticleDateIcon.test.tsx +++ b/src/components/ArticleDateIcon/ArticleDateIcon.test.tsx @@ -9,20 +9,20 @@ import React from 'react' import { ArticleDateIcon } from './ArticleDateIcon' describe('ArticleDateIcon component', () => { - it('renders the given date', async () => { + test('renders the given date', async () => { const testDate = new Date('May 16 2022') render() expect(screen.getByText('May')).toBeInTheDocument() expect(screen.getByText('16')).toBeInTheDocument() }) - it('has no a11y violations', async () => { + test('has no a11y violations', async () => { const testDate = new Date('May 16 2022') const { container } = render() expect(await axe(container)).toHaveNoViolations() }) - it('renders null if the given date is invalid', async () => { + test('renders null if the given date is invalid', async () => { const invalidDate = 'May 16 2022' as unknown as Date const result = render() diff --git a/src/components/ArticleList/ArticleList.test.tsx b/src/components/ArticleList/ArticleList.test.tsx index 91ecd4ca8..d3ff8a173 100644 --- a/src/components/ArticleList/ArticleList.test.tsx +++ b/src/components/ArticleList/ArticleList.test.tsx @@ -21,14 +21,14 @@ const testArticle = { const testArticles = [testArticle, testArticle, testArticle] describe('ArticleList component', () => { - it('renders a list of articles', () => { + test('renders a list of articles', () => { render() expect(screen.getByRole('list')).toBeInTheDocument() expect(screen.getAllByRole('listitem')).toHaveLength(3) }) - it('displays the Pagination component if pagination props are passed in', async () => { + test('displays the Pagination component if pagination props are passed in', async () => { render( { expect(screen.getByRole('link', { name: 'Page 2' })).toBeInTheDocument() }) - it('has no a11y violations', async () => { + test('has no a11y violations', async () => { // Bug with NextJS Link + axe :( // https://github.com/nickcolley/jest-axe/issues/95#issuecomment-758921334 await act(async () => { @@ -52,7 +52,7 @@ describe('ArticleList component', () => { }) }) - it('renders an empty state', () => { + test('renders an empty state', () => { render() expect(screen.queryByRole('list')).not.toBeInTheDocument() diff --git a/src/components/ArticleListItem/ArticleListItem.test.tsx b/src/components/ArticleListItem/ArticleListItem.test.tsx index 999bb1318..b9113ed8d 100644 --- a/src/components/ArticleListItem/ArticleListItem.test.tsx +++ b/src/components/ArticleListItem/ArticleListItem.test.tsx @@ -32,7 +32,7 @@ const rssTestArticle = { } describe('ArticleListItem component', () => { - it('renders the article preview of a cms article', () => { + test('renders the article preview of a cms article', () => { render() expect(screen.getByText('May')).toBeInTheDocument() @@ -43,7 +43,7 @@ describe('ArticleListItem component', () => { expect(screen.getByText('CMS Test Label')).toBeInTheDocument() }) - it('cms article has no a11y violations', async () => { + test('cms article has no a11y violations', async () => { // Bug with NextJS Link + axe :( // https://github.com/nickcolley/jest-axe/issues/95#issuecomment-758921334 await act(async () => { @@ -52,7 +52,7 @@ describe('ArticleListItem component', () => { }) }) - it('renders the article preview of an rss article', () => { + test('renders the article preview of an rss article', () => { render() expect(screen.getByText('Aug')).toBeInTheDocument() @@ -63,7 +63,7 @@ describe('ArticleListItem component', () => { expect(screen.getByText(rssTestArticle.sourceName)).toBeInTheDocument() }) - it('rss article has no a11y violations', async () => { + test('rss article has no a11y violations', async () => { // Bug with NextJS Link + axe :( // https://github.com/nickcolley/jest-axe/issues/95#issuecomment-758921334 await act(async () => { @@ -72,7 +72,7 @@ describe('ArticleListItem component', () => { }) }) - it('renders the article preview of an rss article', () => { + test('renders the article preview of an rss article', () => { render() expect(screen.getByText('Aug')).toBeInTheDocument() diff --git a/src/components/BreadcrumbNav/BreadcrumbNav.test.tsx b/src/components/BreadcrumbNav/BreadcrumbNav.test.tsx index a773cc436..7ca89c5f3 100644 --- a/src/components/BreadcrumbNav/BreadcrumbNav.test.tsx +++ b/src/components/BreadcrumbNav/BreadcrumbNav.test.tsx @@ -25,7 +25,7 @@ describe('BreadcrumbNav component', () => { render() }) - it('renders links for the non-current nav items', () => { + test('renders links for the non-current nav items', () => { const links = screen.getAllByRole('link') expect(links).toHaveLength(1) @@ -33,7 +33,7 @@ describe('BreadcrumbNav component', () => { expect(links[0]).toHaveTextContent(navItems[0].label) }) - it('renders the current item as static text', () => { + test('renders the current item as static text', () => { expect(screen.getByText('News & Announcements')).toBeInstanceOf( HTMLLIElement ) diff --git a/src/components/Collection/Collection.test.tsx b/src/components/Collection/Collection.test.tsx index 10aee4fcb..91eb912cf 100644 --- a/src/components/Collection/Collection.test.tsx +++ b/src/components/Collection/Collection.test.tsx @@ -29,18 +29,18 @@ describe('Collection component', () => { ) }) - it('renders a title', () => { + test('renders a title', () => { const title = screen.getByRole('heading', { level: 2 }) expect(title).toHaveTextContent('Example collection') }) - it('renders its children in a list', () => { + test('renders its children in a list', () => { expect(screen.getByRole('list')).toBeInTheDocument() expect(screen.getAllByRole('listitem')).toHaveLength(3) expect(screen.getAllByRole('link')).toHaveLength(3) }) - it('has no a11y violations', async () => { + test('has no a11y violations', async () => { // Bug with NextJS Link + axe :( // https://github.com/nickcolley/jest-axe/issues/95#issuecomment-758921334 await act(async () => { @@ -49,7 +49,7 @@ describe('Collection component', () => { }) }) - it('can render a single child', async () => { + test('can render a single child', async () => { html = render( @@ -67,7 +67,7 @@ describe('Collection component', () => { }) }) - it('can render a footer node', async () => { + test('can render a footer node', async () => { const testFooter =

Collection footer

html = render( diff --git a/src/components/CustomCollection/CustomCollection.test.tsx b/src/components/CustomCollection/CustomCollection.test.tsx index 685aee3e1..4b295e386 100644 --- a/src/components/CustomCollection/CustomCollection.test.tsx +++ b/src/components/CustomCollection/CustomCollection.test.tsx @@ -180,7 +180,7 @@ describe('CustomCollection component', () => { scrollSpy.mockReset() }) - it('renders the collection with DndContext', async () => { + test('renders the collection with DndContext', async () => { render( { ).toBeInTheDocument() }) - it('drags and drops a link with the keyboard', async () => { + test('drags and drops a link with the keyboard', async () => { // This test works because dnd-kit renders a hidden div with an id=DndLiveRegion that is used for screen readers to announce // which bookmark id is being dragged and where it is being dropped. const user = userEvent.setup() @@ -236,7 +236,7 @@ describe('CustomCollection component', () => { ).toBeInTheDocument() }) - it('renders the collection with delete or edit buttons', async () => { + test('renders the collection with delete or edit buttons', async () => { render( { ).toHaveLength(1) }) - it('renders an Add Link toggleable form', async () => { + test('renders an Add Link toggleable form', async () => { const user = userEvent.setup() render( @@ -295,7 +295,7 @@ describe('CustomCollection component', () => { expect(linkInput).toBeValid() }) - it('cancels Add Link action and resets form', async () => { + test('cancels Add Link action and resets form', async () => { const user = userEvent.setup() render( { ).not.toBeInTheDocument() }) - it('can select Add Custom Link and open the Add Custom Link modal', async () => { + test('can select Add Custom Link and open the Add Custom Link modal', async () => { const user = userEvent.setup() const mockAddLink = jest.fn() const mockUpdateModalId = jest.fn() @@ -371,7 +371,7 @@ describe('CustomCollection component', () => { expect(mockUpdateCustomLinkLabel).toHaveBeenCalled() }) - it('can add an existing link', async () => { + test('can add an existing link', async () => { const user = userEvent.setup() const mockAddLink = jest.fn() @@ -396,7 +396,7 @@ describe('CustomCollection component', () => { expect(mockAddLink).toHaveBeenCalledWith('www.example.com/2', 'SURF', '2') }) - it('renders the settings dropdown menu', async () => { + test('renders the settings dropdown menu', async () => { const user = userEvent.setup() render( { expect(editItem).toBeInTheDocument() }) - it('clicking the delete collection button opens the delete modal', async () => { + test('clicking the delete collection button opens the delete modal', async () => { const user = userEvent.setup() const mockUpdateModalId = jest.fn() const mockUpdateModalText = jest.fn() @@ -464,7 +464,7 @@ describe('CustomCollection component', () => { expect(mockUpdateWidget).toHaveBeenCalled() }) - it('clicking outside the dropdown menu closes the menu', async () => { + test('clicking outside the dropdown menu closes the menu', async () => { const user = userEvent.setup() const mockRemoveCollection = jest.fn() @@ -500,7 +500,7 @@ describe('CustomCollection component', () => { expect(deleteCollection).not.toBeInTheDocument() }) - it('clicking the menu button toggles the menu', async () => { + test('clicking the menu button toggles the menu', async () => { const user = userEvent.setup() const mockRemoveCollection = jest.fn() @@ -533,7 +533,7 @@ describe('CustomCollection component', () => { expect(deleteCollection).not.toBeInTheDocument() }) - it('renders the collection with links from the CMS', () => { + test('renders the collection with links from the CMS', () => { const { container } = render( { describe('an empty collection', () => { const user = userEvent.setup() - it('renders a focused input for the title', () => { + test('renders a focused input for the title', () => { render() expect(screen.getByRole('textbox')).toHaveFocus() }) - it('can enter a title', async () => { + test('can enter a title', async () => { const mockEditCollection = jest.fn() render( @@ -571,7 +571,7 @@ describe('CustomCollection component', () => { expect(mockEditCollection).toHaveBeenCalledWith('My New Collection') }) - it('not entering a title deletes the collection', async () => { + test('not entering a title deletes the collection', async () => { const mockDeleteCollection = jest.fn() render( @@ -590,7 +590,7 @@ describe('CustomCollection component', () => { }) describe('with 9 bookmarks', () => { - it('shows a warning when adding the tenth link', async () => { + test('shows a warning when adding the tenth link', async () => { const user = userEvent.setup() renderWithModalRoot( { }) describe('with 10 bookmarks', () => { - it('does not allow adding anymore links', async () => { + test('does not allow adding anymore links', async () => { render( { - it('renders an editable collection title', () => { + test('renders an editable collection title', () => { render( { ).toBeInTheDocument() }) - it('renders a form to edit title if isEditing is true', () => { + test('renders a form to edit title if isEditing is true', () => { render( { }) }) -it('saves the form', async () => { +test('saves the form', async () => { const user = userEvent.setup() const mockHandleOnSave = jest.fn() render( @@ -69,7 +69,7 @@ it('saves the form', async () => { expect(mockHandleOnSave).toBeCalledWith('New Title') }) -it('cancels the form', async () => { +test('cancels the form', async () => { const user = userEvent.setup() const mockHandleOnCancel = jest.fn() render( diff --git a/src/components/CustomCollection/RemovableBookmark.test.tsx b/src/components/CustomCollection/RemovableBookmark.test.tsx index afd0083b0..35d04e374 100644 --- a/src/components/CustomCollection/RemovableBookmark.test.tsx +++ b/src/components/CustomCollection/RemovableBookmark.test.tsx @@ -20,7 +20,7 @@ describe('RemovableBookmark component', () => { jest.useRealTimers() }) - it('renders a bookmark with a delete handler', () => { + test('renders a bookmark with a delete handler', () => { render( ) @@ -31,7 +31,7 @@ describe('RemovableBookmark component', () => { ).toBeInTheDocument() }) - it('renders the bookmark URL if there is no label', () => { + test('renders the bookmark URL if there is no label', () => { const testBookmarkNoLabel = { id: ObjectId(), url: 'https://example.com', @@ -47,7 +47,7 @@ describe('RemovableBookmark component', () => { expect(screen.getByRole('link')).toHaveTextContent(testBookmarkNoLabel.url) }) - it('allows the delete handler to be undone', async () => { + test('allows the delete handler to be undone', async () => { const user = userEvent.setup({ advanceTimers: jest.advanceTimersByTime }) jest.useFakeTimers() @@ -85,7 +85,7 @@ describe('RemovableBookmark component', () => { expect(mockHandleRemove).not.toHaveBeenCalled() }) - it('handles the delete button if not undone', async () => { + test('handles the delete button if not undone', async () => { const user = userEvent.setup({ advanceTimers: jest.advanceTimersByTime }) jest.useFakeTimers() diff --git a/src/components/DropdownMenu/DropdownMenu.test.tsx b/src/components/DropdownMenu/DropdownMenu.test.tsx index 59a833806..6520b653c 100644 --- a/src/components/DropdownMenu/DropdownMenu.test.tsx +++ b/src/components/DropdownMenu/DropdownMenu.test.tsx @@ -30,18 +30,18 @@ describe('Dropdown Menu ', () => { ) }) - it('renders the children of the menu', () => { + test('renders the children of the menu', () => { expect(screen.getAllByRole('listitem')).toHaveLength(3) }) - it('renders the toggle button', async () => { + test('renders the toggle button', async () => { const user = userEvent.setup() expect(screen.getByRole('button')).toHaveTextContent('Toggle Dropdown') await user.click(screen.getByRole('button')) expect(mockOnClick).toHaveBeenCalled() }) - it('has no a11y violations', async () => { + test('has no a11y violations', async () => { expect(await axe(html.container)).toHaveNoViolations() }) }) diff --git a/src/components/EPubsCard/EPubsCard.test.tsx b/src/components/EPubsCard/EPubsCard.test.tsx index e6d380f13..0e4b833da 100644 --- a/src/components/EPubsCard/EPubsCard.test.tsx +++ b/src/components/EPubsCard/EPubsCard.test.tsx @@ -9,7 +9,7 @@ import React from 'react' import EPubsCard from './EPubsCard' describe('EPubsCard component', () => { - it('renders the card', () => { + test('renders the card', () => { render() expect(screen.getAllByText('Looking for a form?')).toHaveLength(1) diff --git a/src/components/FeedbackCard/FeedbackCard.test.tsx b/src/components/FeedbackCard/FeedbackCard.test.tsx index 86ed96086..500b6a516 100644 --- a/src/components/FeedbackCard/FeedbackCard.test.tsx +++ b/src/components/FeedbackCard/FeedbackCard.test.tsx @@ -12,7 +12,7 @@ import FeedbackCard from './FeedbackCard' import * as analyticsHooks from 'stores/analyticsContext' describe('Feedback Card component', () => { - it('renders a feedback card', () => { + test('renders a feedback card', () => { render() expect( @@ -45,7 +45,7 @@ describe('Feedback Card component', () => { render() }) - it("calls trackEvent when clicking 'feedback@ussforbit.us' link", () => { + test("calls trackEvent when clicking 'feedback@ussforbit.us' link", () => { const link = screen.getByRole('link', { name: 'feedback@ussforbit.us' }) fireEvent.click(link) diff --git a/src/components/Footer/Footer.test.tsx b/src/components/Footer/Footer.test.tsx index e296644ff..40a88179b 100644 --- a/src/components/Footer/Footer.test.tsx +++ b/src/components/Footer/Footer.test.tsx @@ -8,7 +8,7 @@ import React from 'react' import Footer from './Footer' describe('Footer component', () => { - it('renders the USSF portal header', () => { + test('renders the USSF portal header', () => { render(