feat(seeder): expand dev data variety for full feature coverage#30
Merged
Conversation
…d products The home page fetches the 4 newest products (ORDER BY created_at DESC). Quote-only products (null price) were seeded last, giving them the highest created_at timestamps and causing all 4 front-page slots to show items with no price. Seeding them first ensures priced products are the newest and appear on the home page instead. Adds a test that asserts none of the 4 newest products have a null price.
Adds the following to close gaps identified in the seeder audit: Products - 8 new ACTIVE products (seed starting mix, raised bed soil, kneeling pad, plant labels, drip irrigation kit, hose nozzle, neem oil, tomato fertiliser) bringing active count to 22 — storefront pagination is now exercisable - 1 DRAFT product (bamboo grow stakes) and 1 ARCHIVED product (copper watering can); neither is assigned to a collection Inventory - Out-of-stock item: adjustable hose nozzle (qty = 0, DENY policy) - Low-stock item: neem oil concentrate (qty = 3) - Inventory transaction ledger seeded with RECEIVED, SOLD, DAMAGED, and ADJUSTED entries for four SKUs Users & orders - Two new customers: [email protected] and [email protected] (password: password) - Alice order 1: PAID with WELCOME10 discount applied (discount_id + discount_amount set, used_count incremented) - Alice order 2: PARTIALLY_FULFILLED with one item shipped (fulfillment status SHIPPED, one fulfillment item) - Bob order 1: PAID (gloves + terracotta pot) Return requests - APPROVED return (Alice, EXCHANGE resolution — wrong item) - REJECTED return (Bob, staff declined damage claim) All four statuses (PENDING, COMPLETED, APPROVED, REJECTED) now present B2B - 2 additional quote statuses: REJECTED and EXPIRED (all 6 used statuses covered) - Company approval rule: orders >= $500 require MANAGER approval - 2 departments: Procurement and Retail; B2B manager assigned to Procurement Discounts - FREESHIP50: FREE_SHIPPING type, min order $50 — covers the third discount type that was previously unseeded Reviews - Alice: 1-star on sunflower mix (verified purchase) - Bob: 2-star on lavender (unverified) - B2B member: 1-star on glazed planter, status HIDDEN (moderation testing) Tests - Updated row-count assertions (products 14→24, collection_products 14→22) - Updated image counts (product images 31→47, blobs 35→51) - New assertions for every gap category above - Fixed front-page price test to operate on 4 newest products (not 4 variant rows from a joined query)
The payment reconciliation scheduler queries for PENDING_PAYMENT orders where stripe_session_id IS NOT NULL and created_at < 15 minutes ago. The seeded order was 1 hour old with a fake session ID, causing the scheduler to call Stripe.retrieveSession every 10 minutes in local dev and log a warning on every run. Nulling the session ID represents a valid state (checkout not yet started) and keeps the scheduler from touching it. A test asserts no seeded PENDING_PAYMENT order carries a stripe_session_id.
stripe_payment_intent_id was set on every PAID/FULFILLED/REFUNDED/PARTIALLY_FULFILLED order using placeholder values (pi_test_seed_*). In the demo environment this would cause adminRefundOrder() to call Stripe.createRefund() with an invalid ID the moment an admin clicks Refund — resulting in a live Stripe API error. Drop stripe_payment_intent_id from all order INSERTs. stripe_session_id is kept where needed as a lookup key in seedAdditionalReturnRequests(); it carries no Stripe API risk since syncPaymentFromStripe() guards against non-PENDING_PAYMENT status. Add test: seeder_noPaidOrderHasStripePaymentIntentId asserts no seeded order has a stripe_payment_intent_id set.
3 tasks
Bob's order was seeded with firstVariantOf(gloves) which resolves to
SKU-G-S-GRN (Small/Forest Green — the first inserted variant).
The return-request lookup queried by SKU-G-M-GRN, returning 0 rows
and throwing EmptyResultDataAccessException at startup.
Use variantIdBySku("SKU-G-M-GRN") in seedAdditionalOrders so the
order item and the return lookup reference the same variant.
Four tests had stale expected values that didn't account for the additional seeding methods added in this branch: - seeder_b2bQuoteRequestStatusesPresent: add REJECTED and EXPIRED - seeder_productReviewsExist: 6→8 (two new PUBLISHED reviews) - seeder_verifiedPurchaseReviewsPresent: 5→6 (Alice verified purchase) - seeder_returnRequestStatusesPresent: add APPROVED and REJECTED
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses gaps identified in a seeder audit where several feature areas had no data to exercise them during development.
Products
Inventory
Users & orders
[email protected]and[email protected](password:password)WELCOME10applied (discount_id+discount_amountset,used_countincremented)Return requests
B2B
Discounts
Reviews
Tests
Updated: product/collection count assertions, image count assertions, order status coverage, user list, discount code list, inventory level floor.
New tests for every gap category: out-of-stock, low-stock, inventory transactions, discounted order, PARTIALLY_FULFILLED, all return statuses, all quote statuses, approval rules, departments, review rating distribution, HIDDEN review, FREE_SHIPPING discount.