Last active
April 2, 2020 08:05
-
-
Save RichardBray/194db1fe9fe06f7166a5d42e87cf1ec6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// App.test.js | |
import React from "react"; | |
import Enzyme, { mount } from "enzyme"; | |
import Adapter from "enzyme-adapter-react-16"; | |
import data from "./data.json"; | |
import App from "./App"; | |
Enzyme.configure({ adapter: new Adapter() }); | |
describe("App", () => { | |
const wrapper = mount(<App />); | |
test("Renders all the Questions provided in the data", () => { | |
// - when | |
const questionComp = wrapper.find("Question"); | |
const totalQuestions = data.results.length; | |
// - then | |
expect(questionComp).toHaveLength(totalQuestions); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment