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: Implement jest mocks for react-native. #535

Merged

Conversation

professorice
Copy link
Contributor

@professorice professorice commented Aug 6, 2024

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Related issues

Provide links to any issues in this repository or elsewhere relating to this pull request.

Describe the solution you've provided

Provide a clear and concise description of what you expect to happen.

Describe alternatives you've considered

Provide a clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context about the pull request here.

@professorice professorice requested a review from a team as a code owner August 6, 2024 19:36
@kinyoklion kinyoklion changed the title Mzafir/react native jest mock feat: Implement jest mocks for react-native. Aug 6, 2024
import { mockFlags, mockUseLDClient } from '@launchdarkly/jest/react-native';

export default function Welcome() {
const flagValue = mockFlags({ 'dev-test-flag': true });
Copy link
Member

Choose a reason for hiding this comment

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

I think that we probably want the example to appear like a normal react-native application using our SDK, then have tests that use a component from that application, but with a mock?

Similar to the example tests in the existing mocks project: https://github.com/launchdarkly/jest-launchdarkly-mock

@professorice professorice force-pushed the mzafir/react-native-jest-mock branch from 8b05e27 to 4dc3bf2 Compare August 28, 2024 22:20
Copy link
Member

Choose a reason for hiding this comment

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

This looks good.

alignItems: 'center',
justifyContent: 'center',
},
});
Copy link
Member

Choose a reason for hiding this comment

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

Please add a newline to the end of this file.

Copy link
Member

Choose a reason for hiding this comment

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

Looks like there are some other files. So just double check.
image
You should see the angry symbol at the bottom in the diffs.

"rimraf": "^5.0.1",
"ts-jest": "^29.1.0",
"typedoc": "0.25.0",
"typescript": "5.1.6"
},
"dependencies": {
"@launchdarkly/react-native-client-sdk": "workspace:^",
Copy link
Member

Choose a reason for hiding this comment

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

I think we need the version from the package here. Otherwise funky things will happen when this is published.

package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
@kinyoklion
Copy link
Member

I updated the branch to incorporate some changes to the workflow files for forks.

@kinyoklion kinyoklion merged commit aee09c8 into launchdarkly:main Nov 4, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants