fix: resolve CI test failures (carts, stripe, shipping, scaffold, cart session)
Some checks failed
CI / Lint, Typecheck & Test (push) Failing after 2m13s

- carts.test: add required product fields (parentCategorySlug, childCategorySlug)
  and variant fields (weight, weightUnit)
- stripeActions.test: use price in cents (2499) for variant/cart and expect
  unit_amount: 2499 in line_items assertion
- useShippingRate.test: expect fallback error message for plain Error rejections
- scaffold.test: enable @ alias in root vitest.config for storefront imports
- useCartSession.test: mock useConvexAuth instead of ConvexProviderWithClerk
  for reliable unit tests

Made-with: Cursor
This commit is contained in:
2026-03-08 01:05:51 +03:00
parent 23efcab80c
commit 9013905d01
5 changed files with 32 additions and 13 deletions

View File

@@ -129,7 +129,7 @@ async function setupFullCheckoutContext(
productId,
name: "1kg Bag",
sku: "PK-001",
price: overrides?.price ?? 24.99,
price: overrides?.price ?? 2499,
stockQuantity: overrides?.stockQuantity ?? 50,
isActive: overrides?.isActive ?? true,
weight: 1000,
@@ -151,7 +151,7 @@ async function setupFullCheckoutContext(
productId,
variantId,
quantity: 2,
price: overrides?.price ?? 24.99,
price: overrides?.price ?? 2499,
},
],
createdAt: Date.now(),
@@ -294,7 +294,7 @@ describe("stripeActions.createCheckoutSession", () => {
price_data: {
currency: "gbp",
product_data: { name: "Premium Kibble — 1kg Bag" },
unit_amount: Math.round(24.99 * 100),
unit_amount: 2499,
},
quantity: 2,
});