fix: remove the unused user use cases, fix the specs that no longer match the code, include api/middleware and api/pkg/claims in mutation testing, log failures that password reset requests currently ignore, and reject user_id claims that don't fit a user id

This commit is contained in:
fsylvain committed 2026-09-25 05:58:37 +02:00
1 parent cbb403011a
commit 3282b0580c
22 files changed
+260 -314

No files matched your search

+2 -26
View File
@@ -161,30 +161,6 @@ Feature: Use case baseline characterization
When ListUsers is called
Then the result is the users with ids 1 and 2, and no error
Scenario Outline: UpdateUser delegates each operation to the repository and surfaces not-found for an unknown id
Given a user repository fake containing a user with id 1
When <method> is called with id <id> and <input>
Then the result is <outcome>
Examples:
| method | id | input | outcome |
| UpdateVerificationStatus | 1 | isVerified true | the user with id 1 and is_verified true |
| UpdateVerificationStatus | 9 | isVerified true | the repository's not-found error (gorm.ErrRecordNotFound) |
| UpdatePassword | 1 | password "newpassword123" | the user with id 1 |
| UpdatePassword | 9 | password "newpassword123" | the repository's not-found error (gorm.ErrRecordNotFound) |
| UpdatePasswordResetCode | 1 | code "reset-code-123" | the user with id 1 |
| UpdatePasswordResetCode | 9 | code "reset-code-123" | the repository's not-found error (gorm.ErrRecordNotFound) |
Scenario Outline: DeleteUser succeeds silently whether or not the id exists
Given a user repository fake containing a user with id 1
When DeleteUser is called with id <id>
Then no error is returned
Examples:
| id |
| 1 |
| 9 |
Scenario Outline: SendMail forwards its arguments verbatim to the mail repository
Given a mail repository fake
When SendMail is called with receiver "<receiver>", template "<template>" and some data
@@ -201,8 +177,8 @@ Feature: Use case baseline characterization
Then the use case returns the repository's error unchanged
And the fake recorded no send
Scenario: Mutation testing runs clean on the use cases package
Scenario: Mutation testing runs clean on the use cases package, api/middleware and api/pkg/claims
Given the test/ suite passes via `go test -tags nofrontend ./test/... -count=1`
When `gremlins unleash --integration --tags nofrontend --coverpkg=./internal/infrastructure/useCases/... --timeout-coefficient 10 --output tmp/gremlins.json ./internal/infrastructure/useCases` is run
When `gremlins unleash --integration --tags nofrontend --coverpkg=./internal/infrastructure/useCases/...,./api/middleware/...,./api/pkg/claims/... --timeout-coefficient 10 --output tmp/gremlins.json ./internal/infrastructure/useCases ./api/middleware ./api/pkg/claims` is run
Then the report contains zero mutants with status LIVED
And the report contains zero mutants with status NOT COVERED