Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, { Component } from 'react';
- import { View, Text, Button, TextInput } from 'react-native';
- class MyComponent extends Component {
- constructor(props) {
- super(props);
- }
- render() {
- return (
- <View >
- <Button title="My Component"/>
- </View>
- )
- }
- }
- export default MyComponent;
- import React from 'react';
- import { configure, shallow } from 'enzyme';
- import Adapter from 'enzyme-adapter-react-16';
- import MyComponent from '../components/MyComponent.js';
- configure({ adapter: new Adapter() }) //setting up enzyme
- const styles = require('../styles.js');
- describe('rendering', () => {
- it('checking View and Button exists', () => {
- let wrapper
- wrapper = shallow(<MyComponent/>);
- expect(wrapper.find('View').children().find('Button')).toHaveProperty('title','My Component')
- });
- })
- });
- Expected the object:
- < listing of full object...>
- To have a nested property:
- "title"
- With a value of:
- "My Component"
Add Comment
Please, Sign In to add comment