Skip to content

Commit

Permalink
add in test for the error message
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholas-codecov committed Oct 28, 2024
1 parent 320ba7d commit ef02ef5
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -339,4 +339,25 @@ describe('FileDiff', () => {
expect(calcMode).toBeInTheDocument()
})
})

describe('when path is undefined', () => {
it('renders an error message', async () => {
setup({})
render(<FileDiff path={undefined} />, { wrapper })

const errorMessage = await screen.findByText(
/There was a problem getting the source code from your provider./
)
expect(errorMessage).toBeInTheDocument()
})

it('renders a login link', async () => {
setup({})
render(<FileDiff path={undefined} />, { wrapper })

const loginLink = await screen.findByRole('link', { name: /logging in/ })
expect(loginLink).toBeInTheDocument()
expect(loginLink).toHaveAttribute('href', '/login')
})
})
})

0 comments on commit ef02ef5

Please sign in to comment.