Skip to content

Commit

Permalink
test(button-cluster-module): add unit tests (#867)
Browse files Browse the repository at this point in the history
* test(button-cluster-module): add unit tests

* chore: merge `dev` into `button-cluster-module-tests`
  • Loading branch information
SimonFinney authored Jun 10, 2021
1 parent 9eb540c commit b3c3432
Showing 1 changed file with 40 additions and 0 deletions.
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();
});
});

0 comments on commit b3c3432

Please sign in to comment.