Skip to content

Add edge case test for stat wipe in progression calculations#134

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/add-edge-case-stat-wipe-test
Draft

Add edge case test for stat wipe in progression calculations#134
Copilot wants to merge 3 commits intomainfrom
copilot/add-edge-case-stat-wipe-test

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 12, 2026

Adds test coverage for progression calculations when stats decrease from high values to zero/low values, simulating a stat reset/wipe scenario.

Changes

  • New test case: edge case: stat wipe covering 65 test combinations (11 gamemode stats × 5 gamemodes + 2 overall stats × 5 gamemodes)
  • Test setup:
    • Start player with 100,000 for all gamemode stats and 4,870,000 exp (1000 stars)
    • End player with 0 for all gamemode stats and 500 exp (1 star)
    • Shared builders and history created once at function root for efficiency
  • Test coverage:
    • Gamemode-specific stats: gamesPlayed, wins, losses, bedsBroken, bedsLost, finalKills, finalDeaths, kills, deaths, fkdr, kdr
    • Overall stats: experience, stars
  • Assertions: Verifies no errors thrown, no error object returned, and endValue matches expected values (0 for gamemode stats, 500 for experience, 1 for stars)
  • Excluded stats: winstreak (not implemented), index (not yet supported - noted in code)

The progression calculation handles this edge case gracefully, returning negative progressPerDay for gamemode stats and appropriate values for experience/stars without crashing.

Original prompt

Add a new top level test case in the progression test named "edge case: stat wipe" create a start player with very high stats and an end player with 0 stats. Then loop over all stat keys and all gamemodes and assert that the progression calculation does not throw an error and does not return an error. Also assert that the returned value is 0. Note that since this is an edge case we don't care about the specific behavior, just that it doesn't crash.
Skip "index" as we don't support progression for that yet, but make a note about it


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: Amund211 <14028449+Amund211@users.noreply.github.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Jan 12, 2026

Deploying rainbow with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4612020
Status: ✅  Deploy successful!
Preview URL: https://fbbb8c72.rainbow-ctx.pages.dev
Branch Preview URL: https://copilot-add-edge-case-stat-w.rainbow-ctx.pages.dev

View logs

Co-authored-by: Amund211 <14028449+Amund211@users.noreply.github.com>
Copilot AI changed the title [WIP] Add edge case test for stat wipe in progression test Add edge case test for stat wipe in progression calculations Jan 12, 2026
Copilot AI requested a review from Amund211 January 12, 2026 22:29
Copy link
Copy Markdown
Owner

@Amund211 Amund211 left a comment

Choose a reason for hiding this comment

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

@copilot move the stats and player builders to the root of the function since these are shared and will not be mutated. Also move the history there. Then make an additional loop over exp, stars, and move the todo about index to there. Set the exp on the before player to 1000 stars. And 500 exp on the after player.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 13, 2026

@copilot move the stats and player builders to the root of the function since these are shared and will not be mutated. Also move the history there. Then make an additional loop over exp, stars, and m...

Done in 581e5e6. Moved builders and history to function root, added separate loop for experience/stars with 1000 stars (4,870,000 exp) on start player and 500 exp on end player. TODO about index moved to the experience/stars section.

Copilot AI requested a review from Amund211 January 13, 2026 20:03
@Amund211 Amund211 force-pushed the copilot/add-edge-case-stat-wipe-test branch from 581e5e6 to 4612020 Compare January 13, 2026 20:05
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