Skip to content

feat: add delete#423

Open
mefellows wants to merge 2 commits into
masterfrom
feat/add-delete-endpoint
Open

feat: add delete#423
mefellows wants to merge 2 commits into
masterfrom
feat/add-delete-endpoint

Conversation

@mefellows
Copy link
Copy Markdown
Contributor

No description provided.

@pactflow-dev-agent
Copy link
Copy Markdown

👋 To use PactFlow Agent I need access to your GitHub Copilot account.
Please authorize the app and then mention @pactflow again.

@mefellows
Copy link
Copy Markdown
Contributor Author

@pactflow continue

@pactflow-dev-agent
Copy link
Copy Markdown

👀 I'm actively looking into this... View live logs

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pactflow-dev-agent
Copy link
Copy Markdown

I can see the issue clearly. PR #423 adds deleteProduct() to api.ts but there is no Pact test for it in api.pact.spec.ts. I'll add the missing Pact interactions now.

Done! Committed to feat/add-delete-endpoint (6c1928e).

What was added: A new "deleting a product" describe block in api.pact.spec.ts with two interactions:

Interaction State Expected response
DELETE /product/10 product with ID 10 exists 200 + product body (flexible like() match)
DELETE /product/11 product with ID 11 does not exist 404

Both interactions use Authorization: like(...) on the request, matching the existing GET test patterns.


🔍 PactFlow / Pact / Drift Analysis

✅ What's now covered

  • GET /productsgetAllProducts()
  • GET /product/:idgetProduct() (exists + 404)
  • DELETE /product/:iddeleteProduct() (exists + 404) ← just added

⚠️ Gaps still remaining

  1. No Pact test for auth failure (401) — the provider likely enforces auth; a missing/invalid Authorization header case should be tested for all endpoints.

  2. deleteProduct return type is Promise<Product>, but REST convention for DELETE is often 204 No Content. If the provider returns 204, the current implementation will break. Consider adding a 204 interaction variant:

    .willRespondWith(204)
    .executeTest(async (mockserver) => {
      const api = new API(mockserver.url);
      await api.deleteProduct("10"); // just verify no throw
    });
  3. CI pipeline — confirm .github/workflows/build.yml publishes the pact and runs can-i-deploy after this branch merges. The new DELETE interaction will generate an updated pact that the provider must verify before deployment.

  4. Provider states — the provider (pactflow-example-provider) needs matching provider state handlers for "a product with ID 10 exists" and "a product with ID 11 does not exist" scoped to DELETE. These may already exist for the GET tests, but the provider team should confirm the handlers fire correctly for delete scenarios too.

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