Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
198 changes: 0 additions & 198 deletions src/__tests__/__snapshots__/index.js.snap

This file was deleted.

50 changes: 25 additions & 25 deletions src/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ test('.toBeInTheDOM', () => {
// negative test cases wrapped in throwError assertions for coverage.
expect(() =>
expect(queryByTestId('count-value')).not.toBeInTheDOM(),
).toThrowErrorMatchingSnapshot()
).toThrowError()
expect(() =>
expect(queryByTestId('count-value1')).toBeInTheDOM(),
).toThrowErrorMatchingSnapshot()
).toThrowError()
expect(() =>
expect({thisIsNot: 'an html element'}).toBeInTheDOM(),
).toThrowErrorMatchingSnapshot()
).toThrowError()
})

test('.toHaveTextContent', () => {
Expand All @@ -30,14 +30,14 @@ test('.toHaveTextContent', () => {
expect(queryByTestId('count-value')).not.toHaveTextContent('21')
expect(() =>
expect(queryByTestId('count-value2')).toHaveTextContent('2'),
).toThrowErrorMatchingSnapshot()
).toThrowError()

expect(() =>
expect(queryByTestId('count-value')).toHaveTextContent('3'),
).toThrowErrorMatchingSnapshot()
).toThrowError()
expect(() =>
expect(queryByTestId('count-value')).not.toHaveTextContent('2'),
).toThrowErrorMatchingSnapshot()
).toThrowError()
})

test('.toHaveAttribute', () => {
Expand All @@ -55,22 +55,22 @@ test('.toHaveAttribute', () => {

expect(() =>
expect(queryByTestId('ok-button')).not.toHaveAttribute('disabled'),
).toThrowErrorMatchingSnapshot()
).toThrowError()
expect(() =>
expect(queryByTestId('ok-button')).not.toHaveAttribute('type'),
).toThrowErrorMatchingSnapshot()
).toThrowError()
expect(() =>
expect(queryByTestId('ok-button')).toHaveAttribute('class'),
).toThrowErrorMatchingSnapshot()
).toThrowError()
expect(() =>
expect(queryByTestId('ok-button')).not.toHaveAttribute('type', 'submit'),
).toThrowErrorMatchingSnapshot()
).toThrowError()
expect(() =>
expect(queryByTestId('ok-button')).toHaveAttribute('type', 'button'),
).toThrowErrorMatchingSnapshot()
).toThrowError()
expect(() =>
expect({thisIsNot: 'an html element'}).not.toHaveAttribute(),
).toThrowErrorMatchingSnapshot()
).toThrowError()
})

test('.toHaveClass', () => {
Expand All @@ -95,25 +95,25 @@ test('.toHaveClass', () => {

expect(() =>
expect(queryByTestId('delete-button')).not.toHaveClass('btn'),
).toThrowErrorMatchingSnapshot()
).toThrowError()
expect(() =>
expect(queryByTestId('delete-button')).not.toHaveClass('btn-danger'),
).toThrowErrorMatchingSnapshot()
).toThrowError()
expect(() =>
expect(queryByTestId('delete-button')).not.toHaveClass('extra'),
).toThrowErrorMatchingSnapshot()
).toThrowError()
expect(() =>
expect(queryByTestId('delete-button')).toHaveClass('xtra'),
).toThrowErrorMatchingSnapshot()
).toThrowError()
expect(() =>
expect(queryByTestId('delete-button')).not.toHaveClass('btn btn-danger'),
).toThrowErrorMatchingSnapshot()
).toThrowError()
expect(() =>
expect(queryByTestId('delete-button')).toHaveClass('btn-link'),
).toThrowErrorMatchingSnapshot()
).toThrowError()
expect(() =>
expect(queryByTestId('cancel-button')).toHaveClass('btn-danger'),
).toThrowErrorMatchingSnapshot()
).toThrowError()
})

test('.toHaveStyle', () => {
Expand Down Expand Up @@ -155,20 +155,20 @@ test('.toHaveStyle', () => {

expect(() =>
expect(container.querySelector('.label')).toHaveStyle('font-weight: bold'),
).toThrowErrorMatchingSnapshot()
).toThrowError()
expect(() =>
expect(container.querySelector('.label')).not.toHaveStyle('color: white'),
).toThrowErrorMatchingSnapshot()
).toThrowError()

// Make sure the test fails if the css syntax is not valid
expect(() =>
expect(container.querySelector('.label')).not.toHaveStyle(
'font-weight bold',
),
).toThrowErrorMatchingSnapshot()
).toThrowError()
expect(() =>
expect(container.querySelector('.label')).toHaveStyle('color white'),
).toThrowErrorMatchingSnapshot()
).toThrowError()

document.body.removeChild(style)
document.body.removeChild(container)
Expand Down Expand Up @@ -200,8 +200,8 @@ test('.toBeVisible', () => {

expect(() =>
expect(container.querySelector('header')).not.toBeVisible(),
).toThrowErrorMatchingSnapshot()
).toThrowError()
expect(() =>
expect(container.querySelector('p')).toBeVisible(),
).toThrowErrorMatchingSnapshot()
).toThrowError()
})