shlink-web-client/test/__helpers__/accessibility.ts

13 lines
376 B
TypeScript
Raw Normal View History

import axe from 'axe-core';
2023-09-30 11:20:28 +03:00
type ContainerWrapper = { container: HTMLElement };
type AccessibilityTestSubject = ContainerWrapper | Promise<ContainerWrapper>;
export const checkAccessibility = async (subject: AccessibilityTestSubject) => {
const { container } = await subject;
const { violations } = await axe.run(container);
2023-09-30 11:20:28 +03:00
expect(violations).toStrictEqual([]);
};