Testing a component with events

Now we want to test a component with events. For this, the <CountrySelect> component will come in handy, because it can process some events, and it will call some callbacks accordingly.

First of all, let's see the initial setup, including a list of countries that we'll be using for different tests:

// Source file: src/regionsApp/countrySelect.test.js/* @flow */import React from "react";import Enzyme from "enzyme";import Adapter from "enzyme-adapter-react-16";import { CountrySelect } from "./countrySelect.component";Enzyme.configure({ adapter: new Adapter() });const threeCountries = [    {        countryCode: "UY",        countryName: "Uruguay"    },    {        countryCode: "AR",        countryName: "Argentina"    },    {        countryCode: "BR", countryName: ...

Get Modern JavaScript Web Development Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.