test: cleanup follow-up from PR #124 review (v3.9.4) #126

Closed
Toutsu wants to merge 0 commits from fix/issue-125-test-cleanup into main
Owner

Summary

Fix #125 — follow-up test cleanup из ревью PR #124.

Два не-блокирующих замечания:

  1. Симметрия PoolSlotCapacity теста: RenderCapacity_NoLimitButton_HasChoiceCustomIdForNoLimit рефакторен в [Theory] с двумя InlineData — для Capacity и PoolSlotCapacity. Теперь регрессия в wire-format любого из двух steps даст targeted failure.
  2. Brittle version-string test: NavMenu_ShouldExposeCurrentProjectVersion больше не хардкодит "v3.9.3" — парсит <Version> из Directory.Build.props через XDocument. На каждом bump тест больше не нужно править руками (мы уже обновили его в PR #124 — теперь это不会再 повториться).

Production-код не меняется. Version bump 3.9.3 → 3.9.4 в отдельном коммите.

Changes

  • tests/GmRelay.Bot.Tests/Discord/Wizard/DiscordWizardStepCapacityRenderTests.cs: RenderCapacity_NoLimitButton_HasChoiceCustomIdForNoLimitRender_NoLimitButton_HasChoiceCustomIdForNoLimit ([Theory] с двумя InlineData).
  • tests/GmRelay.Bot.Tests/Web/CampaignTemplatesNavigationTests.cs: NavMenu_ShouldExposeCurrentProjectVersion парсит версию из Directory.Build.props. Добавлен хелпер ReadVersionFromProps (XDocument, tolerant к whitespace/комментариям).
  • Directory.Build.props / compose.yaml / .gitea/workflows/deploy.yml / src/GmRelay.Web/Components/Layout/NavMenu.razor: 3.9.3 → 3.9.4.

Test plan

  • dotnet test — 602 passed, 2 skipped (Testcontainers, как до фикса)
  • dotnet format --verify-no-changes — clean
  • dotnet build — 0 warnings (TreatWarningsAsErrors=true)
  • dotnet list package --vulnerable — clean
  • Sanity check: bump до 3.9.4 в Directory.Build.props → тест NavMenu_ShouldExposeCurrentProjectVersion автоматически подхватил новую версию и прошёл без изменений в тест-коде. Доказывает, что brittle-fix работает.

Workflow

  • CI passes (pr-checks)
  • Code review approved
  • Deployed to main
  • Release v3.9.4 published
## Summary Fix #125 — follow-up test cleanup из ревью [PR #124](https://git.codeanddice.ru/Toutsu/GmRelayBot/pulls/124). Два не-блокирующих замечания: 1. **Симметрия `PoolSlotCapacity` теста**: `RenderCapacity_NoLimitButton_HasChoiceCustomIdForNoLimit` рефакторен в `[Theory]` с двумя `InlineData` — для `Capacity` и `PoolSlotCapacity`. Теперь регрессия в wire-format любого из двух steps даст targeted failure. 2. **Brittle version-string test**: `NavMenu_ShouldExposeCurrentProjectVersion` больше не хардкодит `"v3.9.3"` — парсит `<Version>` из `Directory.Build.props` через `XDocument`. На каждом bump тест больше не нужно править руками (мы уже обновили его в PR #124 — теперь это不会再 повториться). Production-код не меняется. Version bump 3.9.3 → 3.9.4 в отдельном коммите. ## Changes - **`tests/GmRelay.Bot.Tests/Discord/Wizard/DiscordWizardStepCapacityRenderTests.cs`**: `RenderCapacity_NoLimitButton_HasChoiceCustomIdForNoLimit` → `Render_NoLimitButton_HasChoiceCustomIdForNoLimit` (`[Theory]` с двумя `InlineData`). - **`tests/GmRelay.Bot.Tests/Web/CampaignTemplatesNavigationTests.cs`**: `NavMenu_ShouldExposeCurrentProjectVersion` парсит версию из `Directory.Build.props`. Добавлен хелпер `ReadVersionFromProps` (XDocument, tolerant к whitespace/комментариям). - **`Directory.Build.props` / `compose.yaml` / `.gitea/workflows/deploy.yml` / `src/GmRelay.Web/Components/Layout/NavMenu.razor`**: 3.9.3 → 3.9.4. ## Test plan - [x] `dotnet test` — 602 passed, 2 skipped (Testcontainers, как до фикса) - [x] `dotnet format --verify-no-changes` — clean - [x] `dotnet build` — 0 warnings (TreatWarningsAsErrors=true) - [x] `dotnet list package --vulnerable` — clean - [x] **Sanity check**: bump до 3.9.4 в `Directory.Build.props` → тест `NavMenu_ShouldExposeCurrentProjectVersion` автоматически подхватил новую версию и прошёл без изменений в тест-коде. Доказывает, что brittle-fix работает. ## Workflow - [ ] CI passes (`pr-checks`) - [ ] Code review approved - [ ] Deployed to main - [ ] Release `v3.9.4` published
Toutsu added 2 commits 2026-06-08 19:13:33 +03:00
Two non-blocking suggestions from the PR #124 code review:

1. Symmetric coverage for the Discord PoolSlotCapacity no-limit button.
   The Capacity step already had a customId-shape assertion for the
   '♾ Без лимита' button; PoolSlotCapacity only had a label-presence
   assertion. If ChoiceButtonCustomId's wire format ever diverged between
   the two steps, only Capacity would catch it. Convert the single Fact
   to a Theory with two InlineData rows so a regression in either step
   produces a targeted test failure.

2. Brittle hard-coded version literal in NavMenu_ShouldExposeCurrent
   ProjectVersion. The test had to be hand-edited on every version bump
   (we hit this in PR #124 — bumping 3.9.2 -> 3.9.3 broke CI). Read the
   version from Directory.Build.props via XDocument instead so the test
   only fails when the rendered NavMenu actually disagrees with the
   canonical version, not when someone forgot to update a literal.
   Tolerant of whitespace, comments and attribute order; the <Version>
   element is a plain string body in the MSBuild schema.

No production code changes; production version is bumped in a
follow-up commit.

Closes #125
chore: bump version 3.9.3 -> 3.9.4
PR Checks / test-and-build (pull_request) Successful in 10m23s
aee0ac1e6c
Test-only patch release. Sync the four canonical version sources:
- Directory.Build.props
- compose.yaml (bot, discord, web image tags)
- .gitea/workflows/deploy.yml (VERSION env)
- src/GmRelay.Web/Components/Layout/NavMenu.razor (visible nav-version)

The new NavMenu_ShouldExposeCurrentProjectVersion test reads the
version from Directory.Build.props, so this bump does NOT need a
hand-edited test literal — verified locally that the test passes
on 3.9.4 with no manual changes.
Toutsu closed this pull request 2026-06-08 19:30:27 +03:00
Some checks are pending
PR Checks / test-and-build (pull_request) Successful in 10m23s

Pull request closed

Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Toutsu/GmRelayBot#126