UNPKG

@applicaster/zapp-react-native-utils

Version:

Applicaster Zapp React Native utilities package

27 lines (20 loc) 734 B
/* eslint-disable react/prop-types */ import * as React from "react"; import { shallow } from "enzyme"; import toJson from "enzyme-to-json"; import { View, Text } from "react-native"; import { createWithProviderDecorator } from "../withProvider"; describe("withProvider", () => { const Provider = ({ children }) => <View>{children}</View>; const withProvider = createWithProviderDecorator(Provider); it("decorates a component with the provider", () => { const Component = () => ( <View> <Text>I am a Component</Text> </View> ); const DecoratedComponent = withProvider(Component); const wrapper = shallow(<DecoratedComponent />); expect(toJson(wrapper)).toMatchSnapshot(); }); });