Let's create our first form:
- Create a new file called test/CustomerForm.test.js and add the following:
import React from 'react';
import { createContainer } from './domManipulators';
import { CustomerForm } from '../src/CustomerForm';
describe('CustomerForm', () => {
let render, container;
beforeEach(() => {
({ render, container } = createContainer());
});
});
The call in the beforeEach block looks a little odd; it's a destructuring assignment where the variables have already been declared. The declaration and assignment are split in this way because the variables must be accessible within the scope of the describe block, but they must also be reassigned for each and every test. Each test gets its own container, independent of the other tests.
- Add the following test into the describe block:
it...