Skip to content

Commit

Permalink
chore: Change all remaining it to test (#1224)
Browse files Browse the repository at this point in the history
Change remaining it to test

Co-authored-by: John Gedeon <940173+gidjin@users.noreply.github.com>
Co-authored-by: John Gedeon <john@truss.works>
  • Loading branch information
3 people committed Mar 7, 2024
1 parent 254b456 commit 9211e0a
Show file tree
Hide file tree
Showing 27 changed files with 104 additions and 104 deletions.
12 changes: 6 additions & 6 deletions src/__tests__/pages/_error.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('custom error page', () => {
render(<CustomError statusCode={1024} />)
})

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'
Expand All @@ -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', {
Expand All @@ -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')
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -145,7 +145,7 @@ describe('custom error page without status code', () => {
render(<CustomError />)
})

it('renders the custom error page,', () => {
test('renders the custom error page,', () => {
expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent('500')
})
})
8 changes: 4 additions & 4 deletions src/__tests__/pages/login-notice.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ describe('LoginNotice page', () => {
render(<LoginNotice />)
})

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(<LoginLayout>page</LoginLayout>)
})

it('returns the expected props in getServerSideProps', async () => {
test('returns the expected props in getServerSideProps', async () => {
const response = await getStaticProps()
expect(response).toEqual({
props: {
Expand Down
8 changes: 4 additions & 4 deletions src/__tests__/pages/update-browser.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('Update browser page', () => {
render(<UpdateBrowser />)
})

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.'
)
Expand All @@ -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 () => {
Expand All @@ -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(
<ErrorLayout hideNav={true} ieCompat={true}>
Expand All @@ -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: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/AnnouncementDate/AnnouncementDate.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import React from 'react'
import AnnouncementDate from './AnnouncementDate'

describe('AnnouncementDate component', () => {
it('renders the component', () => {
test('renders the component', () => {
render(<AnnouncementDate date="2022-05-17T13:44:39.796Z" />)

expect(screen.getByText('17 MAY')).toBeInTheDocument()
Expand Down
6 changes: 3 additions & 3 deletions src/components/ArticleDateIcon/ArticleDateIcon.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(<ArticleDateIcon date={testDate} />)
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(<ArticleDateIcon date={testDate} />)
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(<ArticleDateIcon date={invalidDate} />)

Expand Down
8 changes: 4 additions & 4 deletions src/components/ArticleList/ArticleList.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(<ArticleList articles={testArticles} />)

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(
<ArticleList
articles={testArticles}
Expand All @@ -43,7 +43,7 @@ describe('ArticleList component', () => {
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 () => {
Expand All @@ -52,7 +52,7 @@ describe('ArticleList component', () => {
})
})

it('renders an empty state', () => {
test('renders an empty state', () => {
render(<ArticleList articles={[]} />)

expect(screen.queryByRole('list')).not.toBeInTheDocument()
Expand Down
10 changes: 5 additions & 5 deletions src/components/ArticleListItem/ArticleListItem.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(<ArticleListItem article={cmsTestArticle} />)

expect(screen.getByText('May')).toBeInTheDocument()
Expand All @@ -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 () => {
Expand All @@ -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(<ArticleListItem article={rssTestArticle} />)

expect(screen.getByText('Aug')).toBeInTheDocument()
Expand All @@ -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 () => {
Expand All @@ -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(<ArticleListItem article={rssTestArticle} />)

expect(screen.getByText('Aug')).toBeInTheDocument()
Expand Down
4 changes: 2 additions & 2 deletions src/components/BreadcrumbNav/BreadcrumbNav.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ describe('BreadcrumbNav component', () => {
render(<BreadcrumbNav navItems={navItems} />)
})

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)
expect(links[0]).toHaveAttribute('href', navItems[0].path)
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
)
Expand Down
10 changes: 5 additions & 5 deletions src/components/Collection/Collection.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand All @@ -49,7 +49,7 @@ describe('Collection component', () => {
})
})

it('can render a single child', async () => {
test('can render a single child', async () => {
html = render(
<Collection title="Example collection">
<Bookmark key="link1" href="#">
Expand All @@ -67,7 +67,7 @@ describe('Collection component', () => {
})
})

it('can render a footer node', async () => {
test('can render a footer node', async () => {
const testFooter = <p>Collection footer</p>

html = render(
Expand Down
Loading

0 comments on commit 9211e0a

Please sign in to comment.