fix(tests): align BetType with SelectionType in locked-state test#121
Draft
fix(tests): align BetType with SelectionType in locked-state test#121
Conversation
… on Australia selection page with full API/UI tests add development-only mock data toggle for current selections endpoint and document env config
… mapping, and persist dev mock selections in memory
…normalize legacy selection data while keeping compatibility remove legacy selection data
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
`ValidateSelections` only checked that 5 non-empty drivers were present,
allowing payloads with extra empty/whitespace entries (e.g. 6 items: 5
valid + 1 empty) to pass validation and be persisted as-is —
inconsistent with `ValidateMockSubmission` which requires `Count == 5`.
## Changes
- **`SelectionService.ValidateSelections`**: Added upfront
`selections.Count != 5` guard before the existing non-empty/distinct
checks:
```csharp
if (selections.Count != 5)
{
throw new SelectionValidationException("Exactly 5 unique drivers must be selected.");
}
```
- **`SelectionServiceTests`**: Added
`UpsertSelectionAsync_ShouldReject_WhenMoreThanFiveSelectionsSubmitted`
covering the 5-valid + 1-empty payload case.
<!-- START COPILOT CODING AGENT TIPS -->
---
💬 We'd love your input! Share your thoughts on Copilot coding agent in
our [2 minute survey](https://gh.io/copilot-coding-agent-survey).
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: PhilipWoulfe <8867626+PhilipWoulfe@users.noreply.github.com>
`GetCurrentSelectionsAsync` iterated `OrderedSelections` in persistence
order, making the endpoint non-deterministic and inconsistent with the
`Position` field's semantics.
## Changes
- **`SelectionService.cs`** — Sort `OrderedSelections` by `Position`
before building response rows:
```csharp
var orderedSelections = selection.OrderedSelections
.OrderBy(item => item.Position)
.ToList();
```
- **`SelectionServiceTests.cs`** — Added
`GetCurrentSelectionsAsync_ShouldReturnRowsSortedByPosition_WhenSelectionsAreOutOfOrder`
to assert correct ordering when items are persisted out of sequence.
<!-- START COPILOT CODING AGENT TIPS -->
---
✨ Let Copilot coding agent [set things up for
you](https://github.com/PhilipWoulfe/F1Competition/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot)
— coding agent works faster and does higher quality work when set up for
your repo.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: PhilipWoulfe <8867626+PhilipWoulfe@users.noreply.github.com>
Co-authored-by: PhilipWoulfe <8867626+PhilipWoulfe@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] [WIP] Address feedback on "Feat/#86 retrieve selections" PR
fix(tests): align BetType with SelectionType in locked-state test
Mar 12, 2026
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.
The
AustraliaSelection_ShouldRenderLockedState_WhenExistingSelectionIsLockedtest had an internally inconsistent mock setup — the/selections/{raceId}/mineresponse usedBetType = Regularwhile the/selections/currentsnapshot usedSelectionType = "PreQualy", with assertions expecting the Pre-Qualy radio to be checked. This divergence masked potential regressions in bet-type propagation.Changes
AustraliaSelectionTests.cs: ChangedBetType = BetType.Regular→BetType = BetType.PreQualyin the locked-state test'sSelectionmock, aligning it with the snapshot'sSelectionTypeand the existing assertions.💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.