diff --git a/.circleci/config.yml b/.circleci/config.yml index 33141d0602..cd07fe3333 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -139,9 +139,12 @@ jobs: name: Install dependencies command: npm install + - run: + name: Prepare frontend tests + command: npm run defs && npm run features + - run: name: Frontend unit tests - when: always command: npm run test:js:frontend - run: diff --git a/frontend/components/category-headings.spec.js b/frontend/components/category-headings.spec.js new file mode 100644 index 0000000000..1614635744 --- /dev/null +++ b/frontend/components/category-headings.spec.js @@ -0,0 +1,32 @@ +import React from 'react' +import { shallow } from 'enzyme' +import { expect } from 'chai' +import { CategoryHeading, CategoryHeadings } from './category-headings' + +import './enzyme-conf.spec' + +const exampleCategories = [{ id: 'cat', name: 'Example category' }] + +describe('', function() { + it('renders', function() { + shallow() + }) + + it('contains the expected heading', function() { + const wrapper = shallow() + expect(wrapper).to.contain(

Example category

) + }) +}) + +describe('', function() { + it('renders', function() { + shallow() + }) + + it('contains the expected child', function() { + const wrapper = shallow() + expect(wrapper).to.contain( + + ) + }) +}) diff --git a/frontend/components/enzyme-conf.spec.js b/frontend/components/enzyme-conf.spec.js new file mode 100644 index 0000000000..b72bc4ddf9 --- /dev/null +++ b/frontend/components/enzyme-conf.spec.js @@ -0,0 +1,8 @@ +import Enzyme from 'enzyme' +import Adapter from 'enzyme-adapter-react-16' +import chai from 'chai' +import chaiEnzyme from 'chai-enzyme' + +Enzyme.configure({ adapter: new Adapter() }) + +chai.use(chaiEnzyme()) diff --git a/frontend/components/footer.spec.js b/frontend/components/footer.spec.js new file mode 100644 index 0000000000..fba5ff0488 --- /dev/null +++ b/frontend/components/footer.spec.js @@ -0,0 +1,17 @@ +import React from 'react' +import { shallow } from 'enzyme' +import { expect } from 'chai' +import Footer from './footer' + +import './enzyme-conf.spec' + +describe('