Skip to content

Commit

Permalink
test: use jest jsdom matchers
Browse files Browse the repository at this point in the history
  • Loading branch information
isqua committed Oct 24, 2023
1 parent 13758c9 commit d11b242
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/components/OptionalLink/OptionalLink.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ describe('components/OptionalLink', () => {
})

expect(screen.getByText(text).tagName).toEqual('A')
expect(screen.getByText(text).getAttribute('href')).toEqual(href)
expect(Array.from(screen.getByText(text).classList)).toContain(className)
expect(screen.getByText(text)).toHaveAttribute('href')
expect(screen.getByText(text)).toHaveClass(className)
})

it('should render a text if to prop is empty string', () => {
Expand All @@ -28,8 +28,8 @@ describe('components/OptionalLink', () => {
})

expect(screen.getByText(text).tagName).not.toEqual('A')
expect(screen.getByText(text).getAttribute('href')).toBeNull()
expect(Array.from(screen.getByText(text).classList)).toContain(className)
expect(screen.getByText(text)).not.toHaveAttribute('href')
expect(screen.getByText(text)).toHaveClass(className)
})

it('should render a text if to prop is undefined', () => {
Expand All @@ -40,7 +40,7 @@ describe('components/OptionalLink', () => {
})

expect(screen.getByText(text).tagName).not.toEqual('A')
expect(screen.getByText(text).getAttribute('href')).toBeNull()
expect(screen.getByText(text)).not.toHaveAttribute('href')
})

it('should call an onClick callback for text', () => {
Expand Down

0 comments on commit d11b242

Please sign in to comment.