Clarify seeded state setup in specs#104
Conversation
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/Imperium.UnitTests/Rondel.fs`:
- Line 193: The line containing "state (RondelState.create gameId nations)" has
trailing whitespace causing Fantomas to fail; remove the trailing whitespace on
that line and reformat the file (or project) with Fantomas (e.g., run "dotnet
fantomas .") so the file passes the fs/fsi formatting rules; ensure the change
touches the RondelState.create usage only to remove the extra spaces and commit
the formatted file.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 4c66e4d8-55b0-44d0-a655-fda670a08b67
📒 Files selected for processing (2)
tests/Imperium.UnitTests/Rondel.fstests/Imperium.UnitTests/Spec.fs
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tests/Imperium.UnitTests/Rondel.fs (1)
333-333: Consider usingId.newId ()consistently for billing IDs.Most billing IDs use
Guid.NewGuid() |> Id |> RondelBillingId.ofId, whileinvoicePaymentFailedTwiceBillingId(lines 491-492) uses the more conciseId.newId () |> RondelBillingId.ofId. SinceId.newId ()is justGuid.NewGuid() |> Id, consider using the shorter form everywhere for consistency.♻️ Proposed refactor for consistency
- let previousBillingId = Guid.NewGuid() |> Id |> RondelBillingId.ofId + let previousBillingId = Id.newId () |> RondelBillingId.ofIdApply similarly to other billing ID definitions.
Also applies to: 363-363, 388-388, 432-432, 461-461, 521-521, 551-551
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/Imperium.UnitTests/Rondel.fs` at line 333, Replace occurrences that create billing IDs using the longer pattern "Guid.NewGuid() |> Id |> RondelBillingId.ofId" with the concise helper "Id.newId () |> RondelBillingId.ofId" for consistency; update definitions such as previousBillingId and the other billing id bindings (e.g., invoicePaymentFailedTwiceBillingId and the instances flagged in the review) to use Id.newId () before RondelBillingId.ofId so all billing ID constructors use the same concise form.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/Imperium.UnitTests/Rondel.fs`:
- Line 193: Remove the trailing whitespace after the closing parenthesis on the
line that calls RondelState.create (the expression "state (RondelState.create
gameId nations)"); open the Rondel.fs file, edit the line to eliminate the extra
space immediately following the ")" so it ends cleanly, then run `dotnet
fantomas .` to reformat and verify the Fantomas check passes.
---
Nitpick comments:
In `@tests/Imperium.UnitTests/Rondel.fs`:
- Line 333: Replace occurrences that create billing IDs using the longer pattern
"Guid.NewGuid() |> Id |> RondelBillingId.ofId" with the concise helper "Id.newId
() |> RondelBillingId.ofId" for consistency; update definitions such as
previousBillingId and the other billing id bindings (e.g.,
invoicePaymentFailedTwiceBillingId and the instances flagged in the review) to
use Id.newId () before RondelBillingId.ofId so all billing ID constructors use
the same concise form.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8d9f50a8-a25e-4200-b05b-976c244a3247
📒 Files selected for processing (2)
tests/Imperium.UnitTests/Rondel.fstests/Imperium.UnitTests/Spec.fs
Summary
StatetoGivenStateand rename the helper fromwithStatetowithGivenStatestatecomputation-expression step unchanged while making the internal naming line up withGivenActionsId.newId ()consistently for test ids, keep the localnewBillingIdhelper, remove an unusedSystemopen, and fix a small tuple/formatting inconsistencyWhy
GivenStateis a better name for scenario seed data than the more ambiguousStateImpact
statein specsValidation
dotnet fantomas .dotnet build Imperium.slnxdotnet testdotnet run --no-build --project tests/Imperium.UnitTests/Imperium.UnitTests.fsproj -- --render-spec-markdown