-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(button-cluster-module): add unit tests (#867)
* test(button-cluster-module): add unit tests * chore: merge `dev` into `button-cluster-module-tests`
- Loading branch information
1 parent
9eb540c
commit b3c3432
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
src/components/LayoutModules/ButtonClusterModule/__tests__/ButtonClusterModule.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* @file Button cluster module tests. | ||
* @copyright IBM Security 2020 | ||
*/ | ||
|
||
import { render } from '@testing-library/react'; | ||
import React from 'react'; | ||
|
||
import { ButtonClusterModule } from '../../../..'; | ||
|
||
const { name } = ButtonClusterModule; | ||
|
||
describe(name, () => { | ||
test('has no accessibility violations', async () => { | ||
const { container } = render( | ||
<ButtonClusterModule>{name}</ButtonClusterModule> | ||
); | ||
|
||
await expect(container).toHaveNoAxeViolations(); | ||
await expect(container).toHaveNoDAPViolations(name); | ||
}); | ||
|
||
test(`adds content for the '${name}'`, () => { | ||
expect( | ||
render(<ButtonClusterModule>{name}</ButtonClusterModule>).getByText(name) | ||
).toBeInTheDocument(); | ||
}); | ||
|
||
test('adds additional props to the containing node', () => { | ||
const dataTestId = 'dataTestId'; | ||
|
||
expect( | ||
render( | ||
<ButtonClusterModule data-testid={dataTestId}> | ||
{name} | ||
</ButtonClusterModule> | ||
).getByTestId(dataTestId) | ||
).toBeInTheDocument(); | ||
}); | ||
}); |