Skip to content

Fix step creation mock to return 201+Location#15

Merged
davegomez merged 3 commits intomainfrom
fix/24-step-mock-status-code
Feb 1, 2026
Merged

Fix step creation mock to return 201+Location#15
davegomez merged 3 commits intomainfrom
fix/24-step-mock-status-code

Conversation

@davegomez
Copy link
Owner

The base POST steps mock handler returned 200 with a JSON body, but
the real Fizzy API returns 201 with a Location header and empty body.
This meant the client's 201+Location follow logic in request() was
never exercised by the default mock — only by per-test overrides.

Now the base handler stores the created step via lastCreatedStep and
returns 201 + Location, matching the lastCreatedCard pattern already
used for card creation. A corresponding GET /steps/:stepId handler
serves the stored step on follow. Also adds a missing test for creating
a step with completed: true.

Closes #24

@greptile-apps
Copy link

greptile-apps bot commented Feb 1, 2026

Greptile Overview

Greptile Summary

This PR updates the MSW step-creation mock to better match the real Fizzy API by returning 201 Created with a Location header and no JSON body, and adds a corresponding GET /steps/:stepId handler to serve the created step on follow. It also adds a test case to cover creating a step with completed: true, ensuring the tool sends the correct request payload and parses the followed GET response.

Confidence Score: 4/5

  • This PR is likely safe to merge, with one mock URL detail that may cause flaky/mismatched follow requests depending on client URL handling.
  • Changes are localized to test mocks and tests, and align behavior with the described real API. Main risk is that the new relative Location header uses params.accountSlug (which may include a leading slash) and could generate a double-slash path or mismatch the client’s follow logic, causing tests to fail or leaving the follow path unexercised.
  • src/test/mocks/handlers.ts (step POST Location header formatting)

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

The tool only exposed create. Add action param (create/list/update/delete)
with backward-compatible default. Validate comment_id for update/delete,
body for create/update.
Base POST steps mock returned 200+JSON body instead of 201+Location
header with empty body like the real API. This meant the client's
201+Location follow logic was never exercised by the base handler.

Add GET /steps/:stepId handler and lastCreatedStep storage to support
the follow. Add test for creating a step with completed: true.

Closes #24
@davegomez davegomez force-pushed the fix/24-step-mock-status-code branch from ecbc089 to 780ba61 Compare February 1, 2026 18:22
@davegomez davegomez merged commit 13c42e0 into main Feb 1, 2026
1 check passed
@davegomez davegomez deleted the fix/24-step-mock-status-code branch February 1, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant