Skip to content

Conversation

@prestoalvarez
Copy link
Contributor

Replace loose equality (==) with strict equality (===) in lowerBound and upperBound test helper functions to improve code consistency and avoid potential type coercion issues.

@prestoalvarez prestoalvarez requested a review from a team as a code owner November 9, 2025 12:58
@changeset-bot
Copy link

changeset-bot bot commented Nov 9, 2025

⚠️ No Changeset found

Latest commit: 11ea514

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 9, 2025

Walkthrough

The pull request updates comparison operators in helper functions within the test utilities. Loose equality checks (==) were replaced with strict equality operators (===) in the lowerBound and upperBound functions, specifically in comparisons against the value -1. The functional behavior remains unchanged, as both comparison styles produce identical results in these cases. No public API changes were introduced by this modification.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: replacing loose equality with strict equality in Arrays test helpers.
Description check ✅ Passed The description is directly related to the changeset, clearly explaining the purpose of replacing loose equality with strict equality in test helper functions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
test/utils/Arrays.test.js (1)

23-23: Consider using strict inequality for consistency.

For consistency with the changes on lines 12 and 18, consider replacing != with !== here as well.

Apply this diff:

-const hasDuplicates = array => array.some((v, i) => array.indexOf(v) != i);
+const hasDuplicates = array => array.some((v, i) => array.indexOf(v) !== i);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eb97fd3 and 11ea514.

📒 Files selected for processing (1)
  • test/utils/Arrays.test.js (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: Redirect rules - solidity-contracts
  • GitHub Check: Header rules - solidity-contracts
  • GitHub Check: Pages changed - solidity-contracts
  • GitHub Check: coverage
  • GitHub Check: tests-foundry
  • GitHub Check: tests-upgradeable
  • GitHub Check: slither
  • GitHub Check: tests
  • GitHub Check: halmos
🔇 Additional comments (2)
test/utils/Arrays.test.js (2)

12-12: LGTM! Good improvement for consistency.

The change from == to === aligns with JavaScript best practices and improves code consistency, even though the functional behavior remains unchanged since findIndex always returns a number.


18-18: LGTM! Consistent with the lowerBound change.

The strict equality check maintains consistency with the updated lowerBound function and follows JavaScript best practices.

@Amxx Amxx changed the base branch from master to typo-fixes November 10, 2025 09:41
Copy link
Collaborator

@Amxx Amxx left a comment

Choose a reason for hiding this comment

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

Note: i is the result of a call to findIndex. So its an integer. Using == or === should not make any difference for integers.

@ernestognw ernestognw merged commit b3570cb into OpenZeppelin:typo-fixes Nov 10, 2025
22 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants