Skip to content

test(utils): pin validateTeamSplits edge-case contracts - #108

Closed
rudra496 wants to merge 1 commit into
MergeFi:mainfrom
rudra496:fix/issue-68-duplicate-export
Closed

test(utils): pin validateTeamSplits edge-case contracts#108
rudra496 wants to merge 1 commit into
MergeFi:mainfrom
rudra496:fix/issue-68-duplicate-export

Conversation

@rudra496

Copy link
Copy Markdown

Closes #68

Status of the build break

The duplicate validateTeamSplits export that failed next build (TS2393) is already resolved on current main — removed in 75fea94 and repaired in ba7cc7b. Verified on a fresh clone just now: npx tsc --noEmit exits clean and next build succeeds (after copying .env.example to .env.local, which the validated-env config requires locally).

What this adds

The fix landed without the surrounding behaviour fully pinned, so this PR closes the gap with four tests:

  • empty array returns { valid: true, sum: 0 } — the existing test only asserted the sum, not the short-circuit's valid flag
  • mixed string and number percentages in one array sum correctly
  • a custom tolerance actually widens acceptance (60 + 43 rejected at default, accepted at 5)
  • an unparseable string percentage (NaN) stays invalid instead of poisoning the comparison

Verification

npx jest src/lib/utils.test.ts — 39/39 passing (34 before). npm run lint and npm run build clean. Tests-only diff, no production code touched.

Copilot AI lite review requested due to automatic review settings August 17, 2026 09:02
@vercel

vercel Bot commented Aug 17, 2026

Copy link
Copy Markdown

@rudra496 is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

The duplicate-declaration build break from MergeFi#68 is already resolved on
main (75fea94, ba7cc7b), but the surrounding behaviour was only partly
pinned: the empty-array short-circuit asserted the sum without the
valid flag, mixed string/number arrays and the tolerance parameter had
no coverage, and an unparseable percentage was untested.

Adds four tests: empty array is valid with zero sum, mixed percentage
types sum correctly, a wide tolerance accepts sums it would otherwise
reject, and NaN-producing input stays invalid.
@rudra496
rudra496 force-pushed the fix/issue-68-duplicate-export branch from e4e46de to 3442479 Compare August 26, 2026 10:53
@rudra496

Copy link
Copy Markdown
Author

Closing this one myself: the underlying duplicate validateTeamSplits export was fixed on main by other PRs days before I opened this, so what's left here is only the edge-case regression tests — and after 9 days untouched it's drifting from main. If the maintainers want those test contracts back, happy to re-raise them rebased on current main as part of a broader batch. My active PRs on this repo: #118 (reputation clamp, issue #91), #338 (a11y batch), #339 (indexability policy, issue #19).

@rudra496 rudra496 closed this Aug 27, 2026
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.

Main branch build is broken: duplicate validateTeamSplits export in utils.ts fails next build (TS2393)

2 participants