Guest User

Untitled

a guest
Nov 18th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import { View, Text, Button, TextInput } from 'react-native';
  3.  
  4. class MyComponent extends Component {
  5. constructor(props) {
  6. super(props);
  7. }
  8.  
  9. render() {
  10. return (
  11. <View >
  12. <Button title="My Component"/>
  13. </View>
  14. )
  15. }
  16. }
  17. export default MyComponent;
  18.  
  19. import React from 'react';
  20. import { configure, shallow } from 'enzyme';
  21. import Adapter from 'enzyme-adapter-react-16';
  22. import MyComponent from '../components/MyComponent.js';
  23.  
  24. configure({ adapter: new Adapter() }) //setting up enzyme
  25.  
  26. const styles = require('../styles.js');
  27.  
  28. describe('rendering', () => {
  29. it('checking View and Button exists', () => {
  30. let wrapper
  31. wrapper = shallow(<MyComponent/>);
  32.  
  33. expect(wrapper.find('View').children().find('Button')).toHaveProperty('title','My Component')
  34. });
  35. })
  36. });
  37.  
  38. Expected the object:
  39. < listing of full object...>
  40. To have a nested property:
  41. "title"
  42. With a value of:
  43. "My Component"
Add Comment
Please, Sign In to add comment