# user-ui — Jest page-by-page test case catalogue > **Implemented.** These cases now live as a runnable suite in > [`tests/`](./tests/) (52 files, 1166 `it()` blocks; 1145 catalogue rows plus a > few thin flash/route smoke cases). See [`tests/README.md`](./tests/README.md) > for the harness, fixtures and authoring rules. Run with > `cd apps/user-ui && bun run test`; typecheck with `bun run test:typecheck`. > Rows whose current code differs from the wording below are pinned as > `(current)` with a comment in the corresponding test. This is the replacement checklist for the deleted `apps/user-ui/tests` suite. It is written page-first: every route file under `app/` gets its own test file, and every page gets cases for loading, error, empty, populated, auth, refresh, navigation, API payloads, validation and the edge cases that only show up with unusual data. - **Runner:** `jest-expo` + `@testing-library/react-native` - **Network:** mock at the tRPC/axios layer, not inside components - **State:** keep the real Zustand stores, hooks and router mocks; reset stores and storage in `beforeEach` - **One row = one `it()`** unless the row says “table test” - **Preferred file layout:** `apps/user-ui/tests/pages/.test.tsx` --- ## 1. Shared fixtures Use these names in the cases below so the expected values stay consistent. | Fixture | Value | Used by | | --- | --- | --- | | `CONSTS` | `freeDeliveryThreshold: 249`, `deliveryCharge: 15`, `flashFreeDeliveryThreshold: 199`, `flashDeliveryCharge: 25`, `isFlashDeliveryEnabled: true`, `boundId: 7`, `supportMobile: '8688182552'`, `supportEmail: 'support@freshyo.in'`, `versionNum: '1.2.0'`, `internalAppVersion: 2` | home, cart, checkout, wrappers | | `CONSTS_FLASH_OFF` | `CONSTS` with `isFlashDeliveryEnabled: false` | flash gate, product detail | | `P_CHICKEN` | id `2`, name `Chicken Breast`, price `215`, marketPrice `220`, unitNotation `500g`, incrementStep `1`, storeId `1`, images `['chicken.jpg']` | home, cart, store, search | | `P_CUCUMBER` | id `5`, name `Cucumber`, price `15`, marketPrice `20`, unitNotation `500g`, storeId `1` | home, cart, store | | `P_OUT` | id `6`, name `Mutton`, price `400`, marketPrice `450`, storeId `1` | out-of-stock cases | | `P_FLASH` | id `8`, name `Paneer`, price `90`, flashPrice `75`, unitNotation `200g`, storeId `1` | flash cases | | `P_COMBO` | id `150`, name `Family Combo`, productType `combo`, price `599`, storeId `1`, comboItems `[P_CHICKEN, P_CUCUMBER]` | product detail, offers | | `P_OFFER` | id `7`, name `Offer Chicken`, price `199`, isOffer `true`, storeId `1` | offers | | `P_COMBO_ONLY` | id `149`, name `Combo Only SKU`, `isComboOnly: true` | catalogue filtering | | `P_NO_IMAGE` | id `9`, name `No Image Item`, price `10`, images `[]` | image fallback | | `P_NO_SLOT` | id `10`, name `No Slot Item`, price `50`, exists in products but not in any slot | “unavailable” cases | | `TAGS` | `[{id:1,tagName:'Chicken',productIds:[2,6,9]}, {id:2,tagName:'Vegetables',productIds:[5]}, {id:3,tagName:'Empty',productIds:[]}]` | tag strip/grid | | `AVAILABILITY` | Chicken price 215/market 220/flash false/inStock; Cucumber 15/20; Mutton outOfStock; Paneer flash true; P_OFFER offer true | catalogue merge | | `SLOTS` | `S1` today +2h, freeze +1h, products `[2,5]`; `S2` today +4h, freeze +3h, products `[2,8]`; `S3` yesterday, freeze yesterday, products `[2]`; `S4` today +6h, freeze +5h, products `[2,5,8]` | home, cart, slot view | | `STORES` | `[{id:1,name:'The Freshyo Meat House',productCount:12,sampleProducts:[P_CHICKEN,P_CUCUMBER]}, {id:2,name:'Freshyo Greens',productCount:2,...}]` | stores | | `STORE_DETAIL_1` | store 1 plus tags `[{id:1,tagName:'Chicken',productIds:[2]}, {id:2,tagName:'Veg',productIds:[5]}]`, products `[P_CHICKEN,P_CUCUMBER]` | store detail | | `ADDRESSES` | `A1` Home, region 1, coords `(17.0,78.0)`, default; `A2` Work, region 2, coords `(18.0,79.0)`; `A3` NoRegion, region null, no coords | cart/checkout/addresses | | `COUPONS` | `C1` `SAVE10` 10% max 50; `C2` `FLAT100` flat 100; `C3` `MIN1000` flat 50 minOrder 1000; `C4` `TARGET10` 10% skuIds `[2]`; `C5` `EXCLUSIVE` exclusiveApply flat 20; `C6` `USED` used up; `C7` `OTHERREGION` region 2; `C8` `FIRST` firstOrderOnly | cart/checkout | | `ORDERS` | `O1` pending scheduled 2 items; `O2` flash; `O3` cancelled with reason; `O4` success; `O5` 3 items; `O6` with notes/discount/delivery | me/next-order | | `CART_REG` | Chicken qty 2 in slot `S1`; line id 1 | cart/checkout | | `CART_FLASH` | Paneer qty 1 in slot 0; line id 1 | flash cart/checkout | | `AUTH_USER` | `{id:5,name:'Test User',email:'test@example.com',mobile:'9876543210'}` | all signed-in pages | ### Global reset rules 1. Reset all Zustand stores: address, app, cart, flash cart, central product, central slot, checkout, location, navigation, quick delivery, region and store header. 2. Clear `StorageServiceCasual` (`cart_items`, `flash_cart_items`, `authToken`, `userId`, `otp_sent_time`, `isFirstTimeUser`, `freshyo_pending_address`, `auth_redirect_state`, `region_carts_*`, `essential_consts_b*`). 3. Clear all Jest mocks and fake timers. Use real timers only for tests that do not depend on debounce/countdown. 4. Mock router `push`, `replace`, `back`, `dismissTo`, `dismissAll`, `canGoBack`, `useLocalSearchParams`. 5. For page tests, mock `expo-router` only for navigation; keep `common-ui` components real. 6. Every case that presses a button which calls the API must assert the procedure name and the exact input (use `lastProcedureInput`). --- ## 2. Page → test file map | Page / route | Test file | Main mocks | | --- | --- | --- | | `app/_layout.tsx` | `tests/app/root-layout.test.tsx` | fonts, health, update, webview, first-user, auth | | `app/index.tsx` | `tests/app/index.test.tsx` | auth | | `app/(auth)/_layout.tsx` | `tests/app/auth-layout.test.tsx` | auth | | `app/(drawer)/_layout.tsx` | `tests/app/drawer-layout.test.tsx` | auth, app store | | `app/(auth)/login.tsx` | `tests/pages/login.test.tsx` | auth mutations, storage, timers | | `app/(auth)/register.tsx` | `tests/pages/register.test.tsx` | register | | `home/index.tsx` | `tests/pages/home.test.tsx` | products, availability, tags, slots, stores, orders, consts | | `home/search-results/index.tsx` | `tests/pages/search-results.test.tsx` | products, availability | | `home/slot-view/index.tsx` | `tests/pages/slot-view.test.tsx` | slots, products, stores | | `home/product-detail/[id].tsx` | `tests/pages/product-detail-home.test.tsx` | product details, reviews, cart, slots | | `home/cart.tsx` | `tests/pages/cart.test.tsx` | cart storage, slots, coupons, addresses, consts | | `home/checkout.tsx` | `tests/pages/checkout.test.tsx` | cart, slots, coupons, addresses, consts | | `home/order-success.tsx` | `tests/pages/order-success.test.tsx` | none | | `order-again/index.tsx` | `tests/pages/offers.test.tsx` | products, availability | | `order-again/product-detail/[id]/index.tsx` | `tests/pages/product-detail-offers.test.tsx` | product details | | `stores/index.tsx` | `tests/pages/stores.test.tsx` | stores | | `stores/store-detail/[id].tsx` | `tests/pages/store-detail.test.tsx` | stores, products | | `stores/store-detail/product-detail/[id].tsx` | `tests/pages/product-detail-store.test.tsx` | product details | | `flash-delivery/index.tsx` | `tests/pages/flash-index.test.tsx` | router | | `flash-delivery/(products)/index.tsx` | `tests/pages/flash-products.test.tsx` | products, slots, flash cart | | `flash-delivery/product-detail/[id].tsx` | `tests/pages/product-detail-flash.test.tsx` | product details, flash cart | | `flash-delivery/(cart)/cart.tsx` | `tests/pages/flash-cart.test.tsx` | cart storage, slots | | `flash-delivery/checkout.tsx` | `tests/pages/flash-checkout.test.tsx` | cart, slots | | `flash-delivery/order-success.tsx` | `tests/pages/flash-order-success.test.tsx` | none | | `me/_layout.tsx` | `tests/pages/me-layout.test.tsx` | auth | | `me/index.tsx` | `tests/pages/me-hub.test.tsx` | auth, orders, addresses | | `me/addresses/index.tsx` | `tests/pages/addresses.test.tsx` | addresses, regions, location | | `me/coupons/index.tsx` | `tests/pages/coupons.test.tsx` | coupons | | `me/complaints/index.tsx` | `tests/pages/complaints.test.tsx` | complaints, consts | | `me/edit-profile/index.tsx` | `tests/pages/edit-profile.test.tsx` | auth, profile, delete account | | `me/my-orders/index.tsx` | `tests/pages/my-orders.test.tsx` | orders | | `me/my-orders/[id].tsx` | `tests/pages/order-detail.test.tsx` | order details, complaint | | `me/terms/index.tsx` | `tests/pages/terms.test.tsx` | none | | route `_layout.tsx` files | `tests/app/route-layouts.test.tsx` | header store | | shared components | `tests/components/*.test.tsx` | their own page mocks | | hooks/stores/lib/context | `tests/lib/*.test.ts` | direct unit tests | --- ## 3. App bootstrap and layouts ### `tests/app/root-layout.test.tsx` | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | ROOT-01 | happy | `useFonts` returns `[false]` | renders `null`; no provider tree | | ROOT-02 | happy | `useFonts` returns `[true]` | `app-root`, QueryClient, tRPC provider and `Stack` are mounted | | ROOT-03 | edge | health check is pending | children still render; no error screen | | ROOT-04 | error | `common.healthCheck` rejects | shows “Service Unavailable”; retry calls `healthCheck` again | | ROOT-05 | edge | `HealthTestWrapper` backend version `1.3.0`, local `1.2.0`, iOS URL set | “Update Available” dialog; tapping opens the App Store URL | | ROOT-06 | edge | Android and `playStoreUrl` set | update dialog opens the Play Store URL | | ROOT-07 | edge | versions equal or local newer | no update dialog | | ROOT-08 | error | app version malformed or backend version malformed | no dialog, no crash | | ROOT-09 | happy | `isFirstTimeUser` absent | “Hello Happy Shopping”; Next stores `'false'` and reveals children | | ROOT-10 | edge | storage value `'false'` | children render directly | | ROOT-11 | edge | storage value `'true'` or arbitrary | welcome screen renders | | ROOT-12 | happy | `webviewHtml` absent | children render | | ROOT-13 | edge | `webviewHtml` present, not closable | WebView renders and children are hidden | | ROOT-14 | edge | closable WebView | close button hides WebView and shows children | | ROOT-16 | edge | remote internal version ahead | alert shown once; Update & Restart calls `fetchUpdateAsync` then `reloadAsync` | | ROOT-17 | error | update fetch/reload rejects | alert stays/does not crash | | ROOT-18 | happy | back press on home with empty stack | `Exit App` alert; Exit calls `BackHandler.exitApp`; returns `true` | | ROOT-19 | edge | back press on non-home route | returns `false`; no alert | | ROOT-20 | edge | back press while stack can go back | returns `false` | | ROOT-21 | edge | `FirstUserWrapper` while storage read pending | renders `null` (splash gap) | | ROOT-22 | happy | back handler unmounts | subscription.remove called | | ROOT-23 | happy | notification provider registers a token | token + permission exposed to children | | ROOT-24 | error | push registration rejects with permission error | permission is `denied` | | ROOT-25 | edge | push registration rejects for any other reason | error path does not set granted/denied | | ROOT-26 | happy | foreground notification received | `NotificationToast` called with title/body/data | | ROOT-27 | happy | notification response with `doctorId` | router pushes home | | ROOT-28 | happy | notification response with `tokenId` | router pushes home | | ROOT-29 | edge | notification listener cleanup on unmount | both subscriptions removed | ### `tests/app/index.test.tsx` and layouts | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | APP-01 | edge | auth `isLoading` true | large spinner rendered | | APP-02 | happy | auth settled, authenticated | `Redirect` to `/(drawer)/(tabs)/home` | | APP-03 | edge | auth settled, signed out | still redirects home; auth walls are per-page | | APP-04 | edge | auth layout loading | spinner, no stack | | APP-05 | happy | auth layout loaded | auth stack renders | | APP-06 | edge | drawer layout loading | brand loading spinner (visible on white) | | APP-07 | happy | drawer layout loaded | five tabs: Home, Offers, center 1 Hr Delivery, Stores, Me | | APP-08 | edge | `hideTabsNav` has one true key | tab bar style is `display: none` | | APP-09 | edge | all hide keys false | tab bar visible | | APP-10 | edge | center flash tab | gradient flash button is rendered with accessibility state | | APP-11 | happy | `flash-delivery` index | redirects to `(products)` | | APP-12 | edge | flash base consts undefined | flash products render because layout defaults enabled to true | | APP-13 | edge | `isFlashDeliveryEnabled: false` | “1 Hr Delivery Unavailable”; “Go to Scheduled Delivery” replaces home | | APP-14 | edge | `isFlashDeliveryEnabled: true` | `Slot` children render | | APP-15 | edge | product-detail layout title set | navigation title updates | | APP-16 | edge | title empty | fallback “Product Details” | | APP-17 | edge | store detail title set | title updates; product-detail child header hidden | | APP-18 | edge | coupons opened with `from=cart` | header back hidden; in-page back button visible | | APP-19 | edge | coupons opened without `from` | header back visible; no in-page back | | APP-20 | edge | me layout loading | “Loading...” | | APP-21 | edge | me layout signed out | login wall copy “Log in to view your profile, orders and more.” | | APP-22 | happy | me layout signed in | stack renders | | APP-23 | edge | my-orders stack | titles “My Orders” and “Order Details” | | APP-24 | edge | home/search/slot/product layouts | floating cart bar mounted where the layout includes it | --- ## 4. Login — `tests/pages/login.test.tsx` Mock: `user.auth.sendOtp`, `verifyOtp`, `login`; storage; `Alert.alert`; fake timers for the 120s resend countdown. | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | LOGIN-01 | happy | initial mount | “Welcome”; mobile step; terms checkbox checked; Continue enabled | | LOGIN-02 | edge | no `otp_sent_time` | `canResend` becomes true | | LOGIN-03 | edge | stored time 30s ago | countdown 90s; resend disabled; label “Resend in 90s” | | LOGIN-04 | edge | stored time 2min+ ago | countdown 0; “Resend OTP” enabled | | LOGIN-05 | edge | stored time malformed | treated as no timestamp; no crash | | LOGIN-06 | edge | countdown ticks below 1 | canResend true; countdown 0; interval cleared | | LOGIN-07 | edge | unmount while countdown active | interval cleared | | LOGIN-08 | error | empty mobile + Continue | “Mobile number is required”; no `sendOtp` | | LOGIN-09 | error | mobile `5876543210` | “Please enter a valid 10-digit mobile number”; no API | | LOGIN-10 | error | mobile 9 digits | same validation error | | LOGIN-11 | edge | typing letters/spaces | only digits kept; max 10 | | LOGIN-12 | happy | valid `9876543210` | `sendOtp({mobile:'9876543210'})` | | LOGIN-13 | happy | `sendOtp` success true | stores timestamp; moves to OTP step; alert with server message; countdown 120 | | LOGIN-14 | error | `sendOtp` success false | alert with server message; stays on mobile | | LOGIN-15 | error | `sendOtp` rejects | alert uses error message; falls back to “Failed to send OTP” | | LOGIN-16 | edge | terms unchecked | Continue disabled; calling submit directly alerts “Please accept the Terms and Conditions to continue” | | LOGIN-17 | happy | open terms link | Terms dialog; Cancel/OK close it | | LOGIN-18 | edge | OTP empty or fewer than 4 digits | “Please enter a valid OTP”; no `verifyOtp` | | LOGIN-19 | happy | four OTP digits typed | each digit fills one cell; focus moves forward | | LOGIN-20 | edge | backspace in a cell | focus moves to the previous cell | | LOGIN-21 | edge | paste `12ab34` | cells `1,2,3,4`; form value `1234`; last cell focused | | LOGIN-22 | edge | paste more than four digits | only first four accepted | | LOGIN-23 | happy | `verifyOtp` returns token + user | `loginWithToken(token,user)`; no alert | | LOGIN-24 | error | `verifyOtp` success false | alert “Verification failed” | | LOGIN-25 | error | `verifyOtp` success true but token/user missing | alert “Verification failed” | | LOGIN-26 | error | `verifyOtp` rejects | alert with error message or “Invalid OTP” | | LOGIN-27 | edge | OTP resend during countdown | press does nothing; pending label “Sending...” when request starts | | LOGIN-28 | happy | resend after countdown | `sendOtp` called with selected mobile | | LOGIN-29 | edge | OTP Back | returns to choice; clears OTP | | LOGIN-30 | edge | Change Number | returns to mobile; clears mobile and errors | | LOGIN-31 | edge | choice “Use Password” | identifier prefilled with selected mobile; password step | | LOGIN-32 | edge | choice “Use OTP” | sends OTP for selected mobile | | LOGIN-33 | edge | OTP “Or login with Password” | password step; identifier selected mobile; OTP cleared | | LOGIN-34 | edge | mobile “other ways to login” | password step; identifier is the current mobile; back returns to mobile | | LOGIN-35 | error | password step empty identifier | “Username is required” | | LOGIN-36 | error | password shorter than 6 | “Password must be at least 6 characters” | | LOGIN-37 | happy | valid identifier + password | `user.auth.login` called; `loginWithToken(response.data.token,user)` | | LOGIN-38 | error | login rejects | alert with server message or “Login failed”; stays on password | | LOGIN-39 | edge | password Back to options | returns to the step it came from; clears password | | LOGIN-40 | edge | pending mutations | button shows Processing/Verifying/Logging in and is disabled | | LOGIN-41 | edge | terms toggled off after typing | submit becomes disabled; on does not call API | | LOGIN-42 | edge | terms dialog content | legal title and sections are visible | --- ## 5. Register — `tests/pages/register.test.tsx` and `tests/components/registration-form.test.tsx` | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | REG-01 | happy | register page | “Create Account”; form fields; “Sign in” action | | REG-02 | edge | tap Sign in | `router.push('/(auth)/login')` | | REG-03 | happy | submit pending | button “Creating Account...”; disabled | | REG-04 | error | page registration rejects | alert “Registration Failed” with message/fallback; loading cleared | | REG-05 | happy | successful registration | `register` called once; page does not navigate directly | | REG-06 | error | empty name | “Name is required” | | REG-07 | error | one-character name | “Name must be at least 2 characters” | | REG-08 | edge | name with spaces around it | trimmed before validation/payload | | REG-09 | error | empty email in registration | “Email is required” | | REG-10 | error | invalid email `a@b` | “Please enter a valid email address” | | REG-11 | edge | uppercase email | lowercased in payload | | REG-12 | edge | email optional in edit mode | empty email accepted | | REG-13 | error | empty mobile | “Mobile number is required” | | REG-14 | error | mobile not 10 digits or not starting 6–9 | format error | | REG-15 | edge | mobile typed with spaces/dashes | digits only, max 10 | | REG-16 | error | empty password | “Password is required” | | REG-17 | error | password shorter than 6 | “Password must be at least 6 characters” | | REG-18 | error | confirm password mismatch | “Passwords do not match” | | REG-19 | error | terms not accepted | “You must accept the terms and conditions”; no submit | | REG-20 | happy | valid registration | payload has trimmed name, lowercase email, digits-only mobile, password | | REG-21 | edge | profile image selected + uploaded | `uploadSingle(blob,mime,'profile')`; payload has `profileImageUrl` key | | REG-22 | edge | image picker returns no asset | no upload; no profile key | | REG-23 | edge | image mime missing | upload uses `image/jpeg` | | REG-24 | error | upload rejects | submit rejects; no `onSubmit`; current form has no upload-error alert (gap: add one) | | REG-25 | edge | upload pending | button “Uploading...”; disabled | | REG-26 | edge | edit mode render | password/confirm/terms hidden; “Update Profile”; “Update Password” | | REG-27 | edge | edit initial values | name/email/mobile/profile image prefilled | | REG-28 | happy | edit submit | payload has name/email/mobile; password omitted unless typed | | REG-29 | edge | edit mode password fields | password/confirm fields are never rendered; `updateProfile` payload omits password | | REG-30 | error | password dialog mismatch | alert “Passwords do not match”; no mutation | | REG-31 | error | password dialog shorter than 6 | alert “Password must be at least 6 characters” | | REG-32 | happy | password dialog valid | `user.auth.updatePassword`; success alert; dialog closes and fields reset | | REG-33 | error | password mutation rejects | alert with message/fallback; dialog stays | | REG-34 | edge | password mutation pending | Update disabled | | REG-35 | edge | cancel password dialog | dialog closes; no API; fields keep their current values (current) | | REG-36 | edge | edit loading | “Updating...” | | REG-37 | edge | profile image initial URI in edit | `ProfileImage` receives it | --- ## 6. Home — `tests/pages/home.test.tsx` Mock `useAllProducts` via `common.essentialConsts` + versioned `products.json` and `availability.json`; `useSlots`; `useStores`; `user.order.getOrders`; consts. ### 6.1 Loading, errors and empty states | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | HOME-01 | happy | products query pending | “Loading products...” | | HOME-02 | error | products request rejects | “Oops!” + “Failed to load products” | | HOME-03 | error | consts request rejects, products succeed | “Failed to load app settings” | | HOME-04 | edge | products resolve with no products/tags | “No products available”; no tag strip | | HOME-05 | edge | tag exists but `productIds` empty | “No products in this category yet” | | HOME-06 | edge | products fetch empty while stores/slots load | page still renders stores/slots independently | | HOME-07 | edge | slots still loading | page renders; no slot strip until data arrives | | HOME-08 | edge | stores fail but products succeed | page still renders; store section omitted (no page error) | ### 6.2 Tags and product grid | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | HOME-09 | happy | `TAGS` loaded | one tab per tag in API order; first tag active | | HOME-10 | happy | first tag has 8 products | first 6 visible; Show More visible | | HOME-11 | happy | tap tag 2 | grid switches to Vegetables; tab underline moves | | HOME-12 | happy | tap Show More | all products in that tag render; button disappears | | HOME-13 | edge | tag has exactly 6 products | no Show More | | HOME-14 | edge | tag has 7 products | Show More; after expand all 7 | | HOME-15 | edge | admin order `productIds` `[5,2]` | cards render in that order | | HOME-16 | edge | duplicate IDs in tag `productIds` | product rendered once (map semantics) | | HOME-17 | edge | unknown ID in tag `productIds` | skipped; no crash | | HOME-18 | edge | out-of-stock product in tag | pushed to the end, admin order preserved within groups | | HOME-19 | edge | `isSlotsLoaded` false and product has no slot | not marked out of stock yet | | HOME-20 | edge | `isSlotsLoaded` true and product has no slots | marked out of stock; moved last | | HOME-21 | edge | product has `isOutOfStock` availability flag | marked out of stock regardless of slots | | HOME-22 | edge | product array contains object without numeric id | omitted from main list without crash | | HOME-23 | edge | active tag removed after refresh | falls back to first tag | | HOME-24 | edge | selected tag changes while expanded | expansion state is per tag | ### 6.3 Main product list and pagination | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | HOME-25 | happy | 20 products | 20 cards; no Show More | | HOME-26 | edge | 21 products | 21 cards; no Show More | | HOME-27 | edge | 22 products | first 21 + Show More | | HOME-28 | happy | tap Show More | 22nd card renders; button hides | | HOME-29 | edge | 50 products | Show More adds 21, then 42, then all | | HOME-30 | edge | product data changes | visible count resets to 21 | | HOME-31 | edge | main list order with out-of-stock | unavailable items last; stable within stock groups | | HOME-32 | happy | tap product card | pushes `/home/product-detail/` | | HOME-33 | happy | tap tag product card | same product-detail route | | HOME-34 | edge | tap add icon on card | sets `cartStore.addedToCartProduct`; does not add directly | | HOME-35 | edge | product already in cart | card shows MiniQuantifier instead of add icon | | HOME-36 | edge | tap stepper in dialog mode | opens the add-to-cart dialog rather than mutating directly | | HOME-37 | edge | out-of-stock card | overlay “Out of Stock”; add icon hidden/disabled | | HOME-38 | edge | image missing | “Image failed to load” fallback | | HOME-39 | edge | market price equal/lower than price | no struck market price | | HOME-40 | edge | combo product in grid | quantity line hidden for combo | ### 6.4 Slots, stores, search and refresh | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | HOME-41 | happy | `SLOTS` loaded | only future delivery/freeze slots; sorted delivery then freeze | | HOME-42 | edge | slot delivery past but freeze future | hidden | | HOME-43 | edge | slot freeze past | hidden | | HOME-44 | edge | more than five future slots | only first five rendered | | HOME-45 | edge | freeze < 4h away | `CLOSING SOON` shown | | HOME-46 | edge | freeze exactly 4h or later | no `CLOSING SOON` | | HOME-47 | edge | slot card label | delivery range, order-by time and date line | | HOME-48 | edge | slot products count | “View all N items” | | HOME-49 | happy | tap slot card | pushes `/home/slot-view?slotId=` | | HOME-50 | happy | stores present | “Our Stores”; every store listed | | HOME-51 | edge | store name starts `The ` | leading `The ` removed in home strip | | HOME-52 | edge | store name has lowercase `the ` | stripped case-insensitively | | HOME-53 | edge | store has no signed image | storefront icon | | HOME-54 | happy | tap store | sets navigation flags and pushes `/stores` | | HOME-55 | edge | stores empty | store section hidden | | HOME-56 | happy | tap search bar | pushes `/home/search-results` | | HOME-57 | edge | search bar is read-only | typing does not change the value | | HOME-58 | happy | pull to refresh | products, availability, stores, slots and consts refetch | | HOME-59 | edge | one refresh request rejects | other requests still run; spinner clears in `finally` | | HOME-60 | edge | `useMarkDataFetchers` invokes refresh | same refetch set | | HOME-61 | edge | refresh while already refreshing | no duplicate spinner/state corruption | | HOME-62 | edge | location bar | region and active address visible; tap opens switcher | ### 6.5 Home add-to-cart dialog and cart bar | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | HOME-63 | edge | no queued product | dialog renders nothing | | HOME-64 | happy | open for Chicken | heading, product name/unit, quantity 1, slots list | | HOME-65 | edge | available slot freeze passed | slot not offered | | HOME-66 | edge | available slot delivery passed but freeze future | slot is offered (current freeze-only filter) | | HOME-67 | edge | no slots and flash unavailable | “Not available in your region right now.”; confirm disabled | | HOME-68 | edge | flash enabled + product flash-eligible | “1 hr Delivery” row | | HOME-69 | edge | flash disabled | no flash row | | HOME-70 | edge | no slot selected | confirm disabled | | HOME-71 | edge | select slot | check icon; confirm enabled | | HOME-72 | happy | confirm regular slot | `addToCart` payload `{skuId, quantity, slotId}`; dialog clears | | HOME-73 | happy | select flash | slot selection cleared; confirm routes to flash products and sets flash store | | HOME-74 | edge | product already in cart | quantity preselected; button “Update Item” | | HOME-75 | edge | stored cart slot is not a region slot | selected slot is null | | HOME-76 | edge | update quantity | `updateCartItem`; dialog closes | | HOME-77 | edge | remove existing line | `removeFromCart`; dialog closes | | HOME-78 | edge | zero/negative quantity | Quantifier guard prevents <1 (or assert current behavior) | | HOME-79 | edge | cancel | store cleared; no mutation | | HOME-80 | edge | pending add/update | button “Adding...”/“Updating...”, disabled | | HOME-81 | happy | floating bar empty regular | “No Items In Cart”; go-to-cart still route | | HOME-82 | happy | floating bar empty flash | “No Flash Items” | | HOME-83 | happy | cart 2 lines of ₹215 | “₹430 • 2 Items”; threshold nudge | | HOME-84 | edge | one line | “1 Item” singular | | HOME-85 | edge | total at/above threshold | “Free Delivery Unlocked” | | HOME-86 | edge | flash cart | uses flash price; flash threshold | | HOME-87 | edge | tap collapsed bar with items | expanded “Your Cart” sheet | | HOME-88 | edge | tap collapsed bar with zero items | does not expand | | HOME-89 | edge | go-to-cart button | regular/flash correct cart route | | HOME-90 | edge | expanded sheet | item count, progress %, Needed amount, subtotal, free badge | | HOME-91 | edge | line price uses stored quantity while local quantity changes | current behavior test | | HOME-92 | edge | mini quantifier update/remove | correct cart mutation and local quantity | | HOME-93 | edge | slot dropdown change | addToCart with new slot; alert “Delivery Updated” | | HOME-94 | edge | stale slot on mount | removes + re-adds in nearest slot | | HOME-95 | edge | stale slot appears after mount | current effect has empty deps; no correction until remount | | HOME-96 | edge | long product name | truncated to 25 chars + ellipsis in bar | | HOME-97 | edge | combo product | unit suffix hidden | | HOME-98 | edge | missing consts | current NaN threshold behavior (pin if retained) | ### 6.6 Next order glimpse | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | HOME-99 | edge | signed out | renders null; `getOrders` not called | | HOME-100 | edge | signed in, orders loading | small spinner card | | HOME-101 | happy | one upcoming order | id, “N items • ₹total”, status | | HOME-102 | edge | confirmed/packaged status | status chip hidden | | HOME-103 | edge | flash order | FLASH + “1-Hour” | | HOME-104 | edge | cancelled order | excluded | | HOME-105 | edge | success delivery order | excluded | | HOME-106 | edge | flash + scheduled orders | flash first | | HOME-107 | edge | multiple flash | newest `createdAt` first | | HOME-108 | edge | multiple scheduled | earliest delivery first | | HOME-109 | edge | no upcoming orders | null | | HOME-110 | edge | support mobile present | “Need help? Call …”; tap opens `tel:` | | HOME-111 | happy | tap order card | navigation target set; `replace('/(drawer)/(tabs)/me')` | | HOME-112 | edge | more than one order | pagination dots; scroll updates active dot | | HOME-113 | edge | delivery > 24h ago | excluded from the glimpse | | HOME-114 | edge | delivery within 24h | still shown | | HOME-115 | edge | scheduled order, no delivery date | excluded | | HOME-116 | edge | flash order, no delivery date | 1-hour promise keeps it visible | | HOME-117 | edge | old flash order, no delivery date | excluded | | HOME-118 | edge | new published version, file pending | previous catalog stays; no “Loading products...” | | HOME-119 | edge | background refresh fails with data present | last catalog stays; no error screen | --- ## 7. Search results — `tests/pages/search-results.test.tsx` | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | SEARCH-01 | happy | no `q` param | “All Products”; all merged products | | SEARCH-02 | edge | `q` initial value | input prefilled; results filtered immediately after debounce | | SEARCH-03 | edge | before 300ms | old results remain | | SEARCH-04 | edge | after 300ms | results update once | | SEARCH-05 | edge | rapid typing | only final query applied; no per-keystroke searches | | SEARCH-06 | edge | query matches name | matching product visible | | SEARCH-07 | edge | query matches shortDescription | matching product visible | | SEARCH-08 | edge | fuzzy typo within threshold | matching product visible | | SEARCH-09 | edge | no match | “No products found”; “Try adjusting your search for …” | | SEARCH-10 | edge | query cleared | all products restored; header “All Products” | | SEARCH-11 | edge | whitespace-only query | treated as empty | | SEARCH-12 | edge | special characters/quotes | no crash; escaped in header | | SEARCH-13 | happy | products pending | “Loading products...” empty component | | SEARCH-14 | error | products request fails | current behavior: “No products found”, not an error screen | | SEARCH-15 | edge | search input focused on mount | `requestAnimationFrame` focus called | | SEARCH-16 | edge | pull to refresh | products refetch | | SEARCH-17 | edge | `useMarkDataFetchers` | products refetch | | SEARCH-18 | happy | tap result | pushes `/home/product-detail/` | | SEARCH-19 | edge | tap add icon | queued add dialog | | SEARCH-20 | edge | floating cart bar | reflects local cart | | SEARCH-21 | edge | combo-only product in cache | hidden | | SEARCH-22 | edge | unmount before debounce | timer cleared; no state update warning | --- ## 8. Slot view — `tests/pages/slot-view.test.tsx` This file covers the route wrapper, `SlotLayout`, `SlotProducts` and the flash product list. ### 8.1 Route and layout | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | SLOT-01 | happy | params `slotId=1849` | page passes 1849 to `SlotProducts` | | SLOT-02 | edge | no `slotId` | `undefined` slot; no crash | | SLOT-03 | edge | `storeId` absent | `Number(undefined)` = NaN; no store filter | | SLOT-04 | happy | slot layout | address selector + drawer + floating cart | | SLOT-05 | edge | drawer store list | ALL + every store; active store styled | | SLOT-06 | edge | no stores | “Loading...” drawer fallback (or empty list if `[]`) | | SLOT-07 | happy | tap ALL | replaces with base URL preserving `slotId` | | SLOT-08 | happy | tap store | sets store id; route includes `slotId` and `storeId` | | SLOT-09 | edge | change delivery slot | sets quick-delivery/slot stores; replaces URL with new slot | | SLOT-10 | edge | drawer hidden | drawer display none | | SLOT-11 | edge | flash layout | delivery header + LocationBar; no store drawer | ### 8.2 Slot products | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | SLOT-12 | happy | slots pending | “Loading slot delivery...” | | SLOT-13 | error | slots reject | “Failed to load slot delivery” | | SLOT-14 | edge | unknown slot id | “No delivery slot available.” | | SLOT-15 | happy | slot products | cards for slot product IDs present | | SLOT-16 | edge | slot product missing from central product store | skipped | | SLOT-17 | edge | slot product out of stock | filtered out | | SLOT-18 | edge | store filter set | only products from that store | | SLOT-19 | edge | store filter with no matches | “No products from this store in this slot.” | | SLOT-20 | edge | no store filter and no products | renders blank list (current no empty copy) | | SLOT-21 | happy | tap add on card | `addToCart(skuId,1,slotId)`; alert “Added … for delivery at …” | | SLOT-22 | edge | slotId undefined | current payload uses 0 | | SLOT-23 | happy | tap card | pushes `/home/product-detail/` | | SLOT-24 | edge | card price | regular price; market strikethrough when higher | | SLOT-25 | edge | combo card | quantity line hidden | | SLOT-26 | edge | out-of-stock card | overlay; add icon still rendered? assert current | | SLOT-27 | edge | image missing | image fallback/no crash | | SLOT-28 | edge | tabs hidden | `hideTabsNav.quick_delivery` true | | SLOT-29 | edge | pull refresh | `onRefresh` is a no-op on the list (current) | ### 8.3 Flash products | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | FLASH-01 | happy | products pending | “Loading 1 Hr Delivery...” | | FLASH-02 | error | products fail, no cache | “Failed to load 1 Hr Delivery” | | FLASH-03 | happy | tag tabs | first tag selected; tabs keep cache order | | FLASH-04 | happy | data | only flash-available + in-stock products of the tag | | FLASH-05 | happy | select another tag | feed swaps to that tag’s products | | FLASH-06 | edge | search query case-insensitive substring | matching products in the active tag | | FLASH-07 | edge | search trimmed/empty | every product in the tag | | FLASH-08 | edge | tag with no eligible products | “No 1 Hr Delivery products available.” | | FLASH-09 | happy | tap add | `addToCart(skuId,1,0)` on flash cart; alert “delivery in 1hr” | | FLASH-10 | happy | tap card | custom `onProductPress` or flash product-detail route | | FLASH-11 | edge | price | flash price if present, else regular | | FLASH-12 | edge | pull refresh | products refetch | | FLASH-13 | edge | no tags | strip hidden; every flash product shows | | FLASH-14 | edge | `FlashAddToCartDialog` queued product | auto-adds once; success clears; alert after 300ms | | FLASH-15 | error | auto-add fails | dialog stays/does not clear; no success alert | | FLASH-16 | edge | focus with `shouldNavigateToCart` | resets flag and pushes flash cart | | FLASH-17 | edge | `shouldNavigateToCart` false | no push | | FLASH-18 | edge | switch tag | client-side only; no router rewrite | | FLASH-19 | happy | 12 products | first 9 render; Show More reveals 12; button disappears | | FLASH-20 | happy | Shop by Store | heading + one tab per store; store 1 grid shows its flash products | | FLASH-21 | edge | empty store | store 2 shows the empty copy; tag section unaffected | --- ## 9. Stores — `tests/pages/stores.test.tsx` | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | STORES-01 | happy | stores pending | “Opening Marketplace...” | | STORES-02 | error | stores fail | “Store Fetch Failed”; Retry refetches | | STORES-03 | edge | stores empty | “No Stores Available” | | STORES-04 | happy | stores loaded | every name, product count, sample product list | | STORES-05 | edge | sample products fewer than count | “+N Discover” card | | STORES-06 | edge | `productCount` equals samples | no +N card | | STORES-07 | edge | `productCount` less than samples | no +N card (negative not rendered) | | STORES-08 | edge | no sampled products | empty horizontal strip | | STORES-09 | edge | store name contains `meat` | halal/preservs banner images | | STORES-10 | edge | store name `MEAT` uppercase | banner still shown (lowercased check) | | STORES-11 | edge | non-meat store | no banner | | STORES-12 | edge | no store image | storefront fallback icon | | STORES-13 | edge | long store name | numberOfLines truncation | | STORES-14 | happy | tap store header | pushes `/stores/store-detail/` | | STORES-15 | happy | tap sample product | same store detail route | | STORES-16 | happy | tap Explore Store | same store detail route | | STORES-17 | edge | deep-link from home | focus effect pushes detail once and clears both flags | | STORES-18 | edge | only `isNavigatedFromHome` true | no navigation | | STORES-19 | edge | only selected store id set | no navigation | | STORES-20 | edge | focus effect runs twice | target cleared so only first run pushes | | STORES-21 | happy | pull refresh | stores refetch | | STORES-22 | edge | mark data fetchers | stores refetch | | STORES-23 | edge | floating cart | visible | | STORES-24 | edge | location bar | region/address visible | --- ## 10. Store detail — `tests/pages/store-detail.test.tsx` | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | STORED-01 | happy | store loading | “Loading store...” | | STORED-02 | edge | store loaded, products loading | “Loading products...” | | STORED-03 | error | store request fails | “Store not found or error loading” | | STORED-04 | edge | store id invalid/NaN | error screen, no crash | | STORED-05 | happy | store loaded | store name, description, tags, products | | STORED-06 | edge | description absent | no description block | | STORED-07 | happy | tags | one chip per tag with `(productIds.length)` | | STORED-08 | happy | tap tag | heading ` items`; only tag products | | STORED-09 | edge | tap same tag again | filter clears; heading `N products` | | STORED-10 | edge | tap Clear | filter clears | | STORED-11 | edge | tag with no products | empty product list + `0 products`/`Tag items` | | STORED-12 | edge | store products include id missing from catalogue | skipped | | STORED-13 | edge | store products order | follows store detail payload order | | STORED-14 | edge | duplicate product IDs | rendered twice? assert current payload mapping | | STORED-15 | happy | tap product | pushes store product-detail route | | STORED-16 | edge | tap add icon | add-to-cart dialog | | STORED-17 | edge | product out of stock | badge/disabled | | STORED-18 | edge | store name contains meat | banner images | | STORED-19 | edge | store header title | `storeHeaderStore.title` set; drawer title set | | STORED-20 | edge | store name changes after refetch | title updates | | STORED-21 | happy | pull refresh | store detail refetch | | STORED-22 | edge | mark data fetchers | store detail refetch | | STORED-23 | edge | floating cart | visible | | STORED-24 | edge | no tags | tag strip absent | --- ## 11. Product detail — four route variants Use one shared component test file plus four route smoke files. Mock `user.product.getProductDetails`, `getProductReviews`, cart and slots. | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | PD-01 | edge | region null | “Loading product details...” and no product query | | PD-02 | happy | region available, query pending | loading copy | | PD-03 | error | query rejects | “Product not found or error loading” | | PD-04 | edge | query succeeds with no product | error copy | | PD-05 | happy | product loaded | name, short/long description, unit, price | | PD-06 | edge | market price present | struck market price + rounded % OFF | | PD-07 | edge | market price absent | no discount block | | PD-08 | edge | market price lower than price | negative percentage current behavior | | PD-09 | edge | marketPrice `0` | no percentage (falsy) | | PD-10 | edge | combo product | no `/ unit`; combo items section | | PD-11 | edge | combo items | names, unit/SKU fallback, offer badge, image fallback | | PD-12 | edge | special deals | quantity/price rows | | PD-13 | edge | store info | “Sourced From” + name | | PD-14 | edge | longDescription absent | “No detailed description available.” | | PD-15 | edge | flash available | “1 Hr Delivery” badge and flash price line | | PD-16 | edge | flash price equals regular | flash price line hidden | | PD-17 | edge | out of stock | “Out of Stock” badge; Add disabled; button “Unavailable” | | PD-18 | edge | no product availability | Add button enabled; out-of-stock unknown | | PD-19 | happy | regular Add to Cart | queues `cartStore.addedToCartProduct` | | PD-20 | happy | regular quantity > 0 | Quantifier; increment/decrement mutates cart | | PD-21 | edge | decrement to 0 | remove mutation | | PD-22 | edge | increment when not in cart | calls add with quickest slot; loading dialog | | PD-23 | error | no quickest slot | alert “No available delivery slot for this product” | | PD-24 | edge | Add while out of stock | no mutation | | PD-25 | happy | slot row tap | add with that slot (or remove then add qty+1) | | PD-26 | edge | slot row for existing cart line | remove then add quantity+1; loading closes | | PD-27 | error | remove in re-add fails | loading closes; no add | | PD-28 | edge | slot rows sorted | earliest delivery first; freeze tie-break | | PD-29 | edge | slot delivery in past but freeze future | still rendered (current no filter) | | PD-30 | edge | more than two slots | “View All N Slots” opens dialog | | PD-31 | edge | all slots dialog | all slots, close button | | PD-32 | edge | out-of-stock | slot rows disabled | | PD-33 | happy | flash Add to Cart | add flash cart with slot 0; loading dialog | | PD-34 | edge | flash product not eligible | alert “This product is not available for flash delivery” | | PD-35 | edge | flash out of stock | Add disabled; CTA “Out of Stock” | | PD-36 | edge | flash no eligibility | CTA “Not Flash Eligible” | | PD-37 | edge | regular product with flash availability and slots | “Get in 1 Hour” CTA | | PD-38 | edge | regular product with flash availability, no slots | CTA “No Slots” disabled | | PD-39 | happy | regular “Get in 1 Hour” | adds to flash cart slot 0; sets flash navigation; routes flash delivery | | PD-40 | happy | flash “Get in 1 Hour” | adds flash cart; routes flash cart with `select=` | | PD-41 | edge | reviews hidden | no “Rate this Product”/review list despite data | | PD-42 | edge | product detail mount | `getProductReviews` still called once with offset 0 because of hidden form logic | | PD-43 | error | review request rejects | silent; product still renders | | PD-44 | happy | pull refresh | product refetch + reviews reset | | PD-45 | edge | header title | `storeHeaderStore.title` set to product name | | PD-46 | edge | image carousel | image URLs passed; no crash when empty | | PD-47 | edge | floating cart | regular vs flash variant | | PD-48 | route | home variant | id param passed; regular cart | | PD-49 | route | store variant | id passed; regular cart | | PD-50 | route | offers variant | id passed; regular cart | | PD-51 | route | flash variant | id passed; `isFlashDelivery` true | --- ## 12. Offers / order again — `tests/pages/offers.test.tsx` | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | OFFER-01 | happy | products pending | “Loading offers...” | | OFFER-02 | error | products fail | “Oops!” + “Failed to load offers” | | OFFER-03 | happy | data | “Offers” and “Combos” sections | | OFFER-04 | edge | no offers | “No offers available right now” | | OFFER-05 | edge | no combos | “No combos available right now” | | OFFER-06 | happy | offers with `isOffer` | only offer products | | OFFER-07 | happy | combos with `productType === 'combo'` | only combos | | OFFER-08 | edge | product both offer and combo | appears in both sections | | OFFER-09 | edge | section exactly 6 products | no Show More | | OFFER-10 | edge | section 7 products | Show More; expands independently | | OFFER-11 | edge | expand Offers | Combos stays collapsed | | OFFER-12 | edge | expand Combos | Offers stays collapsed | | OFFER-13 | edge | no products in either section | both empty messages | | OFFER-14 | happy | tap offer card | `/order-again/product-detail/` | | OFFER-15 | happy | tap combo card | same route | | OFFER-16 | edge | tap add icon | add-to-cart dialog | | OFFER-17 | edge | out of stock | badge/disabled | | OFFER-18 | edge | image missing | fallback | | OFFER-19 | happy | pull refresh | products refetch | | OFFER-20 | edge | mark data fetchers | products refetch | | OFFER-21 | edge | location bar | visible | | OFFER-22 | edge | floating cart | visible | --- ## 13. Cart (scheduled) — `tests/pages/cart.test.tsx` Seed `CART_REG`, `SLOTS`, `ADDRESSES`, `COUPONS` and central stores. Keep `computeCouponStack` real. ### 13.1 Gates, states and header | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | CART-01 | edge | auth loading | “Loading...” | | CART-02 | edge | signed out | login wall copy; cart lines hidden | | CART-03 | edge | login wall Log In | stores redirect state and pushes login | | CART-04 | edge | login wall Go Back | router.back | | CART-05 | edge | cart query pending | “Loading cart...” | | CART-06 | edge | slots pending and regular | still “Loading cart...” | | CART-07 | edge | slots pending and flash | no slots loading gate | | CART-08 | error | cart query fails | “Failed to load your cart” (no retry action) | | CART-09 | edge | addresses pending | “Loading...” | | CART-10 | edge | no addresses | `CartAddressGate` even when cart empty | | CART-11 | edge | gate done | address query refetched | | CART-12 | edge | gate back | router.back | | CART-13 | edge | no region | slots query disabled; page still gates on addresses | | CART-14 | happy | header | “Scheduled Delivery Cart”; back button | | CART-15 | happy | empty cart | “Your cart is empty”; Start Shopping home | | CART-16 | edge | all lines out of stock | list renders, coupons/bill/checkout hidden | | CART-17 | edge | flash variant | “1 Hr Delivery Cart” and flash prices | ### 13.2 Cart lines, quantities and removal | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | CART-18 | happy | seeded line | product name, unit, quantity, price | | CART-19 | edge | tap image/name | product-detail route | | CART-20 | happy | increment quantity | `updateCartItem`; local quantity and line price update | | CART-21 | happy | decrement to 0 | Remove Item alert; Cancel restores 1 | | CART-22 | happy | confirm Remove | `removeFromCart`; cart refetched | | CART-23 | error | remove rejects | alert error; quantity restored to 1 | | CART-24 | happy | delete icon | remove confirmation; success refetch | | CART-25 | error | delete icon remove rejects | alert error | | CART-26 | edge | out-of-stock line | “Out of Stock” badge; no price contribution | | CART-27 | edge | flash-ineligible line in flash cart | “Not available for flash delivery. Please remove” | | CART-28 | edge | no slots for line | “No delivery slots available”; dropdown disabled | | CART-29 | edge | stale selected slot | slot check blocks checkout with “no longer available” | | CART-30 | edge | selected slot freeze passed | slot check blocks with “slot … has closed” | | CART-31 | edge | selected slot not in product slots | unavailable message | | CART-32 | edge | no slots published for SKU | no-slots message | | CART-33 | edge | combo line | unit suffix hidden | | CART-34 | edge | missing product in central store | line likely hidden by `useGetCart`; assert no crash | | CART-35 | edge | quantity zero persisted | line appears with zero? assert current hook behavior | ### 13.3 Slot selection and summary | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | CART-36 | happy | initial load | earliest future slot auto-selected per item | | CART-37 | edge | stored slot still valid | kept | | CART-38 | edge | stored slot invalid | replaced with earliest future | | CART-39 | edge | stored slot past | replaced | | CART-40 | edge | product has no future slots | no selection; dropdown disabled | | CART-41 | edge | dropdown options | future delivery slots only; labels include close time | | CART-42 | happy | change slot | `selectedSlots` updates for that item | | CART-43 | edge | grouping | one row per selected slot; item counts correct | | CART-44 | edge | group details dialog | opens, lists items/quantities, close | | CART-45 | edge | merge suggestion | majority slot only when every in-stock item supports it | | CART-46 | edge | tie for majority | lowest slot id wins | | CART-47 | edge | one group | no merge suggestion | | CART-48 | edge | flash cart | no slot summary | | CART-49 | happy | merge apply | all in-stock lines get majority slot | | CART-50 | edge | out-of-stock line during merge | keeps old slot; not included | | CART-51 | edge | selected slot closed after data refresh | checkout blocked until changed | ### 13.4 Bill, coupons and savings | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | CART-52 | happy | no coupon, total ≥ threshold | Item Total, delivery “Free”, To Pay, savings banner | | CART-53 | edge | total below threshold | delivery charge added; nudge shows exact remaining | | CART-54 | edge | products discount only when savings > 1 | market-price savings row | | CART-55 | edge | market price lower than price | no negative savings | | CART-56 | edge | quantity changes totals | line and bill update | | CART-57 | edge | out-of-stock line excluded from totals | totals only in-stock | | CART-58 | happy | coupon query only authenticated | `getEligible` called; “Offers & Coupons” | | CART-59 | edge | no coupons | “No coupons available” + helper copy | | CART-60 | happy | percent coupon | Save ₹43; discount row; To Pay | | CART-61 | edge | percent cap | capped at maxValue | | CART-62 | happy | flat coupon | discount row | | CART-63 | edge | flat capped at item total | never below zero | | CART-64 | edge | discount drops total below threshold | delivery fee re-added | | CART-65 | edge | minOrder not met | disabled option with reason; cannot select | | CART-65B | edge | targeted coupon, target subtotal below minOrder but whole cart above it | option stays enabled; discount lands only on the targeted SKU | | CART-66 | edge | usage limit reached | disabled option | | CART-67 | edge | other-region coupon | disabled reason | | CART-68 | edge | first-order-only coupon and non-first order | disabled reason | | CART-69 | edge | targeted coupon target rows | unique product names; count matches rows | | CART-70 | edge | target SKU missing from catalogue | “Product unavailable · #id” row | | CART-71 | edge | coupon with both percent and flat | percent display wins (pin current) | | CART-72 | edge | coupon descriptions | percent/flat + min + max copy | | CART-73 | edge | Save preview | marginal saving for adding to current selection | | CART-74 | edge | already-selected coupon | shows its current contribution | | CART-75 | edge | multiple coupons | stack sequentially in selection order | | CART-76 | edge | remove one coupon | other coupons remain; discount recomputes | | CART-77 | edge | remove all coupons | discount rows gone | | CART-78 | edge | exclusive coupon selected | replaces all previous | | CART-79 | edge | add normal coupon after exclusive | replaces exclusive with new one | | CART-80 | edge | deselect coupon | no exclusivity replacement | | CART-81 | edge | quantity drop makes selected coupon ineligible | coupon chip remains, discount removed (current) | | CART-82 | edge | coupons dialog | lists selected coupons, max value line, close | | CART-83 | edge | targeted coupon info icon | opens breakdown; rows sorted by discount desc; only positive rows | | CART-84 | edge | breakdown no positive rows | “No per-product split…” | | CART-85 | edge | breakdown total | total equals coupon row | | CART-86 | edge | breakdown line | quantity × unit price and product name/fallback | | CART-87 | edge | “Add Coupons to account” | navigates coupons with `from=cart` | | CART-88 | edge | delivery instructions | edits global checkout notes | ### 13.5 Address and checkout action | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | CART-89 | happy | address selector | addresses sorted selected/default/id; default auto-selected | | CART-90 | edge | default in another region | not auto-selected | | CART-91 | edge | cross-region address tap | confirmation; cancel no switch | | CART-92 | edge | confirm cross-region | region switch + cart clear + home replace | | CART-93 | edge | unknown target region | “Unavailable region” alert | | CART-94 | edge | add new address | form opens; success auto-selects and invalidates | | CART-95 | edge | attach current location | permission granted -> `updateAddress` with coords | | CART-96 | error | location permission denied | alert; no mutation | | CART-97 | error | location read fails | alert; loading cleared | | CART-98 | edge | selected address without coords | shows “No Location is attached…” | | CART-99 | happy | Checkout regular | route `home/checkout?slots=…&coupons=…&deliveryPrice=…` | | CART-100 | edge | coupon ids | included in route comma-separated | | CART-101 | edge | no coupon | no `coupons` param | | CART-102 | edge | items in multiple slots | grouped `slotId:itemIds;slotId:itemIds` | | CART-103 | edge | all items out of stock | checkout disabled; no bill section | | CART-104 | edge | some items out of stock | out-of-stock lines are silently excluded from the groups; no alert unless an in-stock line lacks a slot | | CART-105 | edge | flash all ineligible | alert “None of the items … flash delivery” | | CART-106 | edge | flash some ineligible | alert “Some Items Not Available” | | CART-107 | edge | regular item without slot | alert “Delivery Slot Required” | | CART-108 | happy | Shop More | regular home / flash flash-delivery | | CART-109 | happy | pull refresh | cart + slots refetch | | CART-110 | edge | mark data fetchers | cart + slots refetch | --- ## 14. Checkout — `tests/pages/checkout.test.tsx` | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | CHECK-01 | edge | unauthenticated | `useAuthenticatedRoute` stores target/query and pushes login | | CHECK-02 | edge | auth loading | no redirect | | CHECK-03 | edge | cart empty | “Your cart is empty”; Back to Shopping | | CHECK-04 | edge | cart lines but no selected slots | “No items to checkout” + slot copy | | CHECK-05 | edge | flash cart lines not flash eligible | “None of your cart items are available for flash delivery” | | CHECK-06 | edge | Back to Shopping | router.back | | CHECK-07 | happy | selected slots | header + Items section | | CHECK-08 | edge | items grouped by slot | groups sorted by delivery time; `Slot #id` fallback | | CHECK-09 | edge | flash | one unlabeled group | | CHECK-10 | edge | item line | name, unit, x quantity, line total | | CHECK-11 | edge | cart item not selected by URL | excluded from items/totals | | CHECK-12 | edge | missing product in central store | blank name/price 0 current behavior | | CHECK-13 | edge | delivery address display | selected address, else default, else no address | | CHECK-14 | edge | address loading | “Loading address...” | | CHECK-15 | edge | coupons in URL | parsed into state | | CHECK-16 | edge | invalid coupon ids | ignored/current behavior | | CHECK-17 | edge | duplicate coupon ids | duplicates preserved (pin current) | | CHECK-18 | edge | coupon param changes | state updates to new list | | CHECK-19 | edge | coupon still eligible | shown in Coupon section with percent/flat label | | CHECK-20 | edge | coupon now ineligible | line-through code + “Not applied” + reason | | CHECK-21 | edge | targeted coupon | info icon; breakdown dialog; total matches | | CHECK-22 | happy | discount calculation | displayed bill matches shared stack | | CHECK-23 | edge | delivery threshold after discount | delivery charge re-added | | CHECK-24 | edge | no coupons | no Coupon section | | CHECK-25 | edge | savings banner | coupon + market savings + free delivery | | CHECK-26 | happy | place order | PaymentAndOrder receives selected items/coupons/totals | | CHECK-27 | edge | provider re-renders from empty to slotted | no Rules-of-Hooks crash | | CHECK-28 | edge | flash pricing | flash price used in items/totals | | CHECK-29 | edge | cart updates while checkout open | selectedItems recompute from cart | | CHECK-30 | edge | item out of stock after cart | excluded from totals/order | | CHECK-31 | edge | selected slot 0 in regular | current truthiness excludes item | | CHECK-32 | edge | coupon stack order | order of URL IDs affects total | | CHECK-33 | edge | no selected address | PaymentAndOrder shows address-required error/disabled | | CHECK-34 | edge | checkout header | scheduled/flash title | | CHECK-35 | edge | back button | router.back | ### PaymentAndOrder shared component | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | PAY-01 | happy | bill with address | rows, enabled Place Order | | PAY-02 | edge | no address | red banner; disabled button | | PAY-03 | edge | no region | pressing alerts “Please select a delivery region…” | | PAY-04 | edge | no valid items (all out-of-stock/no slots/flash-ineligible) | alert “No valid items to order” | | PAY-05 | edge | out-of-stock item filtered | not in payload | | PAY-06 | edge | regular item without selected slot | filtered out | | PAY-07 | edge | flash item eligible | payload `slotId: null` | | PAY-08 | happy | place order payload | `selectedItems`, address, region, bound, couponIds, notes, flash flag | | PAY-09 | edge | no coupons | `couponIds` omitted/undefined | | PAY-10 | edge | selected coupons | ids in same order | | PAY-11 | edge | bound resolution | `constsData.boundId` first, else `useRegion().boundId` | | PAY-12 | happy | success | clears correct cart, invalidates local-cart, getOrders and getEligible | | PAY-13 | edge | success server total | sums all returned order totals | | PAY-14 | edge | server total 0/missing | falls back to `finalTotalWithDelivery` | | PAY-15 | edge | success navigation regular | `./order-success?orderId=…&totalAmount=…` | | PAY-16 | edge | success navigation flash | flash order-success route | | PAY-17 | error | placeOrder rejects | alert message or “Failed to place order”; cart not cleared | | PAY-18 | edge | double press | only one mutate call | | PAY-19 | edge | pending | Place Order disabled; loading dialog | | PAY-20 | edge | onSettled after error | submitting ref and loading reset | | PAY-21 | edge | onCancel provided | “Back to Cart” block; press calls callback | | PAY-22 | edge | COD only | online row disabled; COD selected; no way to choose online | | PAY-23 | edge | free delivery | old charge struck through; “Free” | | PAY-24 | edge | below threshold | nudge exact amount | | PAY-25 | edge | total savings >1 | Total Savings row | | PAY-26 | edge | discount >0 | Product Discount row | | PAY-27 | edge | savings banner | includes coupon + market savings + delivery | | PAY-28 | edge | server returns empty orders array | current code reads `orders[0].id`; pin crash/handle | | PAY-29 | edge | cart clear rejects | clear call is not awaited in `onSuccess`; navigation still runs; current behavior leaves an unhandled rejection (gap) | --- ## 15. Order success — regular and flash | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | SUCCESS-01 | happy | no params | regular success copy; detail block hidden | | SUCCESS-02 | happy | orderId + total | “Order #…” + “Total: ₹…” | | SUCCESS-03 | edge | orderId only | total line hidden | | SUCCESS-04 | edge | total only | detail block hidden | | SUCCESS-05 | edge | total 0 string | renders `₹0` (truthy string) | | SUCCESS-06 | happy | Continue Shopping regular | `dismissTo(home)` | | SUCCESS-07 | happy | View My Orders | `dismissAll` then push my-orders | | SUCCESS-08 | happy | flash copy | “1 Hr Order Placed!” etc. | | SUCCESS-09 | edge | flash Continue Shopping | `dismissTo(flash-delivery)` | | SUCCESS-10 | edge | flash View My Orders | same my-orders route | --- ## 16. Me hub — `tests/pages/me-hub.test.tsx` | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | ME-01 | happy | render | “My Account”; section titles; all menu entries | | ME-02 | edge | region selected | Delivery Address subtitle “Delivering in ” | | ME-03 | edge | no region | “Choose or add an address” | | ME-04 | happy | My Orders | push my-orders | | ME-05 | happy | My Cart | push home/cart | | ME-06 | happy | Coupons | push me/coupons | | ME-07 | happy | Addresses | push me/addresses | | ME-08 | happy | Delivery Address | opens AddressSwitcherSheet | | ME-09 | happy | Profile Settings / settings icon | push edit-profile | | ME-10 | happy | Help & Complaints | push complaints | | ME-11 | happy | Terms | push terms | | ME-12 | happy | Log Out | `logout` called | | ME-13 | edge | navigation target present on focus | `router.replace(target)` | | ME-14 | edge | no navigation target | no replace | | ME-15 | edge | target is consumed | second focus does not replace again | | ME-16 | edge | NextOrderGlimpse | mounted above menu | | ME-17 | edge | Me address bar | absent; Delivery Address menu opens switcher | | ME-18 | edge | address sheet close | modal closes | | ME-19 | edge | version/footer | version text rendered | | ME-20 | edge | signed out | me layout login wall, hub not rendered | --- ## 17. Addresses — `tests/pages/addresses.test.tsx` and `tests/components/address-form.test.tsx` ### 17.1 Address list | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | ADDR-01 | happy | addresses pending | “Loading addresses...” | | ADDR-02 | error | query fails | “Failed to load addresses”; Retry refetches | | ADDR-03 | edge | empty | “No addresses found”; Add Address | | ADDR-04 | happy | list | name, phone, formatted line1/line2/city/state | | ADDR-05 | edge | default address | “Default” badge; no Set Default | | ADDR-06 | edge | non-default | Set Default button | | ADDR-07 | happy | Add | opens modal in add mode | | ADDR-08 | happy | Edit | modal prefilled with address | | ADDR-09 | edge | only one address + delete | “This is your only address…”; no confirm/API | | ADDR-10 | happy | delete >1 | confirm; Cancel no API | | ADDR-11 | happy | confirm delete | `deleteAddress({id})`; refetch; invalidate default; success alert | | ADDR-12 | error | delete rejects | “Cannot delete address” sheet with message; dismiss | | ADDR-13 | edge | delete button while deleting | `isDeleting` is not passed by current list; button does not show “Deleting...” (pin) | | ADDR-14 | error | set default address with null region | alert; no mutation | | ADDR-15 | happy | set default | mutation preserves fields/coords and `isDefault: true` | | ADDR-16 | error | set default rejects | alert error | | ADDR-17 | happy | form success | modal closes; list refetches | | ADDR-18 | edge | mark data fetchers | refetch | | ADDR-19 | edge | address without line2 | formatted without comma | | ADDR-20 | edge | address with Google Maps URL and coords | edit keeps the saved coordinates | | ADDR-21 | edge | vague-backfilled address | edit withholds placeholder coordinates | ### 17.2 AddressForm | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | ADDRF-01 | happy | add mode | “Add Address”; no service-area notice | | ADDRF-02 | edge | edit mode | “Edit Address”; prefilled values | | ADDRF-03 | edge | browsing region known | city preselected | | ADDRF-04 | edge | no browsing region | “Select town” placeholder | | ADDRF-05 | edge | device fix available | auto-resolve; “Current Location Attached” | | ADDRF-06 | edge | device fix resolves out of area | “This location is outside our delivery area…” | | ADDRF-07 | error | resolve request throws | “Could not verify this location…” | | ADDRF-08 | edge | initial coords provided | resolves on mount | | ADDRF-09 | edge | no location | Add disabled; touched name shows “Attach a location to add address” | | ADDRF-10 | happy | open city picker | regions + “Select in Map”; no regions message | | ADDRF-11 | edge | pick city without location | error “Attach or pick a location inside this town.” | | ADDRF-12 | edge | pick city with location, resolveBound success | location/resolved region updated | | ADDRF-13 | edge | pick city with location, resolveBound fails | “Your location is outside this town…” | | ADDRF-14 | edge | map picker from city | opens map at first region center | | ADDRF-15 | edge | location chooser | opens region picker; current region marked | | ADDRF-16 | edge | pick region in chooser | map opens at region center | | ADDRF-17 | edge | select in map from chooser | opens map at first region | | ADDRF-18 | edge | cancel region chooser | closes | | ADDRF-19 | edge | map selection | closes map; resolves coords as `map` source; heading “Location Attached from Map” | | ADDRF-20 | edge | map cancel | closes without changing location | | ADDRF-21 | error | name empty | “Name is required” | | ADDRF-22 | error | phone invalid | 10-digit 6–9 rule | | ADDRF-23 | error | address line 1 empty | required | | ADDRF-24 | edge | state is disabled and prefilled Telangana | cannot edit; validates | | ADDRF-25 | edge | address line 2 optional | empty accepted | | ADDRF-26 | edge | default checkbox | toggles payload `isDefault` | | ADDRF-27 | happy | create submit | payload includes regionId, city name, coords, googleMapsUrl optional | | ADDRF-28 | happy | edit submit | includes `id` and same payload | | ADDRF-29 | edge | draft mode | saves pending address; calls onSuccess with no id; no create API | | ADDRF-30 | error | create/update rejects | submitError visible; loading cleared | | ADDRF-31 | happy | create/update success | onSuccess after 350ms; loading dialog | | ADDRF-32 | edge | pending submit | “Adding...”/“Updating...”; disabled | | ADDRF-33 | edge | map loading | “Loading map...”; error banner | | ADDRF-34 | edge | map message valid | onSelect called | | ADDRF-35 | edge | map message invalid JSON/type | ignored | | ADDRF-36 | edge | map URL with lat/lng | query params present | | ADDRF-37 | edge | map URL without lat/lng | base URL only | | ADDRF-38 | edge | edit + device fix | submits saved coords; device never auto-attached | | ADDRF-39 | edge | edit region differs from browsing | saved address town kept | | ADDRF-40 | edge | attached location outside the service area | submit button disabled | | ADDRF-41 | edge | picked town does not contain the location | submit button disabled | --- ## 18. Coupons — `tests/pages/coupons.test.tsx` | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | COUPON-01 | happy | pending | “Loading coupons...” | | COUPON-02 | error | fail | “Failed to load coupons. Please try again.” | | COUPON-03 | happy | personal + general | “Only for Me” / “Apply to All” | | COUPON-04 | edge | no personal | “No personal coupons available” | | COUPON-05 | edge | no general | “No general coupons available” | | COUPON-06 | edge | status available | green “Available”; Apply enabled | | COUPON-07 | edge | expired | red “Expired”; button “Unavailable” disabled | | COUPON-08 | edge | used up | orange “Used”; disabled | | COUPON-09 | edge | both expired and used | “Expired” wins | | COUPON-10 | edge | maxLimitForUser | “Used: count/max” | | COUPON-11 | edge | no max limit | no usage line | | COUPON-12 | edge | validTill | formatted date | | COUPON-13 | edge | no validTill | “No expiry” | | COUPON-14 | edge | Apply button | current card has no handler; pressing does not navigate/apply | | COUPON-15 | edge | code <4 chars | Add disabled | | COUPON-16 | edge | code 4+ chars | Add enabled | | COUPON-17 | happy | redeem | trims and uppercases `secretCode` | | COUPON-18 | happy | redeem success | clears input; refetch; invalidate getEligible; alert | | COUPON-19 | error | redeem fail | alert message/fallback; input retained | | COUPON-20 | edge | redeem pending | “Adding...”; disabled | | COUPON-21 | edge | from=cart | hides tab bar via app store; cleanup on blur | | COUPON-22 | edge | from=cart back | navigates home/cart | | COUPON-23 | edge | no from | no in-page back | | COUPON-24 | edge | mark data fetchers | refetch | | COUPON-25 | edge | long code/description | no crash/truncation | | COUPON-26 | edge | empty code spaces | disabled | --- ## 19. Complaints — `tests/pages/complaints.test.tsx` | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | CMP-01 | happy | pending | “Loading complaints...” | | CMP-02 | error | fail | “Oops!” + “Failed to load complaints” | | CMP-03 | edge | empty | “No Complaints”; Continue Shopping home | | CMP-04 | happy | header | “Need Help?”; support mobile/email | | CMP-05 | edge | consts support values | overrides defaults | | CMP-06 | happy | Call Us | `Linking.openURL('tel:…')` | | CMP-07 | happy | Email | `Linking.openURL('mailto:…')` | | CMP-08 | edge | item no order | no order badge | | CMP-09 | edge | item with order | “Order #…” badge | | CMP-10 | edge | resolved | green “Resolved” | | CMP-11 | edge | pending | amber “Pending”; “We are reviewing…” | | CMP-12 | edge | response present | blue Support Response block | | CMP-13 | edge | pending with response | no “reviewing” line | | CMP-14 | edge | date formatting | `MMM DD, YYYY • h:mm A` | | CMP-15 | edge | multiple items order | API order | | CMP-16 | happy | pull refresh | refetch | | CMP-17 | edge | mark data fetchers | refetch | | CMP-18 | edge | header still visible when empty | list header renders | --- ## 20. Edit profile — `tests/pages/edit-profile.test.tsx` | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | PROFILE-01 | happy | user details | fields prefilled; image | | PROFILE-02 | edge | no user details | empty form | | PROFILE-03 | happy | update | `updateProfile`; context updated; replace me | | PROFILE-04 | error | update fails | form stays; no navigation; no logout (current gap: no alert) | | PROFILE-05 | edge | update pending | “Updating...” | | PROFILE-06 | edge | email optional in edit | empty email accepted | | PROFILE-07 | edge | update profile | payload never contains a password field (edit form has no password inputs) | | PROFILE-08 | edge | password change | goes through the separate `updatePassword` dialog, not `updateProfile` | | PROFILE-09 | edge | upload profile image | upload first; key included | | PROFILE-10 | happy | Logout | calls logout | | PROFILE-11 | happy | Delete button | opens delete dialog | | PROFILE-12 | edge | delete dialog dismiss | `enableDismiss=false`; modal cannot dismiss by backdrop | | PROFILE-13 | error | empty mobile | alert “Please enter your mobile number”; no API | | PROFILE-14 | happy | confirm delete | `deleteAccount({mobile})` | | PROFILE-15 | edge | delete pending | Delete Forever loading/disabled | | PROFILE-16 | error | delete rejects | “Verification Failed” with message/fallback; dialog stays | | PROFILE-17 | happy | delete success | alert “Account Deleted”; OK closes and logs out | | PROFILE-18 | edge | mobile max length | 15 chars enforced | | PROFILE-19 | edge | cancel delete | closes without API | | PROFILE-20 | edge | password dialog from form | opens and behaves as REG-30..35 | --- ## 21. My orders list — `tests/pages/my-orders.test.tsx` | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | ORDERS-01 | happy | page 1 pending | “Loading your orders...” | | ORDERS-02 | error | page 1 fails | “Unable to load orders”; Retry refetches | | ORDERS-03 | edge | empty | “No orders yet”; Start Shopping home | | ORDERS-04 | happy | one order | id, item summary, amount, delivery status, placed date | | ORDERS-05 | edge | item count singular/plural | “1 Item”/“N Items” | | ORDERS-06 | edge | more than 2 items | shows 2 + “+N more items” | | ORDERS-07 | edge | tap more items | routes to detail | | ORDERS-08 | edge | tap card | routes to detail | | ORDERS-09 | edge | delivery date scheduled | `DD MMM, hh:mm A - hh:mm A` | | ORDERS-10 | edge | flash | “1 Hr Delivery”, created +30m, FLASH badge | | ORDERS-11 | edge | flash missing createdAt | falls back to orderDate | | ORDERS-12 | edge | region name | region pill | | ORDERS-13 | edge | no region | no pill | | ORDERS-14 | edge | cancelled | cancelled status chip + cancel reason | | ORDERS-15 | edge | pending delivery | displayed as “Confirmed” via manipulator | | ORDERS-16 | edge | packaged/delivered/success/cancelled status colors | matching label/icon/color | | ORDERS-17 | edge | discount amount | “Saved ₹…” | | ORDERS-18 | edge | delivery charge >0 | “Delivery: ₹…” | | ORDERS-19 | edge | user notes | “Your Instructions” | | ORDERS-20 | happy | OrderMenu | trigger renders; menu actions work | | ORDERS-21 | happy | page 2 via onEndReached | `getOrders({page:2,pageSize:10})`; appends | | ORDERS-22 | edge | hasNextPage false | footer “End of list” | | ORDERS-23 | edge | page 2 pending | footer “Loading more orders...” | | ORDERS-24 | error | page 2 fails | current behavior: full “Unable to load orders” screen replaces the list; the footer error is not reachable while the query error persists | | ORDERS-25 | edge | retry from full error on page 2 | refetches the current page only; it does not reset `currentPage` to 1 (current) | | ORDERS-26 | edge | onEndReached while loading/!hasNext | no duplicate page fetch | | ORDERS-27 | edge | totalPages missing | no next page | | ORDERS-28 | edge | page 1 response | replaces accumulated list | | ORDERS-29 | edge | page >1 response | appends; no duplicates if API repeats | | ORDERS-30 | happy | pull refresh | resets page/list/flags and refetches | | ORDERS-31 | edge | mark data fetchers | same reset | | ORDERS-32 | edge | pull refresh while page 2 | back to page 1 | | ORDERS-33 | edge | order id key | uses `orderId` string; no duplicate key crash | | ORDERS-34 | edge | flash card FAST badge | rendered | | ORDERS-35 | edge | refunds/payments | no payment/refund UI (COD-only) | --- ## 22. Order detail — `tests/pages/order-detail.test.tsx` | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | OD-01 | happy | pending | “Loading details...” | | OD-02 | error | fetch fails | “Failed to load”; Go Back | | OD-03 | edge | no id | `enabled:false`; error screen; no crash | | OD-04 | happy | order | header id/date/region/flash, status | | OD-05 | edge | flash | “1 Hr Delivery” banner and lightning | | OD-06 | edge | flash delivered | “Flash Delivered on …” | | OD-07 | edge | flash not delivered | estimated date | | OD-08 | edge | scheduled delivered | “Delivered on …” | | OD-09 | edge | scheduled not delivered | no delivered row | | OD-10 | edge | status tracker | maps pending/packaged/success/cancelled | | OD-11 | edge | notes absent | “No instructions added” | | OD-12 | edge | notes present | notes text and Edit | | OD-13 | happy | Add/Edit notes | input opens; Cancel restores; Save calls `updateUserNotes` | | OD-14 | edge | notes save pending | “Saving...”; disabled | | OD-15 | happy | notes save success | closes; refetch; alert | | OD-16 | error | notes save fail | alert; editing stays | | OD-17 | edge | cancel reason present | rose cancellation block | | OD-18 | happy | items | name, qty × unit, price, amount | | OD-19 | edge | missing item image | no crash | | OD-20 | edge | coupon code | coupon block + `-₹discount` | | OD-21 | edge | discount >0 | summary discount row | | OD-22 | edge | delivery charge >0 | summary `₹charge`; else “Free” | | OD-23 | edge | total | uses `order.orderAmount` | | OD-24 | edge | subtotal from item amounts | sum matches fixture | | OD-25 | happy | Raise Complaint | opens complaint dialog | | OD-26 | edge | complaint close | refetches order | | OD-27 | happy | Back | `router.replace(me)` | | OD-28 | edge | Cancel Order visibility | hidden only for exact lower-case `success`/`cancelled` | | OD-29 | edge | status `delivered` | Cancel button still shown (current behavior) | | OD-30 | happy | open cancel dialog | reason field + confirm | | OD-31 | error | blank/whitespace reason | alert; no mutation | | OD-32 | happy | confirm cancel | `cancelOrder({id,reason})`; close; refetch; invalidate orders; alert | | OD-33 | error | cancel fails | alert; dialog stays | | OD-34 | edge | cancel pending | spinner; disabled | | OD-35 | edge | header back button | `router.back` | --- ## 23. Terms — `tests/pages/terms.test.tsx` | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | TERMS-01 | happy | terms page | header “Terms & Conditions”; policy title | | TERMS-02 | happy | content | sections A–E, COD-only, privacy, refunds, contact | | TERMS-03 | edge | back | `router.back` | | TERMS-04 | edge | `TermsAndConditionsContent showTitle=false` | title hidden, sections remain | | TERMS-05 | edge | `compact` | smaller text styles applied (or snapshot of classes) | | TERMS-06 | edge | login terms dialog reuses content | legal content visible in dialog | --- ## 24. Shared component contracts These are used by several pages but deserve direct tests so a page failure tells you whether the page or the component broke. ### AddToCartDialog Already covered by HOME-63..80; add: | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | A2C-01 | edge | product with many slots | sheet scrolls, actions remain visible | | A2C-02 | edge | product with two slots | sheet sizes to content | | A2C-03 | edge | qty update when existing line | remove button visible | | A2C-04 | edge | no cart line | no remove button | | A2C-05 | edge | cart line with different SKU | not considered update | | A2C-06 | edge | `onClose` via backdrop | clears product | ### FloatingCartBar Covered by HOME-81..98, plus: | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | FCB-01 | edge | controlled `isExpanded` prop | parent controls sheet | | FCB-02 | edge | controlled `setIsExpanded` | calls parent | | FCB-03 | edge | flash cart | pink theme | | FCB-04 | edge | cart refetch after mutation | quantities state resets | | FCB-05 | edge | no cart data | no crash | ### CouponBreakdownDialog | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | CBD-01 | edge | coupon null or breakdown null | dialog closed | | CBD-02 | edge | rows with only zero discounts | “No per-product split…” | | CBD-03 | edge | rows sorted descending | largest first | | CBD-04 | edge | unknown SKU | `Product #id` fallback | | CBD-05 | edge | line missing | no qty/price line, row still renders | | CBD-06 | edge | total | truncates discount | | CBD-07 | edge | close button | onClose called | ### OrderStatusTracker | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | OST-01 | edge | pending/processing | only Placed active | | OST-02 | edge | packaged | Placed + Packed active | | OST-03 | edge | success/delivered | all active | | OST-04 | edge | cancelled | none active; labels gray | | OST-05 | edge | null/empty | Placed only | | OST-06 | edge | custom colors | dot/line colors | | OST-07 | edge | testIDs | one dot per stage | ### OrderMenu | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | OM-01 | happy | trigger | menu dialog “Order Options” | | OM-02 | happy | View Details | route detail | | OM-03 | edge | Edit Notes opens after 300ms | timer; empty input | | OM-04 | happy | save notes | trimmed payload; post action; alert | | OM-05 | error | notes fail | alert; dialog stays | | OM-06 | error | cancel blank reason | alert; no API | | OM-07 | happy | cancel success | invalidate orders; post action; alert | | OM-08 | error | cancel fails | alert | | OM-09 | happy | complaint close | post action | | OM-10 | edge | pending states | spinner/disabled | ### ComplaintForm | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | CF-01 | edge | closed | null | | CF-02 | error | blank body | alert; no API | | CF-03 | happy | body only | `raise({orderId,complaintBody,imageUrls:[]})`; refetch; alert; reset; close | | CF-04 | edge | images | upload keys passed | | CF-05 | error | upload fails | alert; no raise | | CF-06 | error | raise fails | alert; form stays | | CF-07 | edge | pending/uploading | disabled/spinner | | CF-08 | edge | remove image | removed from list | | CF-09 | edge | close | onClose; no API | ### LoginWall | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | LW-01 | happy | default copy | “Please log in” / “Log in to continue.” | | LW-02 | edge | custom title/message | rendered | | LW-03 | happy | Log In | stores target/query/timestamp; pushes login | | LW-04 | error | storage fails | still pushes login | | LW-05 | edge | onBack | “Go Back” rendered/called | | LW-06 | edge | no onBack | no Go Back | ### Location components | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | LOC-01 | edge | LocationTestWrapper region known | children | | LOC-02 | edge | not hydrated | spinner | | LOC-03 | edge | resolving | “Finding your region...” | | LOC-04 | edge | no region | fallback flow | | LOC-05 | edge | denied notice | exact notice; settings button | | LOC-06 | edge | services off notice | exact notice; settings button | | LOC-07 | edge | unavailable/error notice | exact notice; no settings button | | LOC-08 | happy | settings Android | location source settings intent | | LOC-09 | edge | settings iOS | `Linking.openSettings` | | LOC-10 | error | settings fails | fallback; no crash | | LOC-11 | edge | stale region not in list | `clearRegion` | | LOC-12 | edge | gate polling false→true | refreshLocation called | | LOC-13 | edge | probe failure | no refresh | | LOC-14 | edge | unmount polling | interval cleared | | LOC-15 | happy | fallback saved address | activates region/bound; sets selected address; closes | | LOC-16 | edge | saved address no region | message | | LOC-17 | edge | bound missing, coords present | resolves bound | | LOC-18 | edge | resolve bound fails | still activates with null | | LOC-19 | edge | target region no longer serviceable | message; no switch | | LOC-20 | edge | active address highlight | selected/default precedence; startup false | | LOC-21 | edge | set default | update payload; invalidate addresses/default | | LOC-22 | error | set default fails | message | | LOC-23 | edge | signed out | login button/footer; addresses not queried | | LOC-24 | happy | login mode | renders Login inline; back returns choose | | LOC-25 | happy | add mode | AddressForm; back returns choose | | LOC-26 | edge | add success | activates resolved region; selects returned id; closes | | LOC-27 | edge | add success signed out | no selected id; closes | | LOC-28 | edge | no addresses signed in | “No saved addresses yet.” | | LOC-29 | edge | busy | overlay spinner; cards disabled | | LOC-30 | happy | LocationBar region/address | text; tap opens sheet | | LOC-31 | edge | LocationBar no region | “Choose your address” | | LOC-32 | edge | LocationBar selected > default | selected wins | | LOC-33 | edge | LocationBar no address | no address line | | LOC-34 | edge | LocationMapStep URL | lat/lng params; base URL without | | LOC-35 | edge | map loading | “Loading map...”; onLoadEnd hides | | LOC-36 | edge | map message valid | onSelect | | LOC-37 | edge | map message invalid | ignored | | LOC-38 | edge | map error banner | rendered | | LOC-39 | edge | map Cancel | onCancel | | LOC-40 | edge | LocationAttacher granted | callback + success badge; clears after 3s | | LOC-41 | error | permission denied | error text; no callback | | LOC-42 | error | location read fails | error text | | LOC-43 | edge | disabled | no permission request | | LOC-44 | edge | initial location | badge shown | | LOC-45 | edge | Google Maps option uncontrolled | button/instructions; no field if controlled | | LOC-46 | edge | CartAddressGate coords | current option enabled; copy coordinates | | LOC-47 | error | no coords | current option disabled + “Turn on location…” | | LOC-48 | edge | gate polling | probe and refresh position | | LOC-49 | edge | gate current mode | AddressForm prefilled device coords | | LOC-50 | edge | gate other mode | AddressForm empty | | LOC-51 | edge | gate form success | modal closes; onDone | | LOC-52 | edge | gate back | onBack | | LOC-53 | edge | QuickDelivery regular | earliest slot label; change slot callback | | LOC-54 | edge | QuickDelivery flash | “within 1 hour”; back; LocationBar | | LOC-55 | edge | startup gate, one non-default address | auto-opens region + selects address | | LOC-56 | edge | regular switcher, one non-default address | no auto-select/close | | LOC-57 | edge | LocationBar long address | one line (`numberOfLines=1`) with tail ellipsis; bar stays 2 lines | | SLOTQ-01 | edge | foreign address | warning; switch confirm; clear cart/home | | SLOTQ-02 | edge | unavailable region | alert | | SLOTQ-03 | edge | no selected/default address | “Select address” | | SLOTQ-04 | edge | slot list unsorted input | current sort mutates input; assert selected earliest | | SLOTQ-05 | edge | no slots | “Select time” | | SLOTQ-06 | edge | selected slot id | formatted range | ### CheckoutAddressSelector / Display | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | CAS-01 | edge | selected address first | sorted first | | CAS-02 | edge | default next | sorted after selected | | CAS-03 | edge | stable id order | others ascending | | CAS-04 | edge | no selected, default same region | auto `onAddressSelect(default)` | | CAS-05 | edge | default other region | no auto-select | | CAS-06 | edge | no region on default | auto-select | | CAS-07 | edge | cross-region tap | confirm dialog | | CAS-08 | edge | cancel switch | no region change | | CAS-09 | edge | confirm switch | `confirmRegionSwitch`; home replace | | CAS-10 | edge | target region missing | “Unavailable region” | | CAS-11 | edge | same-region tap | `onAddressSelect`; scroll reset | | CAS-12 | edge | pagination dots | count; scroll index | | CAS-13 | edge | no addresses | empty card + Add Address | | CAS-14 | edge | attach location selected | update payload coords | | CAS-15 | edge | permission denied | alert; no update | | CAS-16 | edge | location error | alert; loading cleared | | CAS-17 | edge | add new success | auto-select new id; invalidate all | | CAS-18 | edge | display selected | selected address | | CAS-19 | edge | display fallback default | default | | CAS-20 | edge | display none | “No address selected” | | CAS-21 | edge | display loading | “Loading address...” | | CAS-22 | edge | display signed out | query disabled; no crash | ### Static / chrome | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | STATIC-01 | happy | TabLayoutWrapper | children; safe area; style | | STATIC-02 | happy | TestingPhaseNote | title + four bullets | | STATIC-03 | happy | Terms content | full policy | | STATIC-04 | happy | icons focused/unfocused | 10 SVG renders | | STATIC-05 | edge | icon size/color | passed through | --- ## 25. Hooks, stores, lib and context ### Cart hook — `tests/lib/cart-query-hooks.test.tsx` | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | CARTQ-01 | happy | add new item | storage line id 1, qty, slot | | CARTQ-02 | edge | add existing SKU | quantity increment; slot updated when provided | | CARTQ-03 | edge | add existing without slot | slot unchanged | | CARTQ-04 | edge | add without slot | throws “slotId is required…” | | CARTQ-05 | edge | id allocation after gaps | max id + 1 | | CARTQ-06 | happy | update item | quantity persisted | | CARTQ-07 | edge | update missing item | no change | | CARTQ-08 | happy | remove | filtered | | CARTQ-09 | edge | remove missing | no change | | CARTQ-10 | happy | clear | `[]` | | CARTQ-11 | edge | flash cart separate | regular untouched | | CARTQ-12 | edge | corrupt JSON | `getLocalCart` throws; current no fallback | | CARTQ-13 | happy | `useGetCart` enrichment | product price/name/unit/market price | | CARTQ-14 | edge | product missing from store | line hidden | | CARTQ-15 | edge | slot map missing SKU | line hidden | | CARTQ-16 | edge | zero quantity | line preserved | | CARTQ-17 | edge | query disabled until products load | `isLoading` behavior | | CARTQ-18 | happy | totals | subtotal, totalItems, totalAmount | | CARTQ-19 | happy | reconcile valid slot | unchanged | | CARTQ-20 | edge | reconcile invalid slot | nearest by delivery | | CARTQ-21 | edge | reconcile no slots | line kept | | CARTQ-22 | edge | not loaded/empty map | no write | | CARTQ-23 | edge | no change | no save/invalidate | | CARTQ-24 | happy | region stash | both carts snapshotted product/slot/qty | | CARTQ-25 | edge | restore | ids reissued; qty defaults to 1; missing qty 1 | | CARTQ-26 | edge | corrupt stash | empty carts | | CARTQ-27 | happy | region switch helpers | stash/clear/restore integration | ### Prominent API hooks — `tests/lib/prominent-api-hooks.test.tsx` | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | API-01 | happy | consts query | `{boundId}` input; threshold 249 | | API-02 | edge | selected address bound override | same-region address bound wins | | API-03 | edge | address other region | ignored | | API-04 | edge | no bound | query disabled | | API-05 | edge | cached consts per bound | immediate placeholder; corrupt cache ignored | | API-06 | edge | cache key differs by bound | no cross-bound leak | | API-20 | edge | switch bounds while the new request is pending | previous snapshot never written under the new key | | API-21 | edge | snapshot stored under the wrong bound | ignored (payload boundId must match) | | API-07 | happy | products URL | `${assets}${key}/regions/${id}/v-${products_version_num}/products.json` | | API-08 | happy | availability URL | `av-${availability_version_num}` | | API-09 | happy | slots URL | `slots/v-${slots_version_num}/slots.json?v=123` | | API-10 | happy | stores URL | versioned stores file | | API-11 | happy | store detail URL | versioned `stores/.json` | | API-12 | edge | missing URL parts | hook disabled/no fetch | | API-13 | happy | merge availability | price/market/flash/out/offer/suspended | | API-14 | edge | missing availability row | price 0, market null, flags false | | API-15 | edge | combo-only | filtered out | | API-16 | edge | products error | surfaced | | API-17 | edge | availability error | products still render with defaults? assert current | | API-18 | edge | region change | URL/query key changes | | API-19 | edge | `useRegionalConsts` passthrough | same data | | API-20 | happy | API `essentialUrls` present | used verbatim; constructed URLs untouched | | API-21 | edge | `essentialUrls` empty | shared builders used as fallback | | API-22 | happy | store-detail template | `{storeId}` replaced; fetched | | API-23 | edge | empty store-detail template | shared builder fallback | | API-24 | edge | version bump, new file pending | previous catalog stays; `isLoading` false, placeholder true | ### Region and location — `tests/lib/use-region.test.tsx`, `location-store.test.ts` | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | REGION-01 | edge | no region, no coords | resolving then fallback | | REGION-02 | edge | resolved region, no saved region | adopts without cart clear | | REGION-03 | edge | resolved different region, no default | confirm switch | | REGION-04 | edge | resolved same region, new bound | updates bound | | REGION-05 | edge | signed-in default same region | adopts default bound | | REGION-06 | edge | default other region, resolved other | clears region for chooser | | REGION-07 | edge | no serviceable region + default | adopts default | | REGION-08 | edge | auth loading | waits | | REGION-09 | edge | default loading | waits | | REGION-10 | edge | manual region pick before resolve | respected | | REGION-11 | edge | resolve hangs 8s | settles, gate continues | | REGION-12 | edge | stale region not in list | cleared | | REGION-13 | edge | stored bound missing | fills active bound | | REGION-14 | edge | stored bound present | not overwritten | | REGION-15 | edge | refreshLocation | re-arms startup check | | REGION-16 | integration | default + location in its region | Home opens that region | | REGION-17 | integration | location in another region | chooser, no regional cache fetches | | REGION-18 | integration | no default, location region | Home opens the location region | | REGION-19 | edge | one non-default address, location off | sole address opens (region + selected id) | | REGION-20 | edge | one non-default address, location elsewhere | sole address still wins | | REGION-21 | integration | sole non-default address, location off | Home opens its region; only its cache is fetched | | REGION-22 | integration | sole non-default address, location elsewhere | Home still opens the sole address's region | | REGION-23 | edge | login after the gate settled | sole address still auto-opens | | REGION-24 | edge | address list response held | startup waits for it | | REGION-25 | edge | cached regions + address, live pending | starts from cache; live requests still run | | REGION-26 | edge | live data differs from cache | region/bound/address reconcile to live | | REGION-27 | edge | consumer above AuthProvider | does not settle launch decision; authenticated instance anchors on default | | REGION-28 | edge | cached location resolution, live pending | opens cached region; live request still runs | | REGION-29 | edge | live resolution differs from cache | region/bound switch to the live answer | | REGION-30 | edge | live resolution succeeds | persisted to StorageServiceCasual | | REGION-31 | edge | live resolution null, region adopted from cache | region cleared for the chooser | | REGION-32 | edge | persisted region/bound in SecureStore | hydrates before the launch decision; no “Finding your region” spinner | | REGION-33 | edge | setRegion / clearRegion | selection persisted / removed from SecureStore | | LOCSTORE-01 | happy | start once | one permission/fix; second start no-op | | LOCSTORE-02 | error | denied | status denied, coords null | | LOCSTORE-03 | edge | services off | status services-off | | LOCSTORE-04 | happy | success | coords rounded 5dp | | LOCSTORE-05 | error | timeout | unavailable + error | | LOCSTORE-06 | edge | stale token after stop/refresh | result ignored | | LOCSTORE-07 | edge | stop | resets state and allows start again | | LOCSTORE-08 | edge | probe granted + services on | true | | LOCSTORE-09 | edge | probe denied/services off/throws | false; state untouched | ### Auth, route and network — `tests/lib/*.test.tsx` | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | AUTH-01 | edge | no token/userId | signed out, not loading | | AUTH-02 | edge | token+userId | authenticated and not loading (no block on getSelfData) | | AUTH-03 | happy | selfData | user/userDetails populated | | AUTH-04 | error | getSelfData UNAUTHORIZED | full logout; token removed | | AUTH-05 | happy | loginWithToken | token/userId saved; authenticated; redirect handler | | AUTH-06 | error | save token fails | loading false; throws | | AUTH-07 | happy | login | login mutation, token save, refetch | | AUTH-08 | error | login fails | loading false; throws | | AUTH-09 | happy | register | register mutation/save/state/refetch | | AUTH-10 | error | register fails | loading false; throws | | AUTH-11 | happy | logout | token cleared; queryClient cleared; signed out | | AUTH-12 | error | delete token fails | still clears state/query | | AUTH-13 | edge | updateUser/updateUserDetails | merged; null safe | | AUTH-14 | edge | redirect state valid | removes key; builds target with params; replace | | AUTH-15 | edge | redirect older than 24h | replace `/` | | AUTH-16 | edge | no redirect state | `router.back()` | | AUTH-17 | edge | corrupt redirect JSON | replace `/` | | AUTH-18 | error | getSelfData fails (offline/5xx) | trusted session kept; token kept | | AUTH-19 | edge | FORCE_LOGOUT_EVENT (401 from any endpoint) | session cleared; token removed | | ROUTE-01 | edge | useAuthenticatedRoute loading | no redirect | | ROUTE-02 | edge | authenticated | no redirect | | ROUTE-03 | edge | unauthenticated | stores target/query/timestamp; push login | | ROUTE-04 | error | storage write fails | still pushes login | | JWT-01 | happy | token roundtrip | save/read/delete | | JWT-02 | happy | userId roundtrip | save/read | | JWT-03 | edge | keys | `authToken`, `userId` | | TRPC-01 | edge | 401 UNAUTHORIZED | emits force-logout | | TRPC-02 | edge | 401 other message | no emit | | TRPC-03 | edge | 500 | no emit | | TRPC-04 | edge | headers | bearer token when present | | TRPC-05 | edge | timeout | aborts request | | TRPC-06 | edge | upstream abort | forwarded | | TRPC-07 | edge | 401 tRPC envelope (`error.data.code`) | emits force-logout | | HIDE-01 | edge | focus with key | hideTabsNav key true | | HIDE-02 | edge | default key | `default` | | HIDE-03 | edge | blur | false | | PSI-01 | edge | earliest future slot | id | | PSI-02 | edge | past delivery only | null | | PSI-03 | edge | no map/slots | null | | PSI-04 | edge | sorts by delivery | earliest | | STR-01 | edge | `pending` | `Confirmed` | | STR-02 | edge | `PENDING`/`Pending` | `Confirmed` | | STR-03 | edge | other statuses | unchanged; empty unchanged | | PENDING-01 | happy | save/get | equal | | PENDING-02 | edge | missing | null | | PENDING-03 | edge | clear | null | | PENDING-04 | edge | corrupt | null | | FETCH-01 | happy | JSON success | returns data | | FETCH-02 | error | timeout | aborts | | FETCH-03 | edge | isAbortError axios/fetch | true for CanceledError/AbortError/ERR_CANCELED | | FETCH-04 | edge | other error | false | ### Stores — `tests/lib/stores.test.ts` | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | STORE-01 | edge | appStore hide key true/false | map updated immutably | | STORE-02 | edge | addressStore select | id | | STORE-03 | edge | cartStore queue/clear | product | | STORE-04 | edge | flashCartStore queue/clear | product | | STORE-05 | edge | navigationStore flags | set/clear | | STORE-06 | edge | quickDelivery slot | set | | STORE-07 | edge | storeHeader title | set | | STORE-08 | edge | slotStore slot/store | set | | STORE-09 | edge | flashNavigation flag/reset | true then false | | STORE-10 | edge | centralProduct setProducts | products + map by id | | STORE-11 | edge | centralProduct refetch setter | callable | | STORE-12 | edge | centralSlot setSlotsData | map for all availability products; slots attached; flags | | STORE-13 | edge | centralSlot refetch setter | callable | | STORE-14 | edge | checkout notes | set | | STORE-15 | edge | region set | id/region/bound; generation bump | | STORE-16 | edge | identical region | no generation bump | | STORE-17 | edge | clear region | nulls + bump | | STORE-18 | edge | clear already empty | no bump | | STORE-19 | edge | region memory only | no persist | ### App helpers | ID | Type | Case and setup | Assertion | | --- | --- | --- | --- | | REGSW-01 | happy | same region | no cart clear/stash; still resets selections/caches? assert current | | REGSW-02 | happy | different region | stashes old carts; clears both; clears selected address | | REGSW-03 | edge | no previous region | no stash | | REGSW-04 | edge | known region | restores carts | | REGSW-05 | edge | resets quick-delivery/slot/cart/flash stores | all cleared | | REGSW-06 | edge | clears product/slot stores | empty | | REGSW-07 | edge | removes catalog queries | all-products/stores/slots/availability/store-with-products | | REGSW-08 | edge | sets new region/bound | fallback effective bound | | REGSW-09 | edge | invalidates all queries | called | | PENDING-05 | edge | signed out | no sync | | PENDING-06 | happy | signed in + pending | create, clear, invalidate addresses/default | | PENDING-07 | edge | no pending | no create | | PENDING-08 | error | create fails | draft retained; retry possible | | PENDING-09 | edge | concurrent auth events | one sync at a time | | PENDING-10 | edge | unmount | cancelled; no state update | | NOTIF-01 | happy | Android | default channel created | | NOTIF-02 | edge | permission already granted | no request | | NOTIF-03 | happy | permission granted after request | returns Expo push token | | NOTIF-04 | error | denied | throws permission error | | NOTIF-05 | error | no project id | throws | | NOTIF-06 | error | not a device | throws | | NOTIF-07 | error | getExpoPushToken throws | wrapped error | | NOTIFC-01 | edge | granted token | savePushToken called | | NOTIFC-02 | edge | not authenticated | current effect still calls save (pin if retained) | | NOTIFC-03 | edge | denied | permission dialog | | NOTIFC-04 | edge | settings button | `Linking.openSettings` | | NOTIFC-05 | edge | cancel | closes | | NOTIFR-01 | edge | no token / no region / not granted | no calls | | NOTIFR-02 | happy | granted + region | save token with region | | NOTIFR-03 | edge | location-derived bound | record tracked region | | NOTIFR-04 | edge | address-derived region | no tracked-region call | | NOTIFR-05 | edge | same token/region/source again | deduped | | NOTIFR-06 | edge | region changes | new sync | | NOTIFR-07 | error | save/record fails | logged, no retry | | CENTRAL-01 | happy | initializer | product store populated; slot store populated; reconcile runs | | CENTRAL-02 | edge | unmount | hooks clean up/no infinite loop | --- ## 26. Cross-cutting acceptance rules Every page test file should also contain these if the page renders them: 1. **Network calls** — every button that triggers a mutation asserts procedure name and input. 2. **Auth** — loading, signed-out and signed-in branches. 3. **Data** — loading, error, empty, one item, many items. 4. **Refresh** — pull-to-refresh and `useMarkDataFetchers` where present. 5. **Navigation** — every route press goes to the exact path, including query params. 6. **Persistence** — cart, token, pending address and region-switch side effects are asserted through storage, not mocks. 7. **Timers** — debounce (300ms), OTP countdown (1s/120s), modal delays (300ms/350ms) use fake timers. 8. **Accessibility** — pressable labels/disabled state and images/fallback text. 9. **Current gaps** — where a test explicitly pins current wrong behavior (marked “current” above), add a comment naming the gap so the test is intentionally updated when fixed. --- ## 27. Suggested execution order 1. `tests/lib` (fixtures, cart hooks, region, auth, stores) — fastest feedback. 2. `tests/components` (shared UI contracts). 3. `tests/pages` in this order: auth → home/search/slot/product → stores/offers → cart/checkout → me/addresses/coupons/complaints/profile/orders → flash. 4. `tests/app` (bootstrap and layouts). 5. Full `NODE_ENV=test bun run test` from `apps/user-ui`. > The cases above intentionally describe behaviour, not implementation. When a case marked > “current” is fixed, change the assertion in the same PR and remove the “current” note.