@applicaster/zapp-react-native-ui-components
Version:
Applicaster Zapp React Native ui components for the Quick Brick App
31 lines (25 loc) • 817 B
JavaScript
/* eslint-disable no-global-assign */
/* eslint-disable react/prop-types */
import React from "react";
import { View, Text } from "react-native";
import { shallow } from "enzyme";
import { shallowToJson } from "enzyme-to-json";
import { TestId } from "../TestId";
const TestComponent = ({ name }) => (
<View>
<Text>{name}</Text>
</View>
);
const screenId = "A1234";
describe("TestId", () => {
it("renders correctly and assigns the testID to a wrapping view", () => {
const wrapper = shallow(
<TestId screenId={screenId}>
<TestComponent name="dev test" />
</TestId>
);
expect(shallowToJson(wrapper)).toMatchSnapshot();
expect(wrapper.find(View).prop("testID")).toEqual(screenId);
expect(wrapper.find(View).prop("accessibilityLabel")).toEqual(screenId);
});
});