plugin: Add unit tests for StateChip and allocation utility#10
Open
NAME-ASHWANIYADAV wants to merge 4 commits into
Open
plugin: Add unit tests for StateChip and allocation utility#10NAME-ASHWANIYADAV wants to merge 4 commits into
NAME-ASHWANIYADAV wants to merge 4 commits into
Conversation
illume
reviewed
Jun 15, 2026
| @@ -21,7 +21,9 @@ type ChipColor = 'default' | 'primary' | 'secondary' | 'error' | 'info' | 'succe | |||
|
|
|||
| const STATE_COLORS: Record<string, ChipColor> = { | |||
There was a problem hiding this comment.
I would add tsdocs to this and the fields.
Also using @see a link to the Agones docs for this object: Is it here? // https://agones.dev/site/docs/reference/gameserver/#gameserver-state-diagram
Contributor
Author
There was a problem hiding this comment.
I have added TSDocs for STATE_COLORS with a link to the Agones state diagram, and added descriptions for each state
Thanks for the review! 👍
Introduce robust unit tests for the StateChip component and the buildAllocationBody utility using Vitest. This ensures that GameServer lifecycle state colors map correctly and allocation payload generation handles all form edge cases properly. Signed-off-by: ashwani yadav <22ashwaniyadav@gmail.com>
Signed-off-by: ashwani yadav <22ashwaniyadav@gmail.com>
Signed-off-by: ashwani yadav <22ashwaniyadav@gmail.com>
c8e1599 to
e471f89
Compare
markmandel
approved these changes
Jun 16, 2026
Member
|
Looks like we have a CI failure with your new CI setup! 😄 something to fix. |
Contributor
Author
🥀🥀 |
Signed-off-by: ashwani yadav <22ashwaniyadav@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of change
What this PR does
Adds the project's first unit tests using Vitest:
map to correct chip colors, including graceful fallback for unmapped states.
with edge cases for label selectors, counter/list filters, mutations, and priorities.
28 tests total, all passing.
Test plan
Automated checks
npm run test(28 tests passing in ~2.6s)npm run tscnpm run lint