Skip to content

docs: update jest README with testing examples and removed react setup instructions that are not currently available. #889

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

professorice
Copy link
Contributor

No description provided.

…p instructions that are not currently available.
@professorice professorice requested a review from a team as a code owner June 18, 2025 18:04
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: README Bug: Null Handling Inconsistency

The test example in README.md exhibits inconsistent null handling. While the call to current?.track('event') uses optional chaining, suggesting current might be null/undefined, the subsequent expectation expect(current.track).toHaveBeenCalledTimes(1) directly accesses current.track without null checking. If current is null/undefined, the optional chaining prevents the track call, but the expectation will throw a TypeError when attempting to access track on a null/undefined value. This inconsistency can mislead developers using the example.

packages/tooling/jest/README.md#L48-L54

test('mock ldClient correctly', () => {
const current = useLDClient();
current?.track('event');
expect(current.track).toHaveBeenCalledTimes(1);
});

Fix in Cursor


Was this report helpful? Give feedback by reacting with 👍 or 👎

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.

1 participant