Skip to content
Haz edited this page Mar 27, 2017 · 3 revisions

ARc uses Jest and Enzyme for testing components.

Each test file lives inside the component folder with a standard name (index.test.js). That's a basic and common test:

import React from 'react'
import { shallow } from 'enzyme'
import Component from '.'

it('renders children when passed in', () => {
  const wrapper = shallow(<Component>test</Component>)
  expect(wrapper.contains('test')).toBe(true)
})

All components except the one being tested are mocked in test/componentsMock.js. That makes it easier to write real unit tests.

Clone this wiki locally