Skip to content

Instantly share code, notes, and snippets.

@olarclara
Created May 26, 2018 01:15
Show Gist options
  • Save olarclara/acb2ca69e0d82292bdcf156ce2448384 to your computer and use it in GitHub Desktop.
Save olarclara/acb2ca69e0d82292bdcf156ce2448384 to your computer and use it in GitHub Desktop.
import React from 'react';
import { renderToString } from 'react-dom/server';
import { axe, toHaveNoViolations } from 'jest-axe';
import Component from '/path';
expect.extend(toHaveNoViolations);
it('should have no a11y violations', async () => {
const wrapper = renderToString(<Component />);
const results = await axe(wrapper);
expect(results).toHaveNoViolations;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment