Skip to content

Commit

Permalink
feat: create test for button component
Browse files Browse the repository at this point in the history
  • Loading branch information
itsaladin committed Nov 18, 2022
1 parent 3f5798e commit bf7289c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/__tests__/button.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import { cleanup, render } from '@testing-library/react-native';
import { Button } from '../components/Button';

afterEach(cleanup);

describe('App', () => {
it('should find the button component via testId', () => {
const testIdName = 'testButtonId';

const { getByTestId } = render(<Button />);

const foundButton = getByTestId(testIdName);

expect(foundButton).toBeTruthy();
});
});
1 change: 1 addition & 0 deletions src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const Button = ({
return (
<TouchableOpacity
activeOpacity={0.8}
testID={'testButtonId'}
style={[
style,
{
Expand Down

0 comments on commit bf7289c

Please sign in to comment.