fix(medusa): cart now returns 404 when not found (#13622)

FIXES #10218 
FIXES CORE-739
This commit is contained in:
William Bouchard
2025-09-30 06:49:17 +00:00
committed by GitHub
parent f970e1355a
commit 9d3c71fefd
3 changed files with 26 additions and 5 deletions
@@ -9,11 +9,7 @@ import {
PromotionStatus,
PromotionType,
} from "@medusajs/utils"
import {
createAdminUser,
generatePublishableKey,
generateStoreHeaders,
} from "../../../../helpers/create-admin-user"
import { createAdminUser, generatePublishableKey, generateStoreHeaders, } from "../../../../helpers/create-admin-user"
import { setupTaxStructure } from "../../../../modules/__tests__/fixtures"
import { createAuthenticatedCustomer } from "../../../../modules/helpers/create-authenticated-customer"
import { medusaTshirtProduct } from "../../../__fixtures__/product"
@@ -152,6 +148,17 @@ medusaIntegrationTestRunner({
).data.promotion
})
describe("GET /store/carts/[id]", () => {
it("should return 404 when trying to fetch a cart that does not exist", async () => {
const response = await api.get(
`/store/carts/fake`,
storeHeadersWithCustomer
).catch((e) => e)
expect(response.response.status).toEqual(404)
})
})
describe("POST /store/carts", () => {
it("should successfully create a cart", async () => {
const response = await api.post(