-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from grupadotnet/8693hbmzy-add-jest-to-project
add tests to project
- Loading branch information
Showing
6 changed files
with
896 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { fireEvent, render, screen } from '@testing-library/react-native'; | ||
|
||
import PrimaryButton from './PrimaryButton'; | ||
|
||
const onPress = jest.fn(); | ||
|
||
describe('PrimaryButton component tests', () => { | ||
it('properly renders button with provided title', () => { | ||
render(<PrimaryButton title="test" onPress={onPress} />); | ||
|
||
expect(screen.getByText('test')).toBeDefined(); | ||
}); | ||
it('calls provieded onPress method', () => { | ||
render(<PrimaryButton title="test" onPress={onPress} />); | ||
|
||
fireEvent(screen.getByText('test'), 'press'); | ||
|
||
expect(onPress).toHaveBeenCalledTimes(1); | ||
}); | ||
}); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as PrimaryButton } from './PrimaryButton'; |
Oops, something went wrong.