У меня есть очень простой тест для моего компонента:
import React from "react";
import { mount, shallow } from "enzyme";
import AgendaItem from "./AgendaItem";
import renderer from "react-test-renderer";
describe("<AgendaItem />", () => {
it("it should render 1 view component", () => {
const props = {
item: {
title: "test title"
}
};
const wrapper = shallow(<AgendaItem {...props} />);
expect(wrapper.find(View)).to.have.length(1);
});
it("it should render 5 text components", () => {
const props = {
item: {
title: "test title",
venue: "test venue",
organiser: "test organiser",
startTime: "8-00",
description: "<p>test description</p>"
}
};
const wrapper = shallow(<AgendaItem {...props} />);
expect(wrapper.find(Text)).to.have.length(5);
});
});
Package.json:
"jest": {
"preset": "react-native",
"setupTestFrameworkScriptFile": "<rootDir>/test-setup.js"
}
Как мне найти компонент Text
в моем тесте?