Skip to content

Instantly share code, notes, and snippets.

@itelo
Created May 8, 2020 19:36
Show Gist options
  • Save itelo/a5bde55f7bc5b4bc04e50cf77822b3a1 to your computer and use it in GitHub Desktop.
Save itelo/a5bde55f7bc5b4bc04e50cf77822b3a1 to your computer and use it in GitHub Desktop.
import React from 'react';
import {render} from 'react-native-testing-library';
import Button from './Button';
describe('<Button />', () => {
it('testing color default', () => {
const view = render(<Button>Hello Testing Library</Button>);
expect(view.toJSON()?.props.style.backgroundColor).toBe('blue');
});
it('testing color = red', () => {
const view = render(<Button color="red">Hello Testing Library</Button>);
expect(view.toJSON()?.props.style.backgroundColor).toBe('red');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment