Skip to content

Add test coverage documenting DELETE /api/v1/anchors/:id idempotent-deactivate behaviorΒ #97

Description

@Jagadeeshftw

πŸ“Œ Description

DELETE /api/v1/anchors/:id deactivates an anchor per the README, but the response for deactivating an already-inactive anchor isn't documented or (as far as can be told) explicitly tested β€” is a second call a no-op 200, or does it error? DELETE-style operations are conventionally expected to be idempotent, and callers (including the frontend's confirm-dialog-guarded deactivate action) need a defined contract.

🧩 Requirements and context

  • Add a test asserting the actual current behavior of calling DELETE /api/v1/anchors/:id twice in a row.
  • If the current behavior isn't idempotent (e.g. errors on the second call), evaluate whether to make it idempotent (200/no-op) for consistency with REST conventions β€” implement whichever is decided and document it.
  • Document the decided contract in the README next to the endpoint description.

πŸ› οΈ Suggested execution

  • Add the double-call test to src/routes/anchors.test.ts.
  • If a behavior change is warranted, update AnchorService/AnchorRepository accordingly.
  • Update the README's Anchors section with the explicit contract.

βœ… Acceptance criteria

  • Repeat-deactivate behavior is explicitly tested.
  • Behavior matches the documented contract.
  • README updated with the explicit contract.

πŸ”’ Security notes

No new attack surface; clarifies an operation already gated by an existing auth/validation path.

πŸ“‹ Guidelines

  • Minimum 95% test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Labels

GrantFox OSSGrantFox open-source programMaybe RewardedGrantFox: potentially rewarded contributionOfficial Campaign | FWC26GrantFox official campaign issueapiHTTP/WebSocket APItestingTests and coverage

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions