Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: jest integration #102

Merged
merged 15 commits into from
Dec 16, 2022
Merged

feat: jest integration #102

merged 15 commits into from
Dec 16, 2022

Conversation

kirillzyusko
Copy link
Owner

@kirillzyusko kirillzyusko commented Dec 14, 2022

📜 Description

Will fix #101

💡 Motivation and Context

Right now it's not possible to write jest tests for components, that are using this library. To overcome the limitation I added mock and wrote several test cases as examples.

📢 Changelog

CI

  • run example tests;

Docs

  • added section about testing;

Jest

  • added mocks;
  • added example of tests;

🤔 How Has This Been Tested?

Tested locally and on CI that tests are working fine.

📝 Checklist

  • CI successfully passed

@kirillzyusko kirillzyusko added documentation Improvements or additions to documentation enhancement New feature or request example Anything related to example project labels Dec 14, 2022
@kirillzyusko kirillzyusko self-assigned this Dec 14, 2022

(useKeyboardAnimation as jest.Mock).mockReturnValue({
height: new Animated.Value(300),
progress: new Animated.Value(1),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe it's better to split these object to fisrtPosition, secondPosition, thirdPosition?

const thirdPosition = {
      height: new Animated.Value(300),
      progress: new Animated.Value(1),
      };
      
 (useKeyboardAnimation as jest.Mock).mockReturnValue(thirdPosition);

@kirillzyusko kirillzyusko marked this pull request as ready for review December 15, 2022 17:03
@kirillzyusko kirillzyusko merged commit bfdb026 into main Dec 16, 2022
@kirillzyusko kirillzyusko deleted the feature/jest branch December 16, 2022 09:00
@kirillzyusko kirillzyusko added the tests You added or changed unit tests label Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request example Anything related to example project tests You added or changed unit tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when I run unit test
2 participants