From ba2cfd12247236a081ecf87ae75ba407ba7ff6d4 Mon Sep 17 00:00:00 2001 From: shafi54 <108669266+shafi-aviz@users.noreply.github.com> Date: Sun, 18 Oct 2026 18:19:15 +0530 Subject: [PATCH] enh --- .pi/mcp.json | 18 + after_logout.png | Bin 0 -> 121218 bytes apps/admin-ui/tests/BUGS.md | 242 - .../tests/components/banner-form.test.tsx | 120 - .../components/cancel-order-dialog.test.tsx | 98 - .../tests/components/coupon-form.test.tsx | 170 - .../components/order-notes-form.test.tsx | 82 - .../components/order-options-menu.test.tsx | 259 - .../tests/components/product-form.test.tsx | 275 - .../components/product-group-form.test.tsx | 243 - .../components/product-list-dialog.test.tsx | 46 - .../components/products-selector.test.tsx | 173 - .../tests/components/slot-form.test.tsx | 214 - .../tests/components/snippet-menu.test.tsx | 133 - .../components/snippet-orders-view.test.tsx | 94 - .../tests/components/store-form.test.tsx | 175 - .../tests/components/tag-form.test.tsx | 160 - .../tests/components/tag-menu.test.tsx | 118 - .../components/user-incidents-view.test.tsx | 249 - .../components/vendor-snippet-form.test.tsx | 240 - .../contexts/staff-auth-context.test.tsx | 185 - apps/admin-ui/tests/helpers/render.tsx | 52 - apps/admin-ui/tests/hooks/useJWT.test.ts | 41 - .../hooks/useUploadToObjectStore.test.tsx | 231 - apps/admin-ui/tests/jest-env.d.ts | 6 - apps/admin-ui/tests/jest.config.js | 62 - apps/admin-ui/tests/lib/queryClient.test.ts | 37 - apps/admin-ui/tests/lib/toaster.test.tsx | 51 - apps/admin-ui/tests/mocks/api.ts | 73 - apps/admin-ui/tests/mocks/native.ts | 181 - apps/admin-ui/tests/mocks/procedures.ts | 122 - apps/admin-ui/tests/mocks/refresh.ts | 18 - apps/admin-ui/tests/mocks/router.ts | 70 - apps/admin-ui/tests/mocks/staff-auth.ts | 57 - .../tests/screens/banners-create.test.tsx | 214 - .../tests/screens/banners-edit.test.tsx | 215 - .../tests/screens/banners-index.test.tsx | 237 - .../tests/screens/complaints-index.test.tsx | 250 - .../tests/screens/coupons-create.test.tsx | 199 - .../tests/screens/coupons-edit.test.tsx | 217 - .../tests/screens/coupons-index.test.tsx | 289 - .../customize-app-all-items-order.test.tsx | 220 - .../tests/screens/customize-app-hub.test.tsx | 171 - .../customize-app-popular-items.test.tsx | 298 - .../tests/screens/dashboard-hub.test.tsx | 116 - .../tests/screens/delivery-sequences.test.tsx | 387 -- .../tests/screens/drawer-layout.test.tsx | 191 - .../tests/screens/index-redirect.test.tsx | 65 - apps/admin-ui/tests/screens/login.test.tsx | 65 - .../tests/screens/manage-orders-hub.test.tsx | 127 - .../screens/manage-orders-orders.test.tsx | 337 - .../tests/screens/order-details.test.tsx | 235 - .../tests/screens/prices-overview.test.tsx | 317 - .../screens/product-groupings-create.test.tsx | 74 - .../screens/product-groupings-edit.test.tsx | 98 - .../screens/product-groupings-index.test.tsx | 201 - .../tests/screens/product-tags-add.test.tsx | 125 - .../tests/screens/product-tags-edit.test.tsx | 226 - .../tests/screens/product-tags-index.test.tsx | 141 - .../tests/screens/product-tags-order.test.tsx | 231 - .../tests/screens/products-add.test.tsx | 58 - .../tests/screens/products-detail.test.tsx | 273 - .../tests/screens/products-edit.test.tsx | 216 - .../tests/screens/products-index.test.tsx | 252 - .../tests/screens/rebalance-orders.test.tsx | 188 - .../tests/screens/send-notifications.test.tsx | 255 - .../tests/screens/slot-details.test.tsx | 154 - .../admin-ui/tests/screens/slots-add.test.tsx | 127 - .../tests/screens/slots-edit.test.tsx | 110 - .../tests/screens/slots-index.test.tsx | 153 - .../tests/screens/stores-add.test.tsx | 108 - .../tests/screens/stores-edit.test.tsx | 172 - .../tests/screens/stores-index.test.tsx | 188 - .../screens/user-management-detail.test.tsx | 248 - .../screens/user-management-index.test.tsx | 211 - .../screens/vendor-snippets-index.test.tsx | 251 - apps/admin-ui/tests/setup.ts | 122 - apps/backend/creds/demo.txt | 35 - apps/backend/tests/.env | 10 - apps/backend/tests/.env.example | 14 - apps/backend/tests/BUGS.md | 545 -- apps/backend/tests/api/admin-banners.test.ts | 57 - apps/backend/tests/api/admin-catalog.test.ts | 114 - apps/backend/tests/api/admin-ops.test.ts | 136 - apps/backend/tests/api/admin-orders.test.ts | 137 - apps/backend/tests/api/admin-tags.test.ts | 83 - apps/backend/tests/api/admin-users.test.ts | 109 - .../tests/api/admin-vendor-snippets.test.ts | 70 - apps/backend/tests/api/admin.test.ts | 48 - apps/backend/tests/api/auth.test.ts | 34 - .../tests/api/authorization-matrix.test.ts | 258 - apps/backend/tests/api/authorization.test.ts | 81 - .../tests/api/cache-availability.test.ts | 59 - .../tests/api/cache-consistency.test.ts | 141 - .../tests/api/cache-invalidation.test.ts | 109 - apps/backend/tests/api/cache-products.test.ts | 88 - apps/backend/tests/api/cache-slots.test.ts | 59 - apps/backend/tests/api/coupon-math.test.ts | 263 - apps/backend/tests/api/coupon-ux.test.ts | 253 - apps/backend/tests/api/coupons.test.ts | 126 - apps/backend/tests/api/health.test.ts | 32 - .../backend/tests/api/misc-procedures.test.ts | 303 - .../tests/api/order-edge-cases.test.ts | 89 - apps/backend/tests/api/order-flow.test.ts | 80 - .../tests/api/order-lifecycle-gaps.test.ts | 212 - .../backend/tests/api/order-lifecycle.test.ts | 93 - apps/backend/tests/api/order-rules.test.ts | 143 - .../tests/api/place-order-edge-cases.test.ts | 219 - apps/backend/tests/api/uploads.test.ts | 133 - apps/backend/tests/api/user-surface.test.ts | 108 - apps/backend/tests/helpers/api.ts | 74 - apps/backend/tests/helpers/cache.ts | 101 - apps/backend/tests/helpers/consts.ts | 85 - apps/backend/tests/helpers/env.ts | 31 - apps/backend/tests/helpers/fixtures.ts | 203 - apps/backend/tests/helpers/sessions.ts | 59 - apps/backend/tests/jest.config.js | 41 - apps/backend/tests/setup.ts | 10 - apps/backend/tests/tsconfig.json | 14 - apps/user-ui/tests/KNOWN-GAPS.md | 189 - .../tests/__fixtures__/essentialConsts.json | 27 - .../tests/components/address-form.test.tsx | 171 - .../components/address-selectors.test.tsx | 180 - .../components/cart-address-gate.test.tsx | 62 - .../tests/components/complaint-form.test.tsx | 74 - apps/user-ui/tests/components/icons.test.tsx | 27 - .../components/location-attacher.test.tsx | 64 - .../components/location-wrapper.test.tsx | 85 - .../components/notif-region-sync.test.tsx | 98 - .../tests/components/order-menu.test.tsx | 123 - .../payment-and-order-money.test.tsx | 234 - .../components/payment-and-order.test.tsx | 194 - .../tests/components/product-card.test.tsx | 131 - .../tests/components/product-detail.test.tsx | 109 - .../components/registration-form.test.tsx | 119 - .../tests/components/slot-layout.test.tsx | 67 - .../components/static-components.test.tsx | 167 - .../tests/components/wrappers.test.tsx | 202 - .../tests/contexts/auth-context.test.tsx | 124 - .../tests/contexts/auth-lifecycle.test.tsx | 267 - .../tests/contexts/auth-logout-cache.test.tsx | 56 - apps/user-ui/tests/helpers/real-router.tsx | 21 - apps/user-ui/tests/helpers/render.tsx | 70 - apps/user-ui/tests/home-page/README.md | 150 - .../home-add-to-cart-dialog.test.tsx | 119 - .../tests/home-page/home-cards.test.tsx | 102 - .../home-page/home-floating-cart-bar.test.tsx | 203 - .../tests/home-page/home-refresh.test.tsx | 85 - .../tests/home-page/home-slots.test.tsx | 100 - .../tests/home-page/home-states.test.tsx | 72 - apps/user-ui/tests/home-page/home.test.tsx | 611 -- .../tests/home-page/navigation.test.tsx | 139 - .../home-page/next-order-glimpse.test.tsx | 133 - apps/user-ui/tests/home-page/render.tsx | 126 - .../tests/hooks/cart-query-hooks.test.tsx | 169 - .../user-ui/tests/hooks/cart-storage.test.tsx | 335 - .../tests/hooks/prominent-api-hooks.test.tsx | 95 - .../hooks/useAuthenticatedRoute.test.tsx | 42 - .../tests/hooks/useColorScheme.test.tsx | 15 - .../tests/hooks/useHideTabNav.test.tsx | 26 - apps/user-ui/tests/hooks/useJWT.test.ts | 33 - .../hooks/useProductSlotIdentifier.test.tsx | 77 - .../hooks/useUploadToObjectStore.test.tsx | 120 - apps/user-ui/tests/jest-env.d.ts | 7 - apps/user-ui/tests/jest.config.js | 56 - apps/user-ui/tests/lib/force-logout.test.tsx | 138 - .../user-ui/tests/lib/pending-address.test.ts | 50 - .../lib/query-invalidation-keys.test.tsx | 55 - .../tests/lib/string-manipulators.test.ts | 23 - apps/user-ui/tests/lib/trpc-client.test.ts | 62 - apps/user-ui/tests/mocks/api.ts | 366 - apps/user-ui/tests/mocks/auth.ts | 63 - .../mocks/mock-availability-response.json | 1346 ---- .../tests/mocks/mock-products-response.json | 3537 ---------- .../tests/mocks/mock-slots-response.json | 6045 ----------------- .../mocks/mock-store-products-response.json | 58 - .../tests/mocks/mock-stores-response.json | 124 - apps/user-ui/tests/mocks/native.ts | 109 - apps/user-ui/tests/mocks/procedures.ts | 131 - apps/user-ui/tests/mocks/refresh.ts | 27 - apps/user-ui/tests/mocks/router.ts | 68 - apps/user-ui/tests/screens/auth.test.tsx | 170 - .../tests/screens/cart-coupons.test.tsx | 356 - .../user-ui/tests/screens/cart-money.test.tsx | 171 - .../tests/screens/cart-screen.test.tsx | 246 - .../tests/screens/checkout-coupons.test.tsx | 247 - .../tests/screens/checkout-crash.test.tsx | 100 - apps/user-ui/tests/screens/checkout.test.tsx | 52 - .../user-ui/tests/screens/flash-gate.test.tsx | 55 - .../user-ui/tests/screens/me-account.test.tsx | 354 - apps/user-ui/tests/screens/me-hub.test.tsx | 61 - apps/user-ui/tests/screens/me-orders.test.tsx | 100 - .../screens/mutation-invalidation.test.tsx | 279 - .../tests/screens/navigation-shell.test.tsx | 55 - .../tests/screens/order-again.test.tsx | 79 - .../tests/screens/order-amounts.test.tsx | 156 - .../tests/screens/order-detail.test.tsx | 159 - .../tests/screens/order-success.test.tsx | 55 - .../product-detail-flash-flag.test.tsx | 61 - .../screens/product-detail-routes.test.tsx | 67 - apps/user-ui/tests/screens/search.test.tsx | 101 - apps/user-ui/tests/screens/slot-view.test.tsx | 149 - .../tests/screens/store-detail.test.tsx | 66 - apps/user-ui/tests/screens/stores.test.tsx | 100 - apps/user-ui/tests/setup.ts | 157 - .../user-ui/tests/stores/region-store.test.ts | 53 - .../tests/stores/store-staleness.test.ts | 121 - apps/user-ui/tests/stores/stores.test.ts | 130 - cart_top.png | Bin 0 -> 240492 bytes change-log.txt | 39 + .../full-regression-2026-10-18-defects.md | 134 + .../full-regression-2026-10-18.md | 2626 +++++++ .../pending-cases-run-2026-10-18.md | 167 + .../pending-test-cases-2026-10-18.md | 410 ++ docs/test-cases/README.md | 19 +- docs/test-cases/fallback-legacy-pages.md | 5 + docs/test-cases/jobs-health.md | 7 + docs/test-cases/notifications.md | 8 + prompts/test.txt | 3 +- 219 files changed, 3432 insertions(+), 39050 deletions(-) create mode 100644 after_logout.png delete mode 100644 apps/admin-ui/tests/BUGS.md delete mode 100644 apps/admin-ui/tests/components/banner-form.test.tsx delete mode 100644 apps/admin-ui/tests/components/cancel-order-dialog.test.tsx delete mode 100644 apps/admin-ui/tests/components/coupon-form.test.tsx delete mode 100644 apps/admin-ui/tests/components/order-notes-form.test.tsx delete mode 100644 apps/admin-ui/tests/components/order-options-menu.test.tsx delete mode 100644 apps/admin-ui/tests/components/product-form.test.tsx delete mode 100644 apps/admin-ui/tests/components/product-group-form.test.tsx delete mode 100644 apps/admin-ui/tests/components/product-list-dialog.test.tsx delete mode 100644 apps/admin-ui/tests/components/products-selector.test.tsx delete mode 100644 apps/admin-ui/tests/components/slot-form.test.tsx delete mode 100644 apps/admin-ui/tests/components/snippet-menu.test.tsx delete mode 100644 apps/admin-ui/tests/components/snippet-orders-view.test.tsx delete mode 100644 apps/admin-ui/tests/components/store-form.test.tsx delete mode 100644 apps/admin-ui/tests/components/tag-form.test.tsx delete mode 100644 apps/admin-ui/tests/components/tag-menu.test.tsx delete mode 100644 apps/admin-ui/tests/components/user-incidents-view.test.tsx delete mode 100644 apps/admin-ui/tests/components/vendor-snippet-form.test.tsx delete mode 100644 apps/admin-ui/tests/contexts/staff-auth-context.test.tsx delete mode 100644 apps/admin-ui/tests/helpers/render.tsx delete mode 100644 apps/admin-ui/tests/hooks/useJWT.test.ts delete mode 100644 apps/admin-ui/tests/hooks/useUploadToObjectStore.test.tsx delete mode 100644 apps/admin-ui/tests/jest-env.d.ts delete mode 100644 apps/admin-ui/tests/jest.config.js delete mode 100644 apps/admin-ui/tests/lib/queryClient.test.ts delete mode 100644 apps/admin-ui/tests/lib/toaster.test.tsx delete mode 100644 apps/admin-ui/tests/mocks/api.ts delete mode 100644 apps/admin-ui/tests/mocks/native.ts delete mode 100644 apps/admin-ui/tests/mocks/procedures.ts delete mode 100644 apps/admin-ui/tests/mocks/refresh.ts delete mode 100644 apps/admin-ui/tests/mocks/router.ts delete mode 100644 apps/admin-ui/tests/mocks/staff-auth.ts delete mode 100644 apps/admin-ui/tests/screens/banners-create.test.tsx delete mode 100644 apps/admin-ui/tests/screens/banners-edit.test.tsx delete mode 100644 apps/admin-ui/tests/screens/banners-index.test.tsx delete mode 100644 apps/admin-ui/tests/screens/complaints-index.test.tsx delete mode 100644 apps/admin-ui/tests/screens/coupons-create.test.tsx delete mode 100644 apps/admin-ui/tests/screens/coupons-edit.test.tsx delete mode 100644 apps/admin-ui/tests/screens/coupons-index.test.tsx delete mode 100644 apps/admin-ui/tests/screens/customize-app-all-items-order.test.tsx delete mode 100644 apps/admin-ui/tests/screens/customize-app-hub.test.tsx delete mode 100644 apps/admin-ui/tests/screens/customize-app-popular-items.test.tsx delete mode 100644 apps/admin-ui/tests/screens/dashboard-hub.test.tsx delete mode 100644 apps/admin-ui/tests/screens/delivery-sequences.test.tsx delete mode 100644 apps/admin-ui/tests/screens/drawer-layout.test.tsx delete mode 100644 apps/admin-ui/tests/screens/index-redirect.test.tsx delete mode 100644 apps/admin-ui/tests/screens/login.test.tsx delete mode 100644 apps/admin-ui/tests/screens/manage-orders-hub.test.tsx delete mode 100644 apps/admin-ui/tests/screens/manage-orders-orders.test.tsx delete mode 100644 apps/admin-ui/tests/screens/order-details.test.tsx delete mode 100644 apps/admin-ui/tests/screens/prices-overview.test.tsx delete mode 100644 apps/admin-ui/tests/screens/product-groupings-create.test.tsx delete mode 100644 apps/admin-ui/tests/screens/product-groupings-edit.test.tsx delete mode 100644 apps/admin-ui/tests/screens/product-groupings-index.test.tsx delete mode 100644 apps/admin-ui/tests/screens/product-tags-add.test.tsx delete mode 100644 apps/admin-ui/tests/screens/product-tags-edit.test.tsx delete mode 100644 apps/admin-ui/tests/screens/product-tags-index.test.tsx delete mode 100644 apps/admin-ui/tests/screens/product-tags-order.test.tsx delete mode 100644 apps/admin-ui/tests/screens/products-add.test.tsx delete mode 100644 apps/admin-ui/tests/screens/products-detail.test.tsx delete mode 100644 apps/admin-ui/tests/screens/products-edit.test.tsx delete mode 100644 apps/admin-ui/tests/screens/products-index.test.tsx delete mode 100644 apps/admin-ui/tests/screens/rebalance-orders.test.tsx delete mode 100644 apps/admin-ui/tests/screens/send-notifications.test.tsx delete mode 100644 apps/admin-ui/tests/screens/slot-details.test.tsx delete mode 100644 apps/admin-ui/tests/screens/slots-add.test.tsx delete mode 100644 apps/admin-ui/tests/screens/slots-edit.test.tsx delete mode 100644 apps/admin-ui/tests/screens/slots-index.test.tsx delete mode 100644 apps/admin-ui/tests/screens/stores-add.test.tsx delete mode 100644 apps/admin-ui/tests/screens/stores-edit.test.tsx delete mode 100644 apps/admin-ui/tests/screens/stores-index.test.tsx delete mode 100644 apps/admin-ui/tests/screens/user-management-detail.test.tsx delete mode 100644 apps/admin-ui/tests/screens/user-management-index.test.tsx delete mode 100644 apps/admin-ui/tests/screens/vendor-snippets-index.test.tsx delete mode 100644 apps/admin-ui/tests/setup.ts delete mode 100644 apps/backend/tests/.env delete mode 100644 apps/backend/tests/.env.example delete mode 100644 apps/backend/tests/BUGS.md delete mode 100644 apps/backend/tests/api/admin-banners.test.ts delete mode 100644 apps/backend/tests/api/admin-catalog.test.ts delete mode 100644 apps/backend/tests/api/admin-ops.test.ts delete mode 100644 apps/backend/tests/api/admin-orders.test.ts delete mode 100644 apps/backend/tests/api/admin-tags.test.ts delete mode 100644 apps/backend/tests/api/admin-users.test.ts delete mode 100644 apps/backend/tests/api/admin-vendor-snippets.test.ts delete mode 100644 apps/backend/tests/api/admin.test.ts delete mode 100644 apps/backend/tests/api/auth.test.ts delete mode 100644 apps/backend/tests/api/authorization-matrix.test.ts delete mode 100644 apps/backend/tests/api/authorization.test.ts delete mode 100644 apps/backend/tests/api/cache-availability.test.ts delete mode 100644 apps/backend/tests/api/cache-consistency.test.ts delete mode 100644 apps/backend/tests/api/cache-invalidation.test.ts delete mode 100644 apps/backend/tests/api/cache-products.test.ts delete mode 100644 apps/backend/tests/api/cache-slots.test.ts delete mode 100644 apps/backend/tests/api/coupon-math.test.ts delete mode 100644 apps/backend/tests/api/coupon-ux.test.ts delete mode 100644 apps/backend/tests/api/coupons.test.ts delete mode 100644 apps/backend/tests/api/health.test.ts delete mode 100644 apps/backend/tests/api/misc-procedures.test.ts delete mode 100644 apps/backend/tests/api/order-edge-cases.test.ts delete mode 100644 apps/backend/tests/api/order-flow.test.ts delete mode 100644 apps/backend/tests/api/order-lifecycle-gaps.test.ts delete mode 100644 apps/backend/tests/api/order-lifecycle.test.ts delete mode 100644 apps/backend/tests/api/order-rules.test.ts delete mode 100644 apps/backend/tests/api/place-order-edge-cases.test.ts delete mode 100644 apps/backend/tests/api/uploads.test.ts delete mode 100644 apps/backend/tests/api/user-surface.test.ts delete mode 100644 apps/backend/tests/helpers/api.ts delete mode 100644 apps/backend/tests/helpers/cache.ts delete mode 100644 apps/backend/tests/helpers/consts.ts delete mode 100644 apps/backend/tests/helpers/env.ts delete mode 100644 apps/backend/tests/helpers/fixtures.ts delete mode 100644 apps/backend/tests/helpers/sessions.ts delete mode 100644 apps/backend/tests/jest.config.js delete mode 100644 apps/backend/tests/setup.ts delete mode 100644 apps/backend/tests/tsconfig.json delete mode 100644 apps/user-ui/tests/KNOWN-GAPS.md delete mode 100644 apps/user-ui/tests/__fixtures__/essentialConsts.json delete mode 100644 apps/user-ui/tests/components/address-form.test.tsx delete mode 100644 apps/user-ui/tests/components/address-selectors.test.tsx delete mode 100644 apps/user-ui/tests/components/cart-address-gate.test.tsx delete mode 100644 apps/user-ui/tests/components/complaint-form.test.tsx delete mode 100644 apps/user-ui/tests/components/icons.test.tsx delete mode 100644 apps/user-ui/tests/components/location-attacher.test.tsx delete mode 100644 apps/user-ui/tests/components/location-wrapper.test.tsx delete mode 100644 apps/user-ui/tests/components/notif-region-sync.test.tsx delete mode 100644 apps/user-ui/tests/components/order-menu.test.tsx delete mode 100644 apps/user-ui/tests/components/payment-and-order-money.test.tsx delete mode 100644 apps/user-ui/tests/components/payment-and-order.test.tsx delete mode 100644 apps/user-ui/tests/components/product-card.test.tsx delete mode 100644 apps/user-ui/tests/components/product-detail.test.tsx delete mode 100644 apps/user-ui/tests/components/registration-form.test.tsx delete mode 100644 apps/user-ui/tests/components/slot-layout.test.tsx delete mode 100644 apps/user-ui/tests/components/static-components.test.tsx delete mode 100644 apps/user-ui/tests/components/wrappers.test.tsx delete mode 100644 apps/user-ui/tests/contexts/auth-context.test.tsx delete mode 100644 apps/user-ui/tests/contexts/auth-lifecycle.test.tsx delete mode 100644 apps/user-ui/tests/contexts/auth-logout-cache.test.tsx delete mode 100644 apps/user-ui/tests/helpers/real-router.tsx delete mode 100644 apps/user-ui/tests/helpers/render.tsx delete mode 100644 apps/user-ui/tests/home-page/README.md delete mode 100644 apps/user-ui/tests/home-page/home-add-to-cart-dialog.test.tsx delete mode 100644 apps/user-ui/tests/home-page/home-cards.test.tsx delete mode 100644 apps/user-ui/tests/home-page/home-floating-cart-bar.test.tsx delete mode 100644 apps/user-ui/tests/home-page/home-refresh.test.tsx delete mode 100644 apps/user-ui/tests/home-page/home-slots.test.tsx delete mode 100644 apps/user-ui/tests/home-page/home-states.test.tsx delete mode 100644 apps/user-ui/tests/home-page/home.test.tsx delete mode 100644 apps/user-ui/tests/home-page/navigation.test.tsx delete mode 100644 apps/user-ui/tests/home-page/next-order-glimpse.test.tsx delete mode 100644 apps/user-ui/tests/home-page/render.tsx delete mode 100644 apps/user-ui/tests/hooks/cart-query-hooks.test.tsx delete mode 100644 apps/user-ui/tests/hooks/cart-storage.test.tsx delete mode 100644 apps/user-ui/tests/hooks/prominent-api-hooks.test.tsx delete mode 100644 apps/user-ui/tests/hooks/useAuthenticatedRoute.test.tsx delete mode 100644 apps/user-ui/tests/hooks/useColorScheme.test.tsx delete mode 100644 apps/user-ui/tests/hooks/useHideTabNav.test.tsx delete mode 100644 apps/user-ui/tests/hooks/useJWT.test.ts delete mode 100644 apps/user-ui/tests/hooks/useProductSlotIdentifier.test.tsx delete mode 100644 apps/user-ui/tests/hooks/useUploadToObjectStore.test.tsx delete mode 100644 apps/user-ui/tests/jest-env.d.ts delete mode 100644 apps/user-ui/tests/jest.config.js delete mode 100644 apps/user-ui/tests/lib/force-logout.test.tsx delete mode 100644 apps/user-ui/tests/lib/pending-address.test.ts delete mode 100644 apps/user-ui/tests/lib/query-invalidation-keys.test.tsx delete mode 100644 apps/user-ui/tests/lib/string-manipulators.test.ts delete mode 100644 apps/user-ui/tests/lib/trpc-client.test.ts delete mode 100644 apps/user-ui/tests/mocks/api.ts delete mode 100644 apps/user-ui/tests/mocks/auth.ts delete mode 100644 apps/user-ui/tests/mocks/mock-availability-response.json delete mode 100644 apps/user-ui/tests/mocks/mock-products-response.json delete mode 100644 apps/user-ui/tests/mocks/mock-slots-response.json delete mode 100644 apps/user-ui/tests/mocks/mock-store-products-response.json delete mode 100644 apps/user-ui/tests/mocks/mock-stores-response.json delete mode 100644 apps/user-ui/tests/mocks/native.ts delete mode 100644 apps/user-ui/tests/mocks/procedures.ts delete mode 100644 apps/user-ui/tests/mocks/refresh.ts delete mode 100644 apps/user-ui/tests/mocks/router.ts delete mode 100644 apps/user-ui/tests/screens/auth.test.tsx delete mode 100644 apps/user-ui/tests/screens/cart-coupons.test.tsx delete mode 100644 apps/user-ui/tests/screens/cart-money.test.tsx delete mode 100644 apps/user-ui/tests/screens/cart-screen.test.tsx delete mode 100644 apps/user-ui/tests/screens/checkout-coupons.test.tsx delete mode 100644 apps/user-ui/tests/screens/checkout-crash.test.tsx delete mode 100644 apps/user-ui/tests/screens/checkout.test.tsx delete mode 100644 apps/user-ui/tests/screens/flash-gate.test.tsx delete mode 100644 apps/user-ui/tests/screens/me-account.test.tsx delete mode 100644 apps/user-ui/tests/screens/me-hub.test.tsx delete mode 100644 apps/user-ui/tests/screens/me-orders.test.tsx delete mode 100644 apps/user-ui/tests/screens/mutation-invalidation.test.tsx delete mode 100644 apps/user-ui/tests/screens/navigation-shell.test.tsx delete mode 100644 apps/user-ui/tests/screens/order-again.test.tsx delete mode 100644 apps/user-ui/tests/screens/order-amounts.test.tsx delete mode 100644 apps/user-ui/tests/screens/order-detail.test.tsx delete mode 100644 apps/user-ui/tests/screens/order-success.test.tsx delete mode 100644 apps/user-ui/tests/screens/product-detail-flash-flag.test.tsx delete mode 100644 apps/user-ui/tests/screens/product-detail-routes.test.tsx delete mode 100644 apps/user-ui/tests/screens/search.test.tsx delete mode 100644 apps/user-ui/tests/screens/slot-view.test.tsx delete mode 100644 apps/user-ui/tests/screens/store-detail.test.tsx delete mode 100644 apps/user-ui/tests/screens/stores.test.tsx delete mode 100644 apps/user-ui/tests/setup.ts delete mode 100644 apps/user-ui/tests/stores/region-store.test.ts delete mode 100644 apps/user-ui/tests/stores/store-staleness.test.ts delete mode 100644 apps/user-ui/tests/stores/stores.test.ts create mode 100644 cart_top.png create mode 100644 docs/test reports/full-regression-2026-10-18-defects.md create mode 100644 docs/test reports/full-regression-2026-10-18.md create mode 100644 docs/test reports/pending-cases-run-2026-10-18.md create mode 100644 docs/test reports/pending-test-cases-2026-10-18.md diff --git a/.pi/mcp.json b/.pi/mcp.json index a773116..aecc9e6 100644 --- a/.pi/mcp.json +++ b/.pi/mcp.json @@ -7,5 +7,23 @@ ], "description": "Maestro mobile/web UI automation: list devices, drive and inspect the screen, run YAML flows locally or on Maestro Cloud." } + }, + "_notes": { + "added": "2026-10-18 (FR-2026-10-18-01 regression run)", + "known_issues": [ + "MCP can wedge with 'Device became unreachable during deviceInfo'. Later calls then fail instantly because the failure state is cached, so retrying does not help.", + "Observed cause: a stale/duplicate 'maestro.cli.AppKt mcp' java process and/or stale '~/.maestro/deps/simulator-server ios --id ' children. Killing the simulator-server children alone did not recover it.", + "Recovery that worked: kill the java process running 'maestro.cli.AppKt mcp' (pgrep -f 'maestro.cli.AppKt mcp'). pi respawns it on the next tool call; list_devices and run then work again.", + "After a respawn the Maestro Viewer URL changes (seen at http://127.0.0.1:10000/ and http://127.0.0.1:9999/). Surface the URL from the tool output instead of hardcoding it.", + "take_screenshot returns null content on iOS (the image is still shown to the assistant). On iOS prefer 'xcrun simctl io screenshot '. On the 'chromium' device take_screenshot returns real base64 image content.", + "Maestro text matchers are FULL-STRING regex with IGNORE_CASE: text 'Foo' does not match 'Foo bar'. Use '.*Foo.*' or an anchored regex.", + "React Native placeholders are not accessibility text nodes (e.g. the cart's 'Select a coupon'); tap/assert those by point.", + "Leftover modals (Remove Item / Delete Address / iOS Save Password) silently block every subsequent tap in a flow; dismiss them explicitly.", + "The MCP server is a long-lived JVM; after heavy flow churn restart it before starting a new batch." + ], + "device_ids": { + "ios_simulator": "5A64695E-F4D4-4E2E-90F3-EC3493A2B457", + "web": "chromium" + } } } diff --git a/after_logout.png b/after_logout.png new file mode 100644 index 0000000000000000000000000000000000000000..22aae18db2f676b5eb33d27d1d0caff152fe4665 GIT binary patch literal 121218 zcmeFabySsG*Eb9s5Cka^P+E{KgKm{lKtQ@nT0w+Or-~pcA|l=0-Jz7y-HmjEbnJIs zTRr!=pZ6K#`{(<m@n-9hkOCgR)MScKM>wB;3oKZ z`?2ROns|39na%#_6+7OV=#}ZQMtO~ip^LKBJB^Y*1XMxQlIyoo>K*W^|aPqRT`gVUF= zU>bYeX)#6=anzM2dc0&5Ea$NhVXCISEsxN0n1D}hHS=;5`s$gol~1WlJ^2$9uKU(k zJMHEoe#l!@@}E2Ot(Q$v8Es~<6*OLrvZ`Dz&nX?X7*`#up25AdUyJCTJc*h*U08^+ zj^wu;?B>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E$JIwVaAMC6u zK!);^!x>|~T+-1wU5-F-^U{)&&gp)=!$;z|j3qSFYS$lakB(MB`+z39?(Xi+&H?ui zDkdg-7kIdVarH=O#@{R# zI(6(y2B@2~X7aDmy6Etm2)@<0yoB_x4Epu#s<c14Ds`te5$$%T>hIMl#($koG_IsFhqR1vMsWCU8yJEg68+yL;#f&Ov3@B z9qz|h0|d`d{dKt6HyrEx;-m6ap<=dk!KKDN!j-yJ^-%^wr3k ziGop?Du6tdLeK?w1|$Jm5Cf~GB=(hsOrU7BB(1vRg-~me+NVOqsRi_*OsSrd|6xc_ z<%_`mg

`K)yafO-;5ggP0)~Slb9^+QrO$rHfQI^Hj1~;%%zfPd&Oj#w0W*`K6DK za0c|JICDUVQ+@II5)*#zqm|Cs?pq=v`qU*wMR(C*xh5tjt~?5WfZQR*Q=nCN4W{%r zl@^B)fs-NEah{{j9{3@iXx0y>fnoDUfTeHNI)K)mJM6)5vns75N!Qj74B$9{@vl}* z#pZPb0|Qj7^1zV|>^h$TM%sjfAdrGL?}va(4ud)7wJ#P%s}MONqK=rNBJ`^bKyqf1 z0iUvdf@lZ;@Beo{3Zy}H?}V4@XUAV(6PW(Y{DFJ`?(?sDogMbpro~Vma+22E>lsQ}`^#`nNZ!gChqv v)&Vo<=zk5={2HLve_r7KWbywm4jd|!P#`}iX9bC#1Ab~sS`UjApS=7pD$DXt literal 0 HcmV?d00001 diff --git a/apps/admin-ui/tests/BUGS.md b/apps/admin-ui/tests/BUGS.md deleted file mode 100644 index 05d751e..0000000 --- a/apps/admin-ui/tests/BUGS.md +++ /dev/null @@ -1,242 +0,0 @@ -# Known bugs — apps/admin-ui - -Found while writing the integration test suite (`tests/`). Each entry names the -file and line, what the code does, what was expected, and the evidence. Severity -is my judgement of user impact. - ---- - -## High — user-facing breakage - -### 1. Add Product / Add Variant crashes (Formik empty-string normalisation) - -`src/components/ProductForm.tsx:80` - -```ts -const variantSignature = (attributes: Attribute[]): string => - attributes - .map((a) => `${(a.featureName ?? '').trim().toLowerCase()}::${a.featureValue.trim().toLowerCase()}`) -``` - -`featureName` is guarded, `featureValue` is not. Formik's `validateYupSchema` -normalises empty strings to `undefined` before running Yup, so the `variants` -`unique-variants` `.test()` receives attributes whose `featureValue` is -`undefined` (`defaultAttribute`/`quantityAttribute` both start as `''`) and -`a.featureValue.trim()` throws `TypeError`. - -**Impact:** every keystroke on the Add Product form (validation runs on change) -and the "Add Variant" / "Add Feature" buttons throw. Creating a product is -unusable. Editing only works when the fetched SKUs already have non-empty -feature values. - -**Expected:** `(a.featureValue ?? '').trim()`. - -**Pinned by:** `tests/components/product-form.test.tsx`, -`tests/screens/products-add.test.tsx`. - -### 2. Coupon code list crashes on validation - -`src/components/CouponForm.tsx:68` - -```ts -const codes = (value.couponCodes || []).map((c: string) => c.trim()).filter(Boolean); -``` - -The sibling `codes-required` test on line 61 guards with `c && c.trim()`; this -one does not. Formik normalises the default `couponCodes: ['']` to `[undefined]`, -so `c.trim()` throws. - -**Impact:** toggling "Is Reserved Coupon", switching discount type, "+ Add Code", -or selecting a user (`setFieldValue`) crashes the coupon form. - -**Expected:** `(c || '').trim()` or filter first. - -**Pinned by:** `tests/components/coupon-form.test.tsx`. - -### 3. Prices Overview saves the SKU id as the product id - -`app/(drawer)/dashboard/prices-overview/index.tsx:270` (and `:276`) - -```ts -const update: any = { productId: sku?.id }; -``` - -`pendingChanges` is keyed by SKU id and `sku` is resolved from `allSkus`, so the -payload carries a **SKU** id. The backend `admin.product.updateProductPrices` -resolves `productId` against `productInfo.id` (`apps/backend/.../product.ts:436` -→ `packages/db_helper_*/src/admin-apis/product.ts`), so it throws -`Invalid product IDs: ...` for every row. - -**Expected:** send the SKU's parent product id (`sku.productId`). - -**Pinned by:** `tests/screens/prices-overview.test.tsx`. - -### 4. Product Groupings save SKU ids as product ids - -`components/ProductGroupForm.tsx:44,119` + `components/ProductsSelector.tsx:117` - -`ProductsSelector` emits `value: sku.id` (a SKU id) and the form forwards it as -`product_ids`. `createProductGroup` / `updateProductGroup` insert those into -`product_group_membership.productId`, which FKs `productInfo.id`. Create and -edit are also inconsistent: edit seeds `group.products.map(p => p.id)` (product -ids). - -**Expected:** emit/insert product ids. - -**Pinned by:** `tests/components/product-group-form.test.tsx`. - -### 5. "Popular Items" add silently drops the selected product - -`app/(drawer)/dashboard/customize-app/popular-items.tsx:184` - -```ts -const newProducts = selectedProductIds - .map(id => allProducts?.products.find(p => p.id === id)) -``` - -`selectedProductIds` are SKU ids (from `ProductsSelector`), matched against -product ids, so the lookup misses and the dialog closes with nothing added. -The label formatter also runs `labelFormat({ productName, price })` on a -`SkuSummary` that has no `price`, rendering `₹undefined`. - -**Expected:** match on `sku.productId`. - -**Pinned by:** `tests/screens/customize-app-popular-items.test.tsx`. - -### 6. StoreForm bypasses Formik validation - -`components/StoreForm.tsx:111,183` - -The submit button calls a local `submit()` that invokes the `onSubmit` prop -directly; Formik's `handleSubmit` is destructured (`:110`) but never called, so -`validationSchema` never runs. Combined with `owner` initialised to `0` -(`stores/add.tsx:35`) and `Yup.number().required()` accepting `0`, an ownerless -store is submitted and rejected by the backend instead of inline. - -**Expected:** `onPress={handleSubmit}`. - -**Pinned by:** `tests/components/store-form.test.tsx`, -`tests/screens/stores-add.test.tsx`. - ---- - -## Medium - -### 7. Dashboard Banners fires duplicate `updateBanner` calls on save - -`app/(drawer)/dashboard/dashboard-banners/index.tsx:75-116` - -`handleSave` collects `bannersToUpdate` in a per-banner loop and again in a -per-slot loop. A banner whose slot changed is pushed by both, so the same -`updateBanner({ id, serialNum })` fires twice; moving a banner between slots can -emit contradictory updates. - -**Expected:** de-duplicate by banner id. - -**Pinned by:** `tests/screens/banners-index.test.tsx`. - -### 8. Banner edit screen shows "Banner not found" on mount - -`app/(drawer)/dashboard/dashboard-banners/edit/[id].tsx:42-73` - -`useEffect(..., [bannerId, bannerData])` calls `loadBanner` on the first render, -when `bannerData` is still `undefined`, taking the `else` branch: -`Alert.alert('Error', 'Banner not found')` + `router.back()` — before the query -resolves. The form then renders anyway. - -**Expected:** wait for the query to settle before treating "no data" as missing. - -**Pinned by:** `tests/screens/banners-edit.test.tsx`. - -### 9. Refund / cancellation-coupon actions are unreachable - -`app/(drawer)/dashboard/manage-orders/order-details/[id].tsx:697-769` - -The entire Refund Details block is commented out. It is the only caller of -`setInitiateRefundDialogOpen(true)` and `setGenerateCouponDialogOpen(true)`, so -`admin.payments.initiateRefund` and `admin.coupon.generateCancellationCoupon` -can never fire from the UI. The `initiateRefund` success alert (lines 66-69) -also drops the amount from its template string. - -**Expected:** re-enable the block when the feature ships. - -**Pinned by:** `tests/screens/order-details.test.tsx` (documents the gap). - -### 10. Complaints resolve can send an empty response the backend rejects - -`app/(drawer)/dashboard/complaints/index.tsx:66` - -```ts -resolveComplaint.mutate({ id: String(selectedComplaintId), response: response ?? '' }, ...) -``` - -The backend input requires `response: z.string().min(1)`. Confirming Resolve with -no comment sends `''` and gets a server error (surfaced as a generic alert) -instead of being blocked client-side. - -**Expected:** require a response, or make it optional server-side. - -**Pinned by:** `tests/screens/complaints-index.test.tsx`. - ---- - -## Low - -### 11. Inline "Packaged" toggle in the orders list is inert - -`app/(drawer)/dashboard/manage-orders/orders/index.tsx:218` -`onPress={() => {}}`. Packaged changes only work through `OrderOptionsMenu`. - -### 12. CancelOrderDialog has an unreachable validation branch - -`components/CancelOrderDialog.tsx:18-21` alerts on an empty reason, but the -confirm button is disabled while the reason is empty (`:85`), so the branch -never runs. - -### 13. Send Notifications shows the error alert twice - -`app/(drawer)/dashboard/send-notifications/index.tsx:48-50,87-96` — the mutation -has an `onError` alert and the caller also try/catches and alerts. - -### 14. Product Groupings "N Products" does nothing - -`app/(drawer)/dashboard/product-groupings/index.tsx:11,130` — `BottomDialog` is -imported and `viewProducts` is set by `onViewProducts`, but no dialog renders. - -### 15. `NotificationToast` calls a hook outside a component - -`services/toaster.tsx:39-40` — `NotificationToast` calls `useRouter()` though it -is exported as an event helper, not rendered as a component (Rules of Hooks). - -### 16. Upload key parsing assumes path-style S3 URLs - -`hooks/useUploadToObjectStore.ts:99-104` — `extractKeyFromPresignedUrl` strips the -first path segment (`slice(1)`). Correct for the backend's current -`//` URLs, but breaks for virtual-host-style -(`./`). The backend's own `s3-client.ts` uses `slice(-2)`. - ---- - -## Test-harness limitations (not app bugs) - -- **`expo-image-picker` / `expo-document-picker` mocks do not reach `packages/ui`.** - `packages/ui` resolves its own copy of those modules, so `common-ui`'s - `usePickImage`/`ImageUploader` call the real (native) picker and cannot be - driven from a test. Image-upload flows are therefore exercised by mocking the - upload hook or seeding state, and upload integration is not covered. -- **`@expo/vector-icons` has a duplicate copy under `packages/ui/node_modules`,** - so `UNSAFE_getAllByType(MaterialIcons)` from the app's copy does not find the - `common-ui` icons. Prefer text/testID-based queries. -- **`react-native-draggable-flatlist` mock** ignores `ListHeaderComponent` / - `ListFooterComponent` and never calls `onDragEnd`, so drag-reorder save flows - cannot be asserted through the mock. - -## Already fixed during this work - -- `stores/edit.tsx` now invalidates `admin.store.getStores` (only `getStoreById` - was refetched before). -- `coupons/create.tsx` + `coupons/edit/[id].tsx` invalidate - `admin.coupon.getAll` / `getReservedCoupons` instead of refetching with a - hardcoded `search: ''` that missed the list's key when a search was active. -- `tests/mocks/native.ts` `tabViewMock` `SceneMap` returned the raw map instead - of a `renderScene` function (corrected). diff --git a/apps/admin-ui/tests/components/banner-form.test.tsx b/apps/admin-ui/tests/components/banner-form.test.tsx deleted file mode 100644 index cfd98fd..0000000 --- a/apps/admin-ui/tests/components/banner-form.test.tsx +++ /dev/null @@ -1,120 +0,0 @@ -/** - * BannerForm component (components/BannerForm.tsx) — validation, submit - * gating, submit/cancel callbacks and the existing-image (edit) display. - */ - -import React from 'react' -import { Alert } from 'react-native' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' - -import BannerForm, { BannerFormData } from '@/components/BannerForm' -import { setupApiMocks } from '../mocks/api' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { renderWithProviders } from '../helpers/render' - -const onSubmit = jest.fn() -const onCancel = jest.fn() - -const initialValues: BannerFormData = { - name: '', - imageUrl: '', - description: '', - skuIds: [], - redirectUrl: '', -} - -const blur = (placeholder: string, name: string) => { - fireEvent(screen.getByPlaceholderText(placeholder), 'blur', { - target: { name }, - persist: () => {}, - }) -} - -const renderForm = (props: Partial> = {}) => - renderWithProviders( - - ) - -describe('BannerForm', () => { - beforeEach(() => { - resetStaffAuthMock() - onSubmit.mockClear() - onCancel.mockClear() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - setupApiMocks() - }) - - it('renders the banner fields', () => { - renderForm() - - expect(screen.getByPlaceholderText('Enter banner name')).toBeVisible() - expect(screen.getByPlaceholderText('Enter banner description (optional)')).toBeVisible() - expect(screen.getByPlaceholderText('https://example.com/redirect')).toBeVisible() - expect(screen.getByText('Create Banner')).toBeVisible() - }) - - it('requires a banner name', async () => { - renderForm() - - blur('Enter banner name', 'name') - - expect(await screen.findByText('Banner name is required')).toBeVisible() - }) - - it('rejects a malformed redirect URL', async () => { - renderForm() - - fireEvent.changeText(screen.getByPlaceholderText('https://example.com/redirect'), 'nope') - blur('https://example.com/redirect', 'redirectUrl') - - expect(await screen.findByText('Please enter a valid URL')).toBeVisible() - }) - - it('does not submit until the form is valid and dirty', async () => { - renderForm() - - fireEvent.press(screen.getByText('Create Banner')) - expect(onSubmit).not.toHaveBeenCalled() - - await act(async () => { - fireEvent.changeText(screen.getByPlaceholderText('Enter banner name'), 'My Banner') - }) - fireEvent.press(screen.getByText('Create Banner')) - - await waitFor(() => expect(onSubmit).toHaveBeenCalledTimes(1)) - expect(onSubmit.mock.calls[0][0]).toMatchObject({ name: 'My Banner' }) - expect(onSubmit.mock.calls[0][1]).toBeUndefined() - }) - - it('uses the provided submit button label', () => { - renderForm({ submitButtonText: 'Update Banner' }) - - expect(screen.getByText('Update Banner')).toBeVisible() - }) - - it('shows the saving state', () => { - renderForm({ isSubmitting: true }) - - expect(screen.getByText('Saving...')).toBeVisible() - }) - - it('calls onCancel', () => { - renderForm() - - fireEvent.press(screen.getByText('Cancel')) - - expect(onCancel).toHaveBeenCalled() - }) - - it('shows the existing image as filling the single-image slot', async () => { - renderForm({ existingImageUrl: 'https://cdn.example.com/seven.jpg' }) - - // ImageUploader blocks the add tile once an existing image is present. - expect(await screen.findByText('Only one image allowed')).toBeVisible() - }) -}) diff --git a/apps/admin-ui/tests/components/cancel-order-dialog.test.tsx b/apps/admin-ui/tests/components/cancel-order-dialog.test.tsx deleted file mode 100644 index f6f2b47..0000000 --- a/apps/admin-ui/tests/components/cancel-order-dialog.test.tsx +++ /dev/null @@ -1,98 +0,0 @@ -/** - * CancelOrderDialog — reason gating, the cancelOrder mutation and callbacks. - */ - -import React from 'react' -import { Alert } from 'react-native' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' - -import CancelOrderDialog from '@/components/CancelOrderDialog' -import { setupApiMocks, resetStorage } from '../mocks/api' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { expectProcedureCalled, lastProcedureInput } from '../mocks/procedures' -import { renderWithProviders } from '../helpers/render' - -describe('CancelOrderDialog', () => { - const onClose = jest.fn() - const onSuccess = jest.fn() - - beforeEach(async () => { - onClose.mockClear() - onSuccess.mockClear() - resetStaffAuthMock() - await resetStorage() - setupApiMocks({ procedures: { 'admin.order.cancelOrder': { success: true, message: 'ok' } } }) - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('renders the dialog chrome and reason input', () => { - renderWithProviders( - - ) - - expect(screen.getAllByText('Cancel Order')).toHaveLength(2) - expect(screen.getByText(/refund record will be created/)).toBeVisible() - expect(screen.getByPlaceholderText('Enter reason for cancellation...')).toBeVisible() - expect(screen.getByText('Keep Order')).toBeVisible() - }) - - it('does not submit and does not confirm when the reason is empty', () => { - const { fetchMock } = setupApiMocks({ - procedures: { 'admin.order.cancelOrder': { success: true, message: 'ok' } }, - }) - - renderWithProviders( - - ) - - const confirm = screen.getAllByText('Cancel Order').pop()! - fireEvent.press(confirm) - - expect(Alert.alert).not.toHaveBeenCalled() - expect(fetchMock).not.toHaveBeenCalled() - }) - - it('asks for confirmation then cancels with the typed reason', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { 'admin.order.cancelOrder': { success: true, message: 'cancelled' } }, - }) - - renderWithProviders( - - ) - - fireEvent.changeText( - screen.getByPlaceholderText('Enter reason for cancellation...'), - 'Out of stock' - ) - fireEvent.press(screen.getAllByText('Cancel Order').pop()!) - - const call = (Alert.alert as jest.Mock).mock.calls.find((c) => c[0] === 'Cancel Order') - expect(call).toBeTruthy() - const buttons = call![2] as { text: string; onPress?: () => void }[] - const yes = buttons.find((b) => b.text === 'Yes, Cancel')! - - await act(async () => { - yes.onPress?.() - }) - - await waitFor(() => expectProcedureCalled(fetchMock, 'admin.order.cancelOrder')) - expect(lastProcedureInput(fetchMock, 'admin.order.cancelOrder')).toEqual({ - orderId: 7, - reason: 'Out of stock', - }) - expect(onClose).toHaveBeenCalled() - expect(onSuccess).toHaveBeenCalled() - }) - - it('keeps the order via the secondary button', () => { - renderWithProviders( - - ) - - fireEvent.press(screen.getByText('Keep Order')) - - expect(onClose).toHaveBeenCalled() - expect(onSuccess).not.toHaveBeenCalled() - }) -}) diff --git a/apps/admin-ui/tests/components/coupon-form.test.tsx b/apps/admin-ui/tests/components/coupon-form.test.tsx deleted file mode 100644 index 988ce56..0000000 --- a/apps/admin-ui/tests/components/coupon-form.test.tsx +++ /dev/null @@ -1,170 +0,0 @@ -/** - * CouponForm component (src/components/CouponForm.tsx) — Formik validation, - * discount-type switching, coupon-code entry (incl. bulk generation) and the - * applicable-users lookup dialog. - * - * NOTE: The default form starts with an empty coupon-code slot, and Formik - * normalises `['']` to `[undefined]` before Yup runs, which makes the - * `codes-unique` test call `.trim()` on `undefined` (see the reported bug). - * Every interaction that triggers validation is therefore exercised from a - * valid `initialValues` seed; the code-entry flow is covered by typing a code - * first. - */ - -import React from 'react' -import { Alert } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import CouponForm from '@/src/components/CouponForm' -import { setupApiMocks } from '../mocks/api' -import { lastProcedureInput } from '../mocks/procedures' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { renderWithProviders } from '../helpers/render' - -const onSubmit = jest.fn() - -const validInitialValues = { - couponCodes: ['SAVE10'], - isUserBased: false, - isApplyForAll: false, - targetUsers: [], - discountPercent: 10, - applicableUsers: [], - skuIds: [], - exclusiveApply: false, - isFirstOrderOnly: false, - isReservedCoupon: false, -} - -const usersProcedure = { - users: [ - { id: 11, name: 'Alice', mobile: '9000000001' }, - { id: 12, name: 'Bob', mobile: '9000000002' }, - ], -} - -describe('CouponForm', () => { - beforeEach(() => { - resetStaffAuthMock() - onSubmit.mockClear() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - setupApiMocks({ - procedures: { 'admin.coupon.getUsersMiniInfo': usersProcedure }, - }) - }) - - it('renders the default form', () => { - renderWithProviders() - - expect(screen.getByText('Coupon Codes')).toBeVisible() - expect(screen.getByText('Discount Type *')).toBeVisible() - expect(screen.getByText('Is Reserved Coupon')).toBeVisible() - expect(screen.getByText('Create Coupon')).toBeVisible() - }) - - it('validates the form before calling onSubmit', async () => { - renderWithProviders() - - fireEvent.press(screen.getByText('Create Coupon')) - - await waitFor(() => expect(screen.getByText('Create Coupon')).toBeVisible()) - expect(onSubmit).not.toHaveBeenCalled() - }) - - it('uppercases the coupon code and submits the entered values', async () => { - renderWithProviders() - - fireEvent.changeText(screen.getByPlaceholderText('e.g., SECRET10'), 'save10') - fireEvent.press(screen.getByText('Percentage')) - fireEvent.changeText(screen.getByPlaceholderText('e.g., 10'), '10') - fireEvent.press(screen.getByText('Create Coupon')) - - await waitFor(() => expect(onSubmit).toHaveBeenCalledTimes(1)) - expect(onSubmit.mock.calls[0][0]).toMatchObject({ - couponCodes: ['SAVE10'], - discountPercent: 10, - isUserBased: false, - isApplyForAll: false, - isReservedCoupon: false, - }) - }) - - it('switches between percentage and flat discount fields', () => { - renderWithProviders( - - ) - - expect(screen.getByPlaceholderText('e.g., 10')).toBeVisible() - expect(screen.queryByPlaceholderText('e.g., 50')).toBeNull() - - fireEvent.press(screen.getByText('Flat Amount')) - - expect(screen.getByPlaceholderText('e.g., 50')).toBeVisible() - expect(screen.queryByPlaceholderText('e.g., 10')).toBeNull() - }) - - it('disables target audience for reserved coupons', () => { - renderWithProviders( - - ) - - expect( - screen.queryByText('Target Audience (Disabled for Reserved Coupons)') - ).toBeNull() - - fireEvent.press(screen.getByRole('checkbox')) - - expect( - screen.getByText('Target Audience (Disabled for Reserved Coupons)') - ).toBeVisible() - }) - - it('generates sequential codes from a pattern code', async () => { - renderWithProviders() - - fireEvent.changeText(screen.getByPlaceholderText('e.g., SECRET10'), 'ABC1') - fireEvent.press(screen.getByText('Add Multiple')) - - expect(screen.getByText('Add Multiple Coupons')).toBeVisible() - fireEvent.changeText(screen.getByPlaceholderText('e.g., 10'), '2') - fireEvent.press(screen.getByText('Generate')) - - await waitFor(() => expect(screen.getByDisplayValue('ABC2')).toBeVisible()) - expect(screen.getByDisplayValue('ABC3')).toBeVisible() - }) - - it('loads and selects applicable users', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { 'admin.coupon.getUsersMiniInfo': usersProcedure }, - }) - renderWithProviders( - - ) - - fireEvent.press(screen.getByText('Select users...')) - - expect(await screen.findByText('9000000001 - Alice')).toBeVisible() - expect(lastProcedureInput(fetchMock, 'admin.coupon.getUsersMiniInfo')).toMatchObject({ - search: '', - limit: 10, - offset: 0, - }) - - fireEvent.press(screen.getByText('9000000001 - Alice')) - fireEvent.press(screen.getByText('Done')) - - await waitFor(() => expect(screen.getByText('1 users selected')).toBeVisible()) - }) -}) diff --git a/apps/admin-ui/tests/components/order-notes-form.test.tsx b/apps/admin-ui/tests/components/order-notes-form.test.tsx deleted file mode 100644 index b592c11..0000000 --- a/apps/admin-ui/tests/components/order-notes-form.test.tsx +++ /dev/null @@ -1,82 +0,0 @@ -/** - * OrderNotesForm — empty validation, updateNotes mutation and callbacks. - */ - -import React from 'react' -import { Alert } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import { OrderNotesForm } from '@/components/OrderNotesForm' -import { setupApiMocks, resetStorage } from '../mocks/api' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { expectProcedureCalled, lastProcedureInput } from '../mocks/procedures' -import { renderWithProviders } from '../helpers/render' - -describe('OrderNotesForm', () => { - const onSuccess = jest.fn() - const onCancel = jest.fn() - - beforeEach(async () => { - onSuccess.mockClear() - onCancel.mockClear() - resetStaffAuthMock() - await resetStorage() - setupApiMocks({ procedures: { 'admin.order.updateNotes': { id: 5 } } }) - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('renders the initial notes and actions', () => { - renderWithProviders( - - ) - - expect(screen.getByText('Add Order Notes')).toBeVisible() - expect(screen.getByDisplayValue('existing')).toBeVisible() - expect(screen.getByText('Save Notes')).toBeVisible() - expect(screen.getByText('Cancel')).toBeVisible() - }) - - it('rejects empty notes without calling the mutation', () => { - const { fetchMock } = setupApiMocks({ - procedures: { 'admin.order.updateNotes': { id: 5 } }, - }) - - renderWithProviders() - - fireEvent.press(screen.getByText('Save Notes')) - - expect(Alert.alert).toHaveBeenCalledWith('Error', 'Please enter some notes') - expect(fetchMock).not.toHaveBeenCalled() - }) - - it('saves trimmed notes and fires onSuccess', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { 'admin.order.updateNotes': { id: 5 } }, - }) - - renderWithProviders() - - fireEvent.changeText( - screen.getByPlaceholderText('Enter notes for this order...'), - ' handle with care ' - ) - fireEvent.press(screen.getByText('Save Notes')) - - await waitFor(() => expectProcedureCalled(fetchMock, 'admin.order.updateNotes')) - expect(lastProcedureInput(fetchMock, 'admin.order.updateNotes')).toEqual({ - orderId: 5, - adminNotes: 'handle with care', - }) - await waitFor(() => expect(onSuccess).toHaveBeenCalled()) - expect(Alert.alert).toHaveBeenCalledWith('Success', 'Notes updated successfully') - }) - - it('calls onCancel when the cancel button is pressed', () => { - renderWithProviders() - - fireEvent.press(screen.getByText('Cancel')) - - expect(onCancel).toHaveBeenCalled() - expect(onSuccess).not.toHaveBeenCalled() - }) -}) diff --git a/apps/admin-ui/tests/components/order-options-menu.test.tsx b/apps/admin-ui/tests/components/order-options-menu.test.tsx deleted file mode 100644 index a300b71..0000000 --- a/apps/admin-ui/tests/components/order-options-menu.test.tsx +++ /dev/null @@ -1,259 +0,0 @@ -/** - * OrderOptionsMenu — action rows, responder toggles, location attach and - * WhatsApp/Dial/Maps intents. - */ - -import React from 'react' -import { Alert, Linking } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' -import Ionicons from '@expo/vector-icons/Ionicons' -import * as Location from 'expo-location' - -import { OrderOptionsMenu } from '@/components/OrderOptionsMenu' -import { setupApiMocks, resetStorage } from '../mocks/api' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { expectProcedureCalled, lastProcedureInput, procCount } from '../mocks/procedures' -import { renderWithProviders } from '../helpers/render' - -type OrderProp = React.ComponentProps['order'] - -const baseOrder: OrderProp = { - id: 11, - readableId: 11, - isPackaged: false, - isDelivered: false, - address: '12 Main St, City, State - 500001, Phone: 9876543210', - addressId: 3, - adminNotes: null, - latitude: null, - longitude: null, - status: 'pending', -} - -function renderMenu(overrides: Partial = {}, handlers: Record = {}) { - const props = { - open: true, - onClose: jest.fn(), - order: { ...baseOrder, ...overrides }, - onViewDetails: jest.fn(), - onTogglePackaged: jest.fn(), - onToggleDelivered: jest.fn(), - onOpenAdminNotes: jest.fn(), - onCancelOrder: jest.fn(), - onAttachLocation: jest.fn(), - onWhatsApp: jest.fn(), - onDial: jest.fn(), - ...handlers, - } - renderWithProviders() - return props -} - -describe('OrderOptionsMenu', () => { - beforeEach(async () => { - resetStaffAuthMock() - await resetStorage() - setupApiMocks({ procedures: { 'admin.order.updateAddressCoords': { success: true } } }) - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - jest.spyOn(Linking, 'openURL').mockResolvedValue(true) - }) - - it('renders the header and action rows', () => { - renderMenu() - - expect(screen.getByText('Order #11')).toBeVisible() - expect(screen.getByText('Select an action to perform')).toBeVisible() - expect(screen.getByText('View Details')).toBeVisible() - expect(screen.getByText('Packaged')).toBeVisible() - expect(screen.getByText('Delivered')).toBeVisible() - expect(screen.getByText('Admin Notes')).toBeVisible() - expect(screen.getByText('Cancel Order')).toBeVisible() - expect(screen.getByText('Attach Location')).toBeVisible() - expect(screen.getByText('Message On WhatsApp')).toBeVisible() - expect(screen.getByText('Dial Mobile Number')).toBeVisible() - }) - - it('describes packaged/delivered state in the row subtitles', () => { - renderMenu({ isPackaged: true, isDelivered: true }) - - expect(screen.getByText('Mark as not packaged')).toBeVisible() - expect(screen.getByText('Mark as not delivered')).toBeVisible() - }) - - it('hides cancel when the order is already cancelled', () => { - renderMenu({ status: 'cancelled' }) - - expect(screen.queryByText('Cancel Order')).toBeNull() - }) - - it('invokes view details and closes', () => { - const props = renderMenu() - - fireEvent.press(screen.getByText('View Details')) - - expect(props.onViewDetails).toHaveBeenCalled() - expect(props.onClose).toHaveBeenCalled() - }) - - it('invokes admin notes and closes', () => { - const props = renderMenu() - - fireEvent.press(screen.getByText('Admin Notes')) - - expect(props.onOpenAdminNotes).toHaveBeenCalled() - expect(props.onClose).toHaveBeenCalled() - }) - - it('invokes cancel then closes', () => { - const props = renderMenu() - - fireEvent.press(screen.getByText('Cancel Order')) - - expect(props.onCancelOrder).toHaveBeenCalled() - expect(props.onClose).toHaveBeenCalled() - }) - - it('toggles packaged through the responder', () => { - const props = renderMenu({ isPackaged: false, isDelivered: true }) - - const icon = screen - .UNSAFE_getAllByType(Ionicons) - .find((node) => node.props.name === 'square-outline')! - fireEvent(icon, 'responderEnd', { stopPropagation: jest.fn() }) - - expect(props.onTogglePackaged).toHaveBeenCalled() - expect(props.onToggleDelivered).not.toHaveBeenCalled() - }) - - it('toggles delivered through the responder', () => { - const props = renderMenu({ isPackaged: true, isDelivered: false }) - - const icon = screen - .UNSAFE_getAllByType(Ionicons) - .find((node) => node.props.name === 'square-outline')! - fireEvent(icon, 'responderEnd', { stopPropagation: jest.fn() }) - - expect(props.onToggleDelivered).toHaveBeenCalled() - expect(props.onTogglePackaged).not.toHaveBeenCalled() - }) - - it('attaches location coordinates and reports success', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { 'admin.order.updateAddressCoords': { success: true } }, - }) - const props = renderMenu() - - fireEvent.press(screen.getByText('Attach Location')) - - await waitFor(() => expectProcedureCalled(fetchMock, 'admin.order.updateAddressCoords')) - expect(lastProcedureInput(fetchMock, 'admin.order.updateAddressCoords')).toEqual({ - addressId: 3, - latitude: 16.75, - longitude: 78.0, - }) - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith( - 'Success', - 'Location attached to address successfully.' - ) - ) - expect(props.onAttachLocation).toHaveBeenCalled() - }) - - it('warns when location permission is denied and skips the mutation', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { 'admin.order.updateAddressCoords': { success: true } }, - }) - ;(Location.requestForegroundPermissionsAsync as jest.Mock).mockResolvedValueOnce({ - status: 'denied', - granted: false, - }) - - renderMenu() - - fireEvent.press(screen.getByText('Attach Location')) - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith( - 'Permission Denied', - 'Location permission is required to attach coordinates.' - ) - ) - expect(procCount(fetchMock, 'admin.order.updateAddressCoords')).toBe(0) - }) - it('opens the coordinates in Google Maps only when present', () => { - const props = renderMenu({ latitude: 16.75, longitude: 78.0 }) - - fireEvent.press(screen.getByText('Open in Maps')) - - expect(Linking.openURL).toHaveBeenCalledWith( - 'https://www.google.com/maps/search/?api=1&query=16.75,78' - ) - expect(props.onClose).toHaveBeenCalled() - }) - - it('alerts instead of opening maps when coordinates are missing', () => { - renderMenu({ latitude: null, longitude: null }) - - expect(screen.queryByText('Open in Maps')).toBeNull() - }) - - it('sends WhatsApp to the phone parsed from the address', () => { - renderMenu() - - fireEvent.press(screen.getByText('Message On WhatsApp')) - - expect(Linking.openURL).toHaveBeenCalledWith('whatsapp://send?phone=+919876543210') - }) - - it('shows the welcome message row only for a first order and opens WhatsApp', () => { - renderMenu({ isFirstOrder: true }) - - expect(screen.getByText('Send Welcome Msg')).toBeVisible() - - fireEvent.press(screen.getByText('Send Welcome Msg')) - - expect(Linking.openURL).toHaveBeenCalledWith('whatsapp://send?phone=+919876543210') - }) - - it('hides the welcome message row for repeat orders', () => { - renderMenu({ isFirstOrder: false }) - - expect(screen.queryByText('Send Welcome Msg')).toBeNull() - }) - - it('prefills the welcome message when opening the first-order WhatsApp', async () => { - setupApiMocks({ - procedures: { - 'admin.order.updateAddressCoords': { success: true }, - 'admin.region.getRegionConstants': [{ key: 'welcomeMessage', value: 'Hello & welcome!' }], - }, - }) - renderMenu({ isFirstOrder: true }) - - // The constant loads async; retry until the handler sees it. - await waitFor(() => { - fireEvent.press(screen.getByText('Send Welcome Msg')) - expect(Linking.openURL).toHaveBeenCalledWith( - 'whatsapp://send?phone=+919876543210&text=Hello%20%26%20welcome!' - ) - }) - }) - - it('dials the phone parsed from the address', () => { - renderMenu() - - fireEvent.press(screen.getByText('Dial Mobile Number')) - - expect(Linking.openURL).toHaveBeenCalledWith('tel:9876543210') - }) - - it('alerts when the address has no phone number', () => { - renderMenu({ address: '12 Main St, City' }) - - fireEvent.press(screen.getByText('Message On WhatsApp')) - - expect(Alert.alert).toHaveBeenCalledWith('No phone number found') - expect(Linking.openURL).not.toHaveBeenCalled() - }) -}) diff --git a/apps/admin-ui/tests/components/product-form.test.tsx b/apps/admin-ui/tests/components/product-form.test.tsx deleted file mode 100644 index 3b7cede..0000000 --- a/apps/admin-ui/tests/components/product-form.test.tsx +++ /dev/null @@ -1,275 +0,0 @@ -/** - * ProductForm (src/components/ProductForm.tsx) — the shared create/edit form. - * Covers render, store options, variant add/remove, validation gating and the - * submit payload. - * - * KNOWN APP BUG (src/components/ProductForm.tsx:80): `variantSignature` calls - * `a.featureValue.trim()` unguarded, so Yup validation throws whenever any - * attribute has an empty value. Triggering it from empty fields makes - * `validateForm()` reject and the form unusable. The submit tests here seed the - * form with valid `initialValues` so no empty attribute is ever validated. - */ - -import React from 'react' -import { Alert } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import ProductForm from '@/src/components/ProductForm' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { renderWithProviders } from '../helpers/render' - -const validValues = (overrides: Record = {}) => ({ - name: 'Paneer', - shortDescription: 'Fresh', - longDescription: 'Very fresh', - storeId: 1, - productType: 'item' as const, - variants: [ - { - id: undefined, - name: '', - price: 200, - marketPrice: null, - isFlashAvailable: false, - flashPrice: null, - isOffer: false, - isComboOnly: false, - isDeleted: false, - isSuspended: false, - features: [{ featureName: 'quantity', featureValue: '1 kg' }], - comboItems: [], - }, - ], - ...overrides, -}) - -const stores = [ - { id: 1, name: 'Main Store' }, - { id: 2, name: 'Second Store' }, -] - -describe('ProductForm', () => { - beforeEach(async () => { - await resetStorage() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('renders the fields and the seeded variant', async () => { - setupApiMocks({ - procedures: { 'common.getStoresSummary': { stores } }, - }) - renderWithProviders( - - ) - - expect(screen.getByTestId('product-name-input').props.value).toBe('Paneer') - expect(screen.getByTestId('variant-0-price').props.value).toBe('200') - expect(screen.getByTestId('variant-0-attr-0-name').props.value).toBe('quantity') - expect(screen.getByTestId('variant-0-attr-0-value').props.value).toBe('1 kg') - expect(screen.getByText('Create Product')).toBeVisible() - }) - - it('loads store options from getStoresSummary', async () => { - const api = setupApiMocks({ - procedures: { 'common.getStoresSummary': { stores } }, - }) - renderWithProviders( - - ) - - await waitFor(() => - expect(api.fetchMock).toHaveBeenCalled() - ) - expect(screen.getByTestId('product-store-dropdown')).toBeVisible() - }) - - it('shows edit-mode labels and the suspend checkbox', () => { - setupApiMocks({ procedures: { 'common.getStoresSummary': { stores } } }) - renderWithProviders( - - ) - - expect(screen.getByText('Save Changes')).toBeVisible() - expect(screen.getByTestId('variant-0-suspend')).toBeVisible() - }) - - it('shows the saving label while isLoading is true', () => { - setupApiMocks({ procedures: { 'common.getStoresSummary': { stores } } }) - renderWithProviders( - - ) - - expect(screen.getByText('Saving...')).toBeVisible() - }) - - it('removes a non-existing variant', () => { - const onSubmit = jest.fn() - setupApiMocks({ procedures: { 'common.getStoresSummary': { stores } } }) - renderWithProviders( - - ) - - expect(screen.getByTestId('variant-1-price')).toBeVisible() - fireEvent.press(screen.getByTestId('variant-1-remove')) - expect(screen.queryByTestId('variant-1-price')).toBeNull() - }) - - it('submits a valid form with the seeded values', async () => { - const onSubmit = jest.fn() - const api = setupApiMocks({ - procedures: { 'common.getStoresSummary': { stores } }, - }) - renderWithProviders( - - ) - - fireEvent.press(screen.getByTestId('create-product-button')) - - await waitFor(() => expect(onSubmit).toHaveBeenCalledTimes(1)) - const normalized = onSubmit.mock.calls[0][0] - expect(normalized.name).toBe('Paneer') - expect(normalized.variants[0].price).toBe(200) - expect(normalized.variants[0].features).toEqual([ - { featureName: 'quantity', featureValue: '1 kg' }, - ]) - // create mode passes an empty deleted-keys list. - expect(onSubmit.mock.calls[0][2]).toEqual([]) - expect(api.fetchMock).toHaveBeenCalled() - }) - - it('alerts instead of submitting when a price is invalid', async () => { - const onSubmit = jest.fn() - setupApiMocks({ procedures: { 'common.getStoresSummary': { stores } } }) - renderWithProviders( - - ) - - fireEvent.press(screen.getByTestId('create-product-button')) - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith('Check your form', expect.any(String)) - ) - expect(onSubmit).not.toHaveBeenCalled() - }) - - it('lists global stores in the picker and marks them (global)', async () => { - setupApiMocks({ - procedures: { - 'common.getStoresSummary': { - stores: [ - { id: 1, name: 'Main Store' }, - { id: 3, name: 'Meat Store', isGlobal: true }, - ], - }, - }, - }) - renderWithProviders( - - ) - - // The selected global store is offered (otherwise the trigger would fall - // back to the placeholder) and its label carries the global marker. - await waitFor(() => - expect(screen.getAllByText('Meat Store (global)').length).toBeGreaterThan(0) - ) - - fireEvent.press(screen.getByTestId('product-store-dropdown')) - expect(await screen.findByTestId('product-store-dropdown-option-3')).toBeVisible() - }) - - it('adopts the first regional store when the form seeds no store', async () => { - setupApiMocks({ - procedures: { - 'common.getStoresSummary': { - stores: [ - { id: 3, name: 'Meat Store', isGlobal: true }, - { id: 2, name: 'Second Store' }, - ], - }, - }, - }) - renderWithProviders( - - ) - - // Prefers the regional store even though the global one is listed first. - await waitFor(() => - expect(screen.getAllByText('Second Store').length).toBeGreaterThan(0) - ) - }) -}) diff --git a/apps/admin-ui/tests/components/product-group-form.test.tsx b/apps/admin-ui/tests/components/product-group-form.test.tsx deleted file mode 100644 index 5ebc0b5..0000000 --- a/apps/admin-ui/tests/components/product-group-form.test.tsx +++ /dev/null @@ -1,243 +0,0 @@ -/** - * ProductGroupForm (components/ProductGroupForm.tsx) — create/edit titles, - * name validation, createGroup/updateGroup payloads, product selection and the - * cancel/close handlers. - * - * NOTE: the embedded ProductsSelector emits SKU ids, but createGroup / - * updateGroup expect productInfo ids (db_helper_postgres product.ts:315/345). - * The payloads below are asserted as observed and reported as an app bug. - */ - -import React from 'react' -import MaterialIcons from '@expo/vector-icons/MaterialIcons' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import ProductGroupForm, { ProductGroup } from '@/components/ProductGroupForm' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { - expectProcedureCalled, - lastProcedureInput, - procCount, -} from '../mocks/procedures' -import { createQueryClient, renderWithProviders } from '../helpers/render' - -const skusResponse = { - skus: [ - { id: 1, productId: 10, productName: 'Chicken', label: 'Chicken 1kg' }, - { id: 2, productId: 11, productName: 'Mutton', label: 'Mutton 1kg' }, - ], -} - -const procedures = { - 'common.product.getAllProductsSummary': { products: [] }, - 'common.product.getAllSkusSummary': skusResponse, - 'admin.product.createGroup': { - group: { id: 1, groupName: 'Meat', description: null, createdAt: '2024-01-01' }, - message: 'Group created successfully', - }, - 'admin.product.updateGroup': { - group: { id: 5, groupName: 'Meat', description: 'Bundle', createdAt: '2024-01-01' }, - message: 'Group updated successfully', - }, -} - -const existingGroup: ProductGroup = { - id: 5, - groupName: 'Beef Box', - description: 'Bundle', - createdAt: '2024-01-01T00:00:00.000Z', - products: [{ id: 10 }, { id: 11 }], - productCount: 2, -} - -describe('ProductGroupForm', () => { - beforeEach(async () => { - await resetStorage() - setupApiMocks({ procedures }) - jest.spyOn(console, 'error').mockImplementation(() => {}) - }) - - it('renders in create mode', () => { - renderWithProviders( - - ) - - expect(screen.getByText('Create Product Group')).toBeVisible() - expect(screen.getByText('Group Name *')).toBeVisible() - expect(screen.getByText('Description')).toBeVisible() - expect(screen.getByText('Save')).toBeVisible() - }) - - it('renders in edit mode with the group seeded', () => { - renderWithProviders( - - ) - - expect(screen.getByText('Edit Product Group')).toBeVisible() - expect(screen.getByDisplayValue('Beef Box')).toBeVisible() - expect(screen.getByDisplayValue('Bundle')).toBeVisible() - }) - - it('blocks submission when the group name is empty', async () => { - const { fetchMock } = setupApiMocks({ procedures }) - renderWithProviders( - - ) - - fireEvent.press(screen.getByText('Save')) - - expect(await screen.findByText('Group name is required')).toBeVisible() - expect(procCount(fetchMock, 'admin.product.createGroup')).toBe(0) - }) - - it('creates a group with the entered values', async () => { - const { fetchMock } = setupApiMocks({ procedures }) - const onSuccess = jest.fn() - renderWithProviders( - - ) - - fireEvent.changeText(screen.getByPlaceholderText('Enter group name'), 'Meat') - fireEvent.changeText( - screen.getByPlaceholderText('Enter description (optional)'), - 'Protein' - ) - fireEvent.press(screen.getByText('Save')) - - await waitFor(() => expectProcedureCalled(fetchMock, 'admin.product.createGroup')) - expect(lastProcedureInput(fetchMock, 'admin.product.createGroup')).toEqual({ - group_name: 'Meat', - description: 'Protein', - product_ids: [], - }) - await waitFor(() => expect(onSuccess).toHaveBeenCalledTimes(1)) - }) - - it('creates a group carrying the selected SKU ids as product_ids', async () => { - const { fetchMock } = setupApiMocks({ procedures }) - renderWithProviders( - - ) - - await waitFor(() => - expectProcedureCalled(fetchMock, 'common.product.getAllSkusSummary') - ) - fireEvent.changeText(screen.getByPlaceholderText('Enter group name'), 'Meat') - fireEvent.press(screen.getByText('Select products')) - fireEvent.press(await screen.findByLabelText('undefined-option-1')) - fireEvent.press(screen.getByText('Save')) - - await waitFor(() => expectProcedureCalled(fetchMock, 'admin.product.createGroup')) - // Observed bug: product_ids contains the selected SKU id (1), not product id 10. - expect(lastProcedureInput(fetchMock, 'admin.product.createGroup')).toMatchObject({ - group_name: 'Meat', - product_ids: [1], - }) - }) - - it('updates the group with its seeded product ids', async () => { - const { fetchMock } = setupApiMocks({ procedures }) - const onSuccess = jest.fn() - renderWithProviders( - - ) - - fireEvent.changeText(screen.getByDisplayValue('Beef Box'), 'Beef Combo') - fireEvent.press(screen.getByText('Save')) - - await waitFor(() => expectProcedureCalled(fetchMock, 'admin.product.updateGroup')) - expect(lastProcedureInput(fetchMock, 'admin.product.updateGroup')).toEqual({ - id: 5, - group_name: 'Beef Combo', - description: 'Bundle', - product_ids: [10, 11], - }) - await waitFor(() => expect(onSuccess).toHaveBeenCalledTimes(1)) - }) - - it('invalidates the getGroups query with the tRPC array key on create and update', async () => { - // Spy on an injected client: utils.admin.product.getGroups.invalidate() calls - // queryClient.invalidateQueries({ queryKey }), and getGroups is not mounted by - // this form, so nothing hits fetch — the invalidation itself is the observable. - const client = createQueryClient() - const invalidateSpy = jest.spyOn(client, 'invalidateQueries') // keeps calling through - - // tRPC keys are [pathArray, ...]. The old bug passed a dotted string - // ('admin.product.getGroups'); only the array form is correct. - const pathOf = (call: unknown[]) => { - const key = (call[0] as { queryKey?: unknown[] } | undefined)?.queryKey - return Array.isArray(key) ? key[0] : null - } - - // Create path — same props/flow as 'creates a group with the entered values'. - const created = renderWithProviders( - , - { queryClient: client } - ) - fireEvent.changeText(screen.getByPlaceholderText('Enter group name'), 'Meat') - fireEvent.press(screen.getByText('Save')) - - await waitFor(() => expect(invalidateSpy).toHaveBeenCalled()) - expect(invalidateSpy.mock.calls.map(pathOf)).toContainEqual([ - 'admin', - 'product', - 'getGroups', - ]) - - created.unmount() - - // Update path — same props/flow as 'updates the group with its seeded product ids'. - const callsAfterCreate = invalidateSpy.mock.calls.length - renderWithProviders( - , - { queryClient: client } - ) - fireEvent.press(screen.getByText('Save')) - - await waitFor(() => - expect(invalidateSpy.mock.calls.length).toBeGreaterThan(callsAfterCreate) - ) - expect(invalidateSpy.mock.calls.slice(callsAfterCreate).map(pathOf)).toContainEqual([ - 'admin', - 'product', - 'getGroups', - ]) - }) - - it('calls onClose from the Cancel button', () => { - const onClose = jest.fn() - renderWithProviders( - - ) - - fireEvent.press(screen.getByText('Cancel')) - - expect(onClose).toHaveBeenCalledTimes(1) - }) - - it('calls onClose from the header close icon', () => { - const onClose = jest.fn() - renderWithProviders( - - ) - - const closeIcon = screen - .UNSAFE_getAllByType(MaterialIcons) - .find((i) => i.props.name === 'close') as Parameters[0] - fireEvent.press(closeIcon) - - expect(onClose).toHaveBeenCalledTimes(1) - }) -}) \ No newline at end of file diff --git a/apps/admin-ui/tests/components/product-list-dialog.test.tsx b/apps/admin-ui/tests/components/product-list-dialog.test.tsx deleted file mode 100644 index 3e50efc..0000000 --- a/apps/admin-ui/tests/components/product-list-dialog.test.tsx +++ /dev/null @@ -1,46 +0,0 @@ -/** - * ProductListDialog (components/ProductListDialog.tsx) — a read-only bottom - * dialog listing the products passed in as props. - */ - -import React from 'react' -import { screen } from '@testing-library/react-native' - -import { ProductListDialog } from '@/components/ProductListDialog' -import { renderWithProviders } from '../helpers/render' - -const products = [ - { id: 1, name: 'Chicken' }, - { id: 2, name: 'Mutton' }, - { id: 3, name: 'Fish' }, -] - -describe('ProductListDialog', () => { - it('renders the product count and each product when open', () => { - renderWithProviders( - - ) - - expect(screen.getByText('Products (3)')).toBeVisible() - expect(screen.getByText('Chicken')).toBeVisible() - expect(screen.getByText('Mutton')).toBeVisible() - expect(screen.getByText('Fish')).toBeVisible() - }) - - it('shows a count of zero for an empty list', () => { - renderWithProviders( - - ) - - expect(screen.getByText('Products (0)')).toBeVisible() - }) - - it('hides its content while closed', () => { - renderWithProviders( - - ) - - // A closed Modal does not mount its children in the tree. - expect(screen.queryByText('Products (3)')).toBeNull() - }) -}) diff --git a/apps/admin-ui/tests/components/products-selector.test.tsx b/apps/admin-ui/tests/components/products-selector.test.tsx deleted file mode 100644 index 0f50606..0000000 --- a/apps/admin-ui/tests/components/products-selector.test.tsx +++ /dev/null @@ -1,173 +0,0 @@ -/** - * ProductsSelector (components/ProductsSelector.tsx) — a dropdown-backed SKU - * picker with optional product-group selection. - */ - -import React from 'react' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' - -import ProductsSelector from '@/components/ProductsSelector' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { expectProcedureCalled, lastProcedureInput } from '../mocks/procedures' -import { renderWithProviders } from '../helpers/render' - -const skus = [ - { id: 1, productId: 10, productName: 'Chicken', label: 'Chicken 1kg' }, - { id: 2, productId: 11, productName: 'Mutton', label: 'Mutton 1kg' }, -] - -const skusResponse = { skus } - -describe('ProductsSelector', () => { - beforeEach(async () => { - await resetStorage() - }) - - it('loads SKUs from getAllSkusSummary', async () => { - const api = setupApiMocks({ - procedures: { 'common.product.getAllSkusSummary': skusResponse }, - }) - renderWithProviders() - - await waitFor(() => - expectProcedureCalled(api.fetchMock, 'common.product.getAllSkusSummary') - ) - expect(screen.getByTestId('sku-select')).toBeVisible() - }) - - it('selects a product and reports the numeric id', async () => { - const api = setupApiMocks({ - procedures: { 'common.product.getAllSkusSummary': skusResponse }, - }) - const onChange = jest.fn() - renderWithProviders( - - ) - - await waitFor(() => - expectProcedureCalled(api.fetchMock, 'common.product.getAllSkusSummary') - ) - await waitFor(() => expect(screen.getByTestId('sku-select')).toBeVisible()) - fireEvent.press(screen.getByTestId('sku-select')) - fireEvent.press(await screen.findByTestId('sku-select-option-1')) - - expect(onChange).toHaveBeenCalledWith(1) - }) - - it('toggles multiple selection', async () => { - const api = setupApiMocks({ - procedures: { 'common.product.getAllSkusSummary': skusResponse }, - }) - const onChange = jest.fn() - renderWithProviders( - - ) - - await waitFor(() => - expectProcedureCalled(api.fetchMock, 'common.product.getAllSkusSummary') - ) - fireEvent.press(screen.getByTestId('sku-select')) - fireEvent.press(await screen.findByTestId('sku-select-option-2')) - - expect(onChange).toHaveBeenCalledWith([1, 2]) - }) - - it('adds a group\'s SKUs when a group is selected', async () => { - const api = setupApiMocks({ - procedures: { 'common.product.getAllSkusSummary': skusResponse }, - }) - const onChange = jest.fn() - const onGroupChange = jest.fn() - renderWithProviders( - - ) - - await waitFor(() => - expectProcedureCalled(api.fetchMock, 'common.product.getAllSkusSummary') - ) - await waitFor(() => expect(screen.getByTestId('product-groups-dropdown')).toBeVisible()) - // Opening the SKU dropdown proves allSkus has loaded into state. - fireEvent.press(screen.getByTestId('sku-select')) - await screen.findByTestId('sku-select-option-1') - fireEvent.press(screen.getByTestId('product-groups-dropdown')) - fireEvent.press(await screen.findByTestId('product-groups-dropdown-option-100')) - - expect(onGroupChange).toHaveBeenCalledWith([100]) - expect(onChange).toHaveBeenCalledWith([1]) - }) - - it('labels a SKU that came from a selected group', async () => { - const api = setupApiMocks({ - procedures: { 'common.product.getAllSkusSummary': skusResponse }, - }) - renderWithProviders( - - ) - - await waitFor(() => - expectProcedureCalled(api.fetchMock, 'common.product.getAllSkusSummary') - ) - await waitFor(() => expect(screen.getByTestId('sku-select')).toBeVisible()) - fireEvent.press(screen.getByTestId('sku-select')) - - expect(await screen.findByTestId('sku-select-option-1')).toBeVisible() - // The "(from group)" suffix marks the grouped SKU. - expect(screen.getByText(/from group/)).toBeVisible() - }) - - it('applies a custom labelFormat', async () => { - const api = setupApiMocks({ - procedures: { 'common.product.getAllSkusSummary': skusResponse }, - }) - renderWithProviders( - `#${sku.id} ${sku.label}`} - showGroups={false} - testID="sku-select" - /> - ) - - await waitFor(() => - expectProcedureCalled(api.fetchMock, 'common.product.getAllSkusSummary') - ) - await waitFor(() => expect(screen.getByTestId('sku-select')).toBeVisible()) - fireEvent.press(screen.getByTestId('sku-select')) - - expect(await screen.findByText(/#1 Chicken 1kg/)).toBeVisible() - }) - - it('passes the search query to filtering', async () => { - const api = setupApiMocks({ - procedures: { 'common.product.getAllSkusSummary': skusResponse }, - }) - renderWithProviders() - - await waitFor(() => - expectProcedureCalled(api.fetchMock, 'common.product.getAllSkusSummary') - ) - await waitFor(() => expect(screen.getByTestId('sku-select')).toBeVisible()) - fireEvent.press(screen.getByTestId('sku-select')) - - act(() => { - fireEvent.changeText(screen.getByTestId('sku-select-search'), 'mutton') - }) - await waitFor(() => expect(screen.getByTestId('sku-select-option-2')).toBeVisible()) - expect(screen.queryByTestId('sku-select-option-1')).toBeNull() - }) -}) diff --git a/apps/admin-ui/tests/components/slot-form.test.tsx b/apps/admin-ui/tests/components/slot-form.test.tsx deleted file mode 100644 index 73e8bbf..0000000 --- a/apps/admin-ui/tests/components/slot-form.test.tsx +++ /dev/null @@ -1,214 +0,0 @@ -/** - * SlotForm component (components/SlotForm.tsx) — create/update mutations, - * validation and vendor-snippet handling. - */ - -import React from 'react' -import { Alert } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import SlotForm from '@/components/SlotForm' -import { setupApiMocks, resetStorage } from '../mocks/api' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { expectProcedureCalled, lastProcedureInput, procCount } from '../mocks/procedures' -import { searchParamsMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const DELIVERY = new Date('2026-10-01T10:00:00.000Z') -const FREEZE = new Date('2026-10-01T06:00:00.000Z') - -const procedures = { - 'admin.product.getGroups': { groups: [] }, - 'common.product.getAllSkusSummary': { skus: [] }, - 'admin.slots.createSlot': { - slot: { id: 10 }, - createdSnippets: [], - message: 'Slot created successfully', - }, - 'admin.slots.updateSlot': { - slot: { id: 7 }, - createdSnippets: [], - message: 'Slot updated successfully', - }, -} - -describe('SlotForm', () => { - beforeEach(async () => { - resetStaffAuthMock() - await resetStorage() - searchParamsMock.current = {} - setupApiMocks({ procedures }) - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('renders the create form', () => { - renderWithProviders( - - ) - - expect(screen.getByText('Create New Slot')).toBeVisible() - expect(screen.getByText('Create Slot')).toBeVisible() - expect(screen.getByText('Vendor Snippets')).toBeVisible() - expect(screen.getByText('Add Vendor Snippet')).toBeVisible() - }) - - it('blocks submit when a time is missing', async () => { - const { fetchMock } = setupApiMocks({ procedures }) - - renderWithProviders() - fireEvent.press(screen.getByTestId('create-slot-button')) - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith('Error', 'Please fill all fields') - ) - expect(procCount(fetchMock, 'admin.slots.createSlot')).toBe(0) - }) - - it('blocks submit when freeze time is after delivery time', async () => { - const { fetchMock } = setupApiMocks({ procedures }) - - renderWithProviders( - - ) - fireEvent.press(screen.getByTestId('create-slot-button')) - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith( - 'Error', - 'Freeze time must be before or equal to delivery time' - ) - ) - expect(procCount(fetchMock, 'admin.slots.createSlot')).toBe(0) - }) - - it('creates a slot with the mapped payload and calls onSlotAdded', async () => { - const { fetchMock } = setupApiMocks({ procedures }) - const onSlotAdded = jest.fn() - - renderWithProviders( - - ) - - fireEvent.press(screen.getByTestId('create-slot-button')) - - await waitFor(() => - expectProcedureCalled(fetchMock, 'admin.slots.createSlot') - ) - - expect(lastProcedureInput(fetchMock, 'admin.slots.createSlot')).toEqual({ - deliveryTime: '2026-10-01T10:00:00.000Z', - freezeTime: '2026-10-01T06:00:00.000Z', - isActive: true, - groupIds: [3], - skuIds: [11, 12], - vendorSnippets: [], - }) - await waitFor(() => expect(onSlotAdded).toHaveBeenCalled()) - expect(Alert.alert).toHaveBeenCalledWith('Success', 'Slot created successfully!') - }) - - it('includes an added vendor snippet in the create payload', async () => { - const { fetchMock } = setupApiMocks({ procedures }) - - renderWithProviders( - - ) - - fireEvent.press(screen.getByText('Add Vendor Snippet')) - fireEvent.changeText( - screen.getByPlaceholderText('Enter snippet name'), - 'Diwali Promo' - ) - fireEvent.press(screen.getByTestId('create-slot-button')) - - await waitFor(() => - expectProcedureCalled(fetchMock, 'admin.slots.createSlot') - ) - - expect( - (lastProcedureInput(fetchMock, 'admin.slots.createSlot') as any).vendorSnippets - ).toEqual([{ name: 'Diwali Promo', skuIds: [], validTill: '' }]) - }) - - it('updates an existing slot in edit mode', async () => { - const { fetchMock } = setupApiMocks({ procedures }) - const onSlotAdded = jest.fn() - - renderWithProviders( - - ) - - expect(screen.getByText('Edit Slot')).toBeVisible() - fireEvent.press(screen.getByTestId('create-slot-button')) - - await waitFor(() => - expectProcedureCalled(fetchMock, 'admin.slots.updateSlot') - ) - expectProcedureCalled(fetchMock, 'admin.slots.getSlotById') - - expect(lastProcedureInput(fetchMock, 'admin.slots.updateSlot')).toEqual({ - id: 7, - deliveryTime: '2026-10-01T10:00:00.000Z', - freezeTime: '2026-10-01T06:00:00.000Z', - isActive: true, - groupIds: [], - skuIds: [11], - vendorSnippets: [], - }) - await waitFor(() => expect(onSlotAdded).toHaveBeenCalled()) - expect(Alert.alert).toHaveBeenCalledWith('Success', 'Slot updated successfully!') - }) - - it('refetches the mounted slot detail after a successful update in edit mode', async () => { - const { fetchMock } = setupApiMocks({ procedures }) - - renderWithProviders( - - ) - - // Edit mode mounts `admin.slots.getSlotById` with enabled: true, so there is - // a live query under `admin.slots` for the invalidation to refetch. - await waitFor(() => - expect(procCount(fetchMock, 'admin.slots.getSlotById')).toBeGreaterThan(0) - ) - - // Baseline captured immediately before the press: the tests share one - // module-singleton httpBatchLink client, so counts can leak across cases — - // assert a delta, never an absolute number. - const before = procCount(fetchMock, 'admin.slots.getSlotById') - - fireEvent.press(screen.getByTestId('create-slot-button')) - - await waitFor(() => - expectProcedureCalled(fetchMock, 'admin.slots.updateSlot') - ) - - // `utils.admin.slots.invalidate()` (SlotForm.tsx update onSuccess) invalidates - // the whole `admin.slots` path, which refetches the mounted detail query. - await waitFor(() => - expect(procCount(fetchMock, 'admin.slots.getSlotById')).toBeGreaterThan( - before - ) - ) - }) -}) diff --git a/apps/admin-ui/tests/components/snippet-menu.test.tsx b/apps/admin-ui/tests/components/snippet-menu.test.tsx deleted file mode 100644 index 7eb772c..0000000 --- a/apps/admin-ui/tests/components/snippet-menu.test.tsx +++ /dev/null @@ -1,133 +0,0 @@ -/** - * SnippetMenu (components/SnippetMenu.tsx) — per-snippet options dialog: - * view orders, edit, copy URL and delete with confirmation. - * - * The trigger has no testID, so it is located as the first TouchableOpacity - * rendered by the component (the dialog's backdrop only mounts while open). - */ - -import React from 'react' -import { Alert, Clipboard, TouchableOpacity } from 'react-native' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' -import Toast from 'react-native-toast-message' - -import { SnippetMenu } from '@/components/SnippetMenu' -import type { VendorSnippet } from '@/types/vendor-snippets' -import { renderWithProviders } from '../helpers/render' - -const snippet: VendorSnippet = { - id: 5, - snippetCode: 'VS_5', - slotId: 2, - isPermanent: false, - skuIds: [10], - products: [{ id: 10, name: 'Chicken' }], - validTill: null, - createdAt: '2026-01-01T00:00:00.000Z', - accessUrl: 'https://app.freshyo.in/vendor-order-list?id=VS_5', -} - -const onEdit = jest.fn() -const onDelete = jest.fn() -const onViewOrders = jest.fn() - -const renderMenu = (overrides: Partial = {}) => - renderWithProviders( - - ) - -const openMenu = (result: ReturnType) => { - fireEvent.press(result.UNSAFE_getAllByType(TouchableOpacity)[0]) -} - -const pressLastAlertButton = (label: string) => { - const calls = (Alert.alert as jest.Mock).mock.calls - const call = calls[calls.length - 1] - const buttons = (call?.[2] ?? []) as { text: string; onPress?: () => void }[] - act(() => buttons.find((b) => b.text === label)?.onPress?.()) -} - -describe('SnippetMenu', () => { - beforeEach(() => { - onEdit.mockClear() - onDelete.mockClear() - onViewOrders.mockClear() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - jest.spyOn(Clipboard, 'setString').mockImplementation(async () => {}) - }) - - it('opens the options dialog with every action', async () => { - const result = renderMenu() - - expect(screen.queryByText('Snippet Options')).toBeNull() - openMenu(result) - - expect(await screen.findByText('Snippet Options')).toBeVisible() - expect(screen.getByText('View Orders')).toBeVisible() - expect(screen.getByText('Edit')).toBeVisible() - expect(screen.getByText('Copy URL')).toBeVisible() - expect(screen.getByText('Delete')).toBeVisible() - }) - - it('calls onViewOrders with the snippet code', async () => { - const result = renderMenu() - openMenu(result) - - fireEvent.press(await screen.findByText('View Orders')) - expect(onViewOrders).toHaveBeenCalledWith('VS_5') - }) - - it('calls onEdit with the snippet', async () => { - const result = renderMenu() - openMenu(result) - - fireEvent.press(await screen.findByText('Edit')) - expect(onEdit).toHaveBeenCalledWith(expect.objectContaining({ id: 5 })) - }) - - it('asks for confirmation before deleting and calls onDelete', async () => { - const result = renderMenu() - openMenu(result) - - fireEvent.press(await screen.findByText('Delete')) - - expect(Alert.alert).toHaveBeenCalledWith( - 'Delete Snippet', - 'Are you sure you want to delete this vendor snippet?', - expect.any(Array) - ) - expect(onDelete).not.toHaveBeenCalled() - - pressLastAlertButton('Delete') - expect(onDelete).toHaveBeenCalledWith(5) - }) - - it('copies the access URL to the clipboard', async () => { - const result = renderMenu() - openMenu(result) - - fireEvent.press(await screen.findByText('Copy URL')) - - await waitFor(() => - expect(Clipboard.setString).toHaveBeenCalledWith(snippet.accessUrl) - ) - expect(Toast.show).toHaveBeenCalledWith( - expect.objectContaining({ type: 'success', text1: 'URL copied to clipboard' }) - ) - }) - - it('alerts when there is no URL to copy', async () => { - const result = renderMenu({ accessUrl: undefined }) - openMenu(result) - - fireEvent.press(await screen.findByText('Copy URL')) - - expect(Alert.alert).toHaveBeenCalledWith('Error', 'No URL available to copy') - expect(Clipboard.setString).not.toHaveBeenCalled() - }) -}) diff --git a/apps/admin-ui/tests/components/snippet-orders-view.test.tsx b/apps/admin-ui/tests/components/snippet-orders-view.test.tsx deleted file mode 100644 index 7eb3293..0000000 --- a/apps/admin-ui/tests/components/snippet-orders-view.test.tsx +++ /dev/null @@ -1,94 +0,0 @@ -/** - * SnippetOrdersView (components/SnippetOrdersView.tsx) — read-only list of the - * orders matched by a vendor snippet, with per-order totals and an empty state. - */ - -import React from 'react' -import { fireEvent, screen } from '@testing-library/react-native' - -import SnippetOrdersView from '@/components/SnippetOrdersView' -import { renderWithProviders } from '../helpers/render' - -type Order = React.ComponentProps['orders'][number] - -const order = (overrides: Partial = {}): Order => ({ - orderId: 'ORD1', - orderDate: '2026-01-02T09:00:00.000Z', - customerName: 'Alice', - totalAmount: '100.00', - slotInfo: { time: '2026-01-03T10:00:00.000Z', sequence: [] }, - snippetCode: 'VS_5', - matchedProducts: [10], - products: [ - { - productId: 10, - productName: 'Chicken', - quantity: 2, - price: 50, - unit: 'kg', - subtotal: 100, - }, - ], - ...overrides, -}) - -describe('SnippetOrdersView', () => { - it('renders the header with snippet code, count and revenue', () => { - renderWithProviders( - - ) - - expect(screen.getByText('Orders for "VS_5"')).toBeVisible() - expect(screen.getByText('2 orders • Total: ₹150.50')).toBeVisible() - }) - - it('pluralises a single order', () => { - renderWithProviders( - - ) - - expect(screen.getByText('1 order • Total: ₹100.00')).toBeVisible() - }) - - it('renders an order card with products and the matched flag', () => { - renderWithProviders( - - ) - - expect(screen.getByText('ORD1')).toBeVisible() - expect(screen.getByText('Alice')).toBeVisible() - // Order total + product subtotal both render ₹100.00. - expect(screen.getAllByText('₹100.00')).toHaveLength(2) - expect(screen.getByText('Chicken ⭐')).toBeVisible() - expect(screen.getByText('2 kg × ₹50')).toBeVisible() - expect( - screen.getByText('Matched 1 product(s) from snippet "VS_5"') - ).toBeVisible() - }) - - it('shows the empty state when there are no matching orders', () => { - renderWithProviders( - - ) - - expect(screen.getByText('0 orders • Total: ₹0.00')).toBeVisible() - expect(screen.getByText('No matching orders')).toBeVisible() - expect( - screen.getByText("No orders found that match this snippet's criteria") - ).toBeVisible() - }) - - it('closes via the header button', () => { - const onClose = jest.fn() - renderWithProviders( - - ) - - fireEvent.press(screen.getByText('✕')) - expect(onClose).toHaveBeenCalled() - }) -}) diff --git a/apps/admin-ui/tests/components/store-form.test.tsx b/apps/admin-ui/tests/components/store-form.test.tsx deleted file mode 100644 index f976a22..0000000 --- a/apps/admin-ui/tests/components/store-form.test.tsx +++ /dev/null @@ -1,175 +0,0 @@ -/** - * StoreForm component (components/StoreForm.tsx) — validation, owner/product - * selection and the submit payload. - */ - -import React from 'react' -import { Alert } from 'react-native' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' - -import StoreForm, { StoreFormData } from '@/components/StoreForm' -import { setupApiMocks, resetStorage } from '../mocks/api' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { expectProcedureCalled } from '../mocks/procedures' -import { searchParamsMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const CREATE_INITIAL: StoreFormData = { - name: '', - description: '', - products: [], -} - -const procedures = { - 'admin.staffUser.getStaff': { - staff: [ - { id: 1, name: 'shafi', role: null, permissions: [] }, - { id: 2, name: 'naveen', role: null, permissions: [] }, - ], - }, - 'admin.product.getProducts': { products: [], count: 0 }, - 'common.product.getAllSkusSummary': { - skus: [ - { - id: 11, - productId: 1, - productName: 'Chicken', - label: 'Chicken 1kg', - images: [], - storeId: null, - price: '100', - }, - ], - }, -} - -describe('StoreForm', () => { - beforeEach(async () => { - resetStaffAuthMock() - await resetStorage() - searchParamsMock.current = {} - setupApiMocks({ procedures }) - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('renders the create form', async () => { - const onSubmit = jest.fn() - renderWithProviders( - - ) - - expect(screen.getByPlaceholderText('Enter store name')).toBeVisible() - expect(screen.getByPlaceholderText('Enter store description')).toBeVisible() - expect(screen.getByText('Select products')).toBeVisible() - expect(screen.getByText('Create Store')).toBeVisible() - }) - - it('BUG: submits even when the name is empty (validation is bypassed)', async () => { - const onSubmit = jest.fn() - renderWithProviders( - - ) - - fireEvent.press(screen.getByText('Create Store')) - await act(async () => { - await Promise.resolve() - await Promise.resolve() - }) - - // Intended: Yup `name` is required and Formik should block this. - // Actual: the button calls the `onSubmit` prop directly, so the - // validationSchema never runs. - expect(onSubmit).toHaveBeenCalledWith( - expect.objectContaining({ name: '' }) - ) - }) - - it('submits the typed name with the selected product', async () => { - const onSubmit = jest.fn() - renderWithProviders( - - ) - - fireEvent.changeText( - screen.getByPlaceholderText('Enter store name'), - 'Freshyo Form' - ) - - fireEvent.press(screen.getByText('Select products')) - fireEvent.press(await screen.findByText('Chicken - ₹100')) - - fireEvent.press(screen.getByText('Create Store')) - - await waitFor(() => - expect(onSubmit).toHaveBeenCalledWith({ - name: 'Freshyo Form', - description: '', - products: [11], - imageUrl: undefined, - }) - ) - }) - - it('renders edit mode with prefilled values and the update label', () => { - const onSubmit = jest.fn() - renderWithProviders( - - ) - - expect(screen.getByDisplayValue('Existing')).toBeVisible() - expect(screen.getByDisplayValue('Old description')).toBeVisible() - expect(screen.getByText('Update Store')).toBeVisible() - }) - - it('shows the pending label when isLoading', () => { - renderWithProviders( - - ) - - expect(screen.getByText('Creating...')).toBeVisible() - }) - - it('loads products', async () => { - const { fetchMock } = setupApiMocks({ procedures }) - renderWithProviders( - - ) - - await waitFor(() => expectProcedureCalled(fetchMock, 'admin.product.getProducts')) - }) -}) diff --git a/apps/admin-ui/tests/components/tag-form.test.tsx b/apps/admin-ui/tests/components/tag-form.test.tsx deleted file mode 100644 index 6fa7a4f..0000000 --- a/apps/admin-ui/tests/components/tag-form.test.tsx +++ /dev/null @@ -1,160 +0,0 @@ -/** - * TagForm (src/components/TagForm.tsx) — name/description fields, dashboard - * checkbox, related-store dropdown, product selection and submit payload. - * - * The submit button has no testID in source; it is located by its label. - */ - -import React from 'react' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import TagForm from '@/src/components/TagForm' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { expectProcedureCalled } from '../mocks/procedures' -import { renderWithProviders } from '../helpers/render' - -const baseValues = { - tagName: 'Bestsellers', - tagDescription: 'Top picks', - isDashboardTag: false, - relatedStores: [], - productIds: [], -} - -const stores = [ - { id: 1, name: 'Main Store' }, - { id: 2, name: 'Second Store' }, -] - -const skusResponse = { - skus: [ - { id: 1, productId: 10, productName: 'Chicken', label: 'Chicken 1kg' }, - { id: 2, productId: 11, productName: 'Mutton', label: 'Mutton 1kg' }, - ], -} - -describe('TagForm', () => { - beforeEach(async () => { - await resetStorage() - }) - - it('renders the create-mode fields with seeded values', () => { - setupApiMocks({ - procedures: { 'common.product.getAllSkusSummary': skusResponse }, - }) - renderWithProviders( - - ) - - expect(screen.getByDisplayValue('Bestsellers')).toBeVisible() - expect(screen.getByDisplayValue('Top picks')).toBeVisible() - expect(screen.getByText('Mark as Dashboard Tag')).toBeVisible() - expect(screen.getByText('Create Tag')).toBeVisible() - expect(screen.getByText('No products selected yet')).toBeVisible() - }) - - it('shows edit-mode labels', () => { - setupApiMocks({ - procedures: { 'common.product.getAllSkusSummary': skusResponse }, - }) - renderWithProviders( - - ) - - expect(screen.getByText('Update Tag')).toBeVisible() - expect(screen.getByText('Tag Image (Upload new to replace)')).toBeVisible() - }) - - it('shows the submit-progress label', () => { - setupApiMocks({ - procedures: { 'common.product.getAllSkusSummary': skusResponse }, - }) - renderWithProviders( - - ) - - expect(screen.getByText('Creating...')).toBeVisible() - expect(screen.queryByText('Create Tag')).toBeNull() - }) - - it('submits the current form values', async () => { - const onSubmit = jest.fn() - setupApiMocks({ - procedures: { 'common.product.getAllSkusSummary': skusResponse }, - }) - renderWithProviders( - - ) - - fireEvent.changeText(screen.getByDisplayValue('Bestsellers'), 'Featured') - fireEvent.press(screen.getByText('Create Tag')) - - await waitFor(() => expect(onSubmit).toHaveBeenCalledTimes(1)) - const [values, images, removedExisting] = onSubmit.mock.calls[0] - expect(values.tagName).toBe('Featured') - expect(values.tagDescription).toBe('Top picks') - expect(values.productIds).toEqual([]) - expect(images).toEqual([]) - expect(removedExisting).toBe(false) - }) - - it('toggles the dashboard-tag checkbox', async () => { - const onSubmit = jest.fn() - setupApiMocks({ - procedures: { 'common.product.getAllSkusSummary': skusResponse }, - }) - renderWithProviders( - - ) - - fireEvent.press(screen.getByRole('checkbox')) - fireEvent.press(screen.getByText('Create Tag')) - - await waitFor(() => expect(onSubmit).toHaveBeenCalledTimes(1)) - expect(onSubmit.mock.calls[0][0].isDashboardTag).toBe(true) - }) - - it('adds a selected product to the ordered list and submits its id', async () => { - const onSubmit = jest.fn() - const api = setupApiMocks({ - procedures: { 'common.product.getAllSkusSummary': skusResponse }, - }) - const result = renderWithProviders( - - ) - - await waitFor(() => - expectProcedureCalled(api.fetchMock, 'common.product.getAllSkusSummary') - ) - - // ProductsSelector is rendered without a testID. Open the SKU dropdown by - // its placeholder text, then pick the first option. - fireEvent.press(screen.getByText('Search and select products...')) - const option = await screen.findByLabelText('undefined-option-1') - fireEvent.press(option) - - await waitFor(() => expect(screen.getAllByText('Chicken 1kg').length).toBeGreaterThan(0)) - - fireEvent.press(screen.getByText('Create Tag')) - await waitFor(() => expect(onSubmit).toHaveBeenCalledTimes(1)) - expect(onSubmit.mock.calls[0][0].productIds).toEqual([10]) - }) - - it('renders seeded products from productIds', async () => { - setupApiMocks({ - procedures: { 'common.product.getAllSkusSummary': skusResponse }, - }) - renderWithProviders( - - ) - - await waitFor(() => expect(screen.getByText('Mutton 1kg')).toBeVisible()) - expect(screen.getByText(/1 items/)).toBeVisible() - }) -}) diff --git a/apps/admin-ui/tests/components/tag-menu.test.tsx b/apps/admin-ui/tests/components/tag-menu.test.tsx deleted file mode 100644 index e20e940..0000000 --- a/apps/admin-ui/tests/components/tag-menu.test.tsx +++ /dev/null @@ -1,118 +0,0 @@ -/** - * TagMenu (src/components/TagMenu.tsx) — per-tag options menu: open dialog, - * navigate to edit, and delete with confirmation. - * - * The trigger has no testID in source, so it is located as the first - * TouchableOpacity rendered by the component. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert, TouchableOpacity } from 'react-native' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' - -import { TagMenu } from '@/src/components/TagMenu' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { - expectProcedureCalled, - lastProcedureInput, -} from '../mocks/procedures' -import { routerMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const openMenu = (result: ReturnType) => { - const trigger = result.UNSAFE_getAllByType(TouchableOpacity)[0] - fireEvent.press(trigger) -} - -const pressLastAlertButton = (label: string) => { - const calls = (Alert.alert as jest.Mock).mock.calls - const call = calls[calls.length - 1] - const buttons = (call?.[2] ?? []) as { text: string; onPress?: () => void }[] - act(() => buttons.find((b) => b.text === label)?.onPress?.()) -} - -describe('TagMenu', () => { - beforeEach(async () => { - await resetStorage() - setupApiMocks() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('opens the options dialog', async () => { - const result = renderWithProviders() - - expect(screen.queryByText('Tag Options')).toBeNull() - openMenu(result) - - await waitFor(() => expect(screen.getByText('Tag Options')).toBeVisible()) - expect(screen.getByText('Edit Tag')).toBeVisible() - expect(screen.getByText('Delete Tag')).toBeVisible() - }) - - it('navigates to the edit screen', async () => { - const result = renderWithProviders() - openMenu(result) - - fireEvent.press(await screen.findByText('Edit Tag')) - expect(routerMock.push).toHaveBeenCalledWith( - '/(drawer)/dashboard/product-tags/edit?tagId=7' - ) - }) - - it('asks for confirmation before deleting', async () => { - const result = renderWithProviders() - openMenu(result) - - fireEvent.press(await screen.findByText('Delete Tag')) - - expect(Alert.alert).toHaveBeenCalledWith( - 'Delete Tag', - 'Are you sure you want to delete this tag? This action cannot be undone.', - expect.any(Array) - ) - }) - - it('deletes the tag and calls onDeleteSuccess', async () => { - const onDeleteSuccess = jest.fn() - const api = setupApiMocks({ - procedures: { - 'admin.product.deleteProductTag': { message: 'Tag deleted successfully' }, - }, - }) - const result = renderWithProviders( - - ) - openMenu(result) - - fireEvent.press(await screen.findByText('Delete Tag')) - pressLastAlertButton('Delete') - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'admin.product.deleteProductTag')) - expect(lastProcedureInput(api.fetchMock, 'admin.product.deleteProductTag')).toEqual({ id: 7 }) - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith('Success', 'Tag deleted successfully') - ) - expect(onDeleteSuccess).toHaveBeenCalled() - }) - - it('shows an error alert when deletion fails', async () => { - setupApiMocks({ - procedures: { - 'admin.product.deleteProductTag': () => { - throw new Error('nope') - }, - }, - }) - const result = renderWithProviders() - openMenu(result) - - fireEvent.press(await screen.findByText('Delete Tag')) - pressLastAlertButton('Delete') - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith('Error', expect.any(String)) - ) - }) -}) diff --git a/apps/admin-ui/tests/components/user-incidents-view.test.tsx b/apps/admin-ui/tests/components/user-incidents-view.test.tsx deleted file mode 100644 index f8f9122..0000000 --- a/apps/admin-ui/tests/components/user-incidents-view.test.tsx +++ /dev/null @@ -1,249 +0,0 @@ -/** - * UserIncidentsView (components/UserIncidentsView.tsx) — incident list, empty - * state, add-incident dialog, validation and the addUserIncident mutation. - * - * HARNESS BUG WORKAROUND: tests/mocks/native.ts has a stray top-level `return` - * (line 89 → "'return' outside of function"). Re-mock the expo modules that - * `common-ui` eagerly imports locally. See report. - */ - -jest.mock('expo-image', () => { - const React = require('react') - const { View } = require('react-native') - const Image = (props: Record) => - React.createElement(View, { testID: 'mock-image', ...props }) - return { __esModule: true, Image, default: Image } -}) - -jest.mock('expo-image-picker', () => { - const asset = { uri: 'file:///tmp/pick.jpg', fileName: 'pick.jpg', mimeType: 'image/jpeg' } - return { - __esModule: true, - MediaTypeOptions: { Images: 'Images', All: 'All', Videos: 'Videos' }, - launchImageLibraryAsync: jest.fn(async () => ({ canceled: false, assets: [asset] })), - launchCameraAsync: jest.fn(async () => ({ canceled: false, assets: [asset] })), - requestMediaLibraryPermissionsAsync: jest.fn(async () => ({ granted: true, status: 'granted' })), - requestCameraPermissionsAsync: jest.fn(async () => ({ granted: true, status: 'granted' })), - } -}) - -jest.mock('expo-document-picker', () => ({ - __esModule: true, - getDocumentAsync: jest.fn(async () => ({ - canceled: false, - assets: [{ uri: 'file:///tmp/doc.pdf', name: 'doc.pdf', mimeType: 'application/pdf' }], - })), -})) - -import React from 'react' -import { Alert } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import { UserIncidentsView } from '@/components/UserIncidentsView' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { expectProcedureCalled, lastProcedureInput, procCount } from '../mocks/procedures' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { renderWithProviders } from '../helpers/render' - -const incident = { - id: 1, - userId: 3, - orderId: 7, - dateAdded: '2026-01-01T10:00:00.000Z', - adminComment: 'Abusive behaviour', - addedBy: 'shafi', - negativityScore: 5, - orderStatus: 'cancelled', -} - -const procedures = (overrides: Record = {}) => ({ - 'admin.user.getUserIncidents': { incidents: [incident] }, - 'admin.user.addUserIncident': { success: true, data: { id: 2 } }, - ...overrides, -}) - -const renderView = ( - props: { userId: number; orderId: number | null } = { userId: 3, orderId: null }, - overrides: Record = {} -) => { - const { fetchMock } = setupApiMocks({ procedures: procedures(overrides) }) - renderWithProviders() - return { fetchMock } -} - -const openDialog = async () => { - fireEvent.press(screen.getByText('Add Incident')) - await screen.findByText('Add User Incident') -} - -const submit = () => { - fireEvent.press(screen.getAllByText('Add Incident').pop()!) -} - -describe('UserIncidentsView', () => { - beforeEach(async () => { - resetStaffAuthMock() - await resetStorage() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('renders the section header and add button', async () => { - renderView() - - expect(screen.getByText('User Incidents')).toBeVisible() - expect(screen.getByText('Add Incident')).toBeVisible() - await screen.findByText('Abusive behaviour') - }) - - it('queries incidents for the given user', async () => { - const { fetchMock } = renderView() - - await waitFor(() => - expectProcedureCalled(fetchMock, 'admin.user.getUserIncidents') - ) - expect(lastProcedureInput(fetchMock, 'admin.user.getUserIncidents')).toEqual({ - userId: 3, - }) - }) - - it('does not query when there is no user id', () => { - const { fetchMock } = renderView({ userId: 0, orderId: null }) - - expect(procCount(fetchMock, 'admin.user.getUserIncidents')).toBe(0) - }) - - it('renders each incident with its score, author and order', async () => { - renderView() - - expect(await screen.findByText('Abusive behaviour')).toBeVisible() - expect(screen.getByText('Score: 5')).toBeVisible() - expect(screen.getByText('Added by shafi')).toBeVisible() - expect(screen.getByText('Order #7')).toBeVisible() - expect(screen.getByText(/Jan 01, 2026/)).toBeVisible() - }) - - it('renders the empty state when there are no incidents', async () => { - renderView({ userId: 3, orderId: null }, { 'admin.user.getUserIncidents': { incidents: [] } }) - - expect( - await screen.findByText('No incidents recorded for this user') - ).toBeVisible() - }) - - it('renders the empty state when the query returns null', async () => { - renderView({ userId: 3, orderId: null }, { 'admin.user.getUserIncidents': null }) - - expect( - await screen.findByText('No incidents recorded for this user') - ).toBeVisible() - }) - - it('rejects an empty incident without calling the mutation', async () => { - const { fetchMock } = renderView() - await openDialog() - - submit() - - expect(Alert.alert).toHaveBeenCalledWith( - 'Error', - 'Please enter a comment or negativity score' - ) - expect(procCount(fetchMock, 'admin.user.addUserIncident')).toBe(0) - }) - - it('adds an incident with an admin comment', async () => { - const { fetchMock } = renderView() - await openDialog() - - fireEvent.changeText( - screen.getByPlaceholderText('Enter details about the incident...'), - 'Repeated cancellations' - ) - submit() - - await waitFor(() => expectProcedureCalled(fetchMock, 'admin.user.addUserIncident')) - expect(lastProcedureInput(fetchMock, 'admin.user.addUserIncident')).toEqual({ - userId: 3, - adminComment: 'Repeated cancellations', - }) - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith('Success', 'Incident added successfully') - ) - }) - - it('adds an incident with only a negativity score', async () => { - const { fetchMock } = renderView() - await openDialog() - - fireEvent.changeText(screen.getByPlaceholderText('0'), '7') - submit() - - await waitFor(() => expectProcedureCalled(fetchMock, 'admin.user.addUserIncident')) - expect(lastProcedureInput(fetchMock, 'admin.user.addUserIncident')).toEqual({ - userId: 3, - negativityScore: 7, - }) - }) - - it('adds an incident with a comment and score including the order id', async () => { - const { fetchMock } = renderView({ userId: 3, orderId: 7 }) - await openDialog() - - fireEvent.changeText( - screen.getByPlaceholderText('Enter details about the incident...'), - 'Rude call' - ) - fireEvent.changeText(screen.getByPlaceholderText('0'), '3') - submit() - - await waitFor(() => expectProcedureCalled(fetchMock, 'admin.user.addUserIncident')) - expect(lastProcedureInput(fetchMock, 'admin.user.addUserIncident')).toEqual({ - userId: 3, - orderId: 7, - adminComment: 'Rude call', - negativityScore: 3, - }) - }) - - it('refetches the incidents and closes the dialog after adding', async () => { - const { fetchMock } = renderView() - await screen.findByText('Abusive behaviour') - const before = procCount(fetchMock, 'admin.user.getUserIncidents') - - await openDialog() - fireEvent.changeText( - screen.getByPlaceholderText('Enter details about the incident...'), - 'Late arrival' - ) - submit() - - await waitFor(() => - expect(procCount(fetchMock, 'admin.user.getUserIncidents')).toBeGreaterThan(before) - ) - await waitFor(() => expect(screen.queryByText('Add User Incident')).toBeNull()) - }) - - it('shows the error alert when adding fails and keeps the dialog open', async () => { - const { fetchMock } = renderView( - { userId: 3, orderId: null }, - { - 'admin.user.addUserIncident': () => { - throw new Error('nope') - }, - } - ) - await openDialog() - - fireEvent.changeText( - screen.getByPlaceholderText('Enter details about the incident...'), - 'Something' - ) - submit() - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith('Error', 'nope') - ) - expect(fetchMock).toBeTruthy() - expect(screen.getByText('Add User Incident')).toBeVisible() - }) -}) diff --git a/apps/admin-ui/tests/components/vendor-snippet-form.test.tsx b/apps/admin-ui/tests/components/vendor-snippet-form.test.tsx deleted file mode 100644 index 3163144..0000000 --- a/apps/admin-ui/tests/components/vendor-snippet-form.test.tsx +++ /dev/null @@ -1,240 +0,0 @@ -/** - * VendorSnippetForm (components/VendorSnippetForm.tsx) — create/edit form for - * vendor snippets: snippet-code validation, slot + product selection, and the - * create/update mutations. - */ - -import React from 'react' -import { Alert } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import VendorSnippetForm from '@/components/VendorSnippetForm' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { - expectProcedureCalled, - lastProcedureInput, - procCount, -} from '../mocks/procedures' -import { renderWithProviders } from '../helpers/render' - -const DELIVERY_TIME = '2026-12-31T10:00:00.000Z' -const SLOT_LABEL = new Date(DELIVERY_TIME).toLocaleString() - -const slotsResponse = { - slots: [{ id: 1, deliveryTime: DELIVERY_TIME, freezeTime: '2026-12-30T10:00:00.000Z' }], - count: 1, -} - -const skusResponse = { - skus: [{ id: 1, productId: 10, productName: 'Chicken', label: 'Chicken 1kg' }], -} - -const onClose = jest.fn() -const onSuccess = jest.fn() - -const renderForm = (snippet?: React.ComponentProps['snippet']) => - renderWithProviders( - - ) - -describe('VendorSnippetForm', () => { - beforeEach(async () => { - await resetStorage() - onClose.mockClear() - onSuccess.mockClear() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('renders the create form with an auto-generated snippet code', async () => { - setupApiMocks({ - procedures: { - 'user.slots.getSlots': slotsResponse, - 'common.product.getAllSkusSummary': skusResponse, - }, - }) - renderForm() - - expect(screen.getByText('Create Vendor Snippet')).toBeVisible() - expect(screen.getByPlaceholderText('Enter snippet code')).toBeVisible() - expect(screen.getByText('Create Snippet')).toBeVisible() - - await waitFor(() => - expect(screen.getByPlaceholderText('Enter snippet code').props.value).toMatch(/^VS_/) - ) - }) - - it('validates slot and product selection before submitting', async () => { - const api = setupApiMocks({ - procedures: { - 'user.slots.getSlots': slotsResponse, - 'common.product.getAllSkusSummary': skusResponse, - }, - }) - renderForm() - - fireEvent.press(screen.getByText('Create Snippet')) - - expect(await screen.findByText('Slot selection is required')).toBeVisible() - expect(await screen.findByText('At least one product must be selected')).toBeVisible() - expect(procCount(api.fetchMock, 'admin.vendorSnippets.create')).toBe(0) - }) - - it('rejects a snippet code with invalid characters', async () => { - setupApiMocks({ - procedures: { - 'user.slots.getSlots': slotsResponse, - 'common.product.getAllSkusSummary': skusResponse, - }, - }) - renderForm() - - fireEvent.changeText( - screen.getByPlaceholderText('Enter snippet code'), - 'bad code!' - ) - fireEvent.press(screen.getByText('Create Snippet')) - - expect( - await screen.findByText( - 'Snippet code can only contain letters, numbers, and underscores' - ) - ).toBeVisible() - }) - - it('creates a snippet with the selected slot and products', async () => { - const api = setupApiMocks({ - procedures: { - 'user.slots.getSlots': slotsResponse, - 'common.product.getAllSkusSummary': skusResponse, - 'admin.vendorSnippets.create': { id: 5 }, - }, - }) - renderForm() - - fireEvent.press(screen.getByText('Choose a delivery slot')) - fireEvent.press(await screen.findByText(SLOT_LABEL)) - - fireEvent.press(screen.getByText('Select products')) - fireEvent.press(await screen.findByText('Chicken 1kg')) - fireEvent.press(screen.getByText('Done')) - - fireEvent.press(screen.getByText('Create Snippet')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'admin.vendorSnippets.create')) - expect(lastProcedureInput(api.fetchMock, 'admin.vendorSnippets.create')).toEqual( - expect.objectContaining({ - isPermanent: false, - slotId: 1, - skuIds: [1], - }) - ) - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith( - 'Success', - 'Vendor snippet created successfully' - ) - ) - expect(onSuccess).toHaveBeenCalled() - expect(onClose).toHaveBeenCalled() - }) - - it('updates an existing snippet', async () => { - const api = setupApiMocks({ - procedures: { - 'user.slots.getSlots': slotsResponse, - 'common.product.getAllSkusSummary': skusResponse, - 'admin.vendorSnippets.update': { id: 3 }, - }, - }) - renderForm({ - id: 3, - snippetCode: 'VS_EXISTING', - slotId: 2, - isPermanent: false, - skuIds: [7], - validTill: '2027-01-01T00:00:00.000Z', - createdAt: '2026-01-01T00:00:00.000Z', - }) - - expect(screen.getByText('Edit Vendor Snippet')).toBeVisible() - fireEvent.press(screen.getByText('Update Snippet')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'admin.vendorSnippets.update')) - expect(lastProcedureInput(api.fetchMock, 'admin.vendorSnippets.update')).toEqual({ - id: 3, - updates: expect.objectContaining({ - snippetCode: 'VS_EXISTING', - slotId: 2, - isPermanent: false, - skuIds: [7], - validTill: '2027-01-01T00:00:00.000Z', - }), - }) - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith( - 'Success', - 'Vendor snippet updated successfully' - ) - ) - }) - - it('allows a permanent snippet without a slot and hides the slot picker', async () => { - setupApiMocks({ - procedures: { - 'user.slots.getSlots': slotsResponse, - 'common.product.getAllSkusSummary': skusResponse, - }, - }) - renderForm() - - expect(screen.getByText('Choose a delivery slot')).toBeVisible() - fireEvent.press(screen.getByText('Is Permanent?')) - - await waitFor(() => expect(screen.queryByText('Choose a delivery slot')).toBeNull()) - - fireEvent.press(screen.getByText('Create Snippet')) - await waitFor(() => - expect(screen.queryByText('Slot selection is required')).toBeNull() - ) - }) - - it('shows an error alert when the mutation fails', async () => { - setupApiMocks({ - procedures: { - 'user.slots.getSlots': slotsResponse, - 'common.product.getAllSkusSummary': skusResponse, - 'admin.vendorSnippets.update': () => { - throw new Error('save failed') - }, - }, - }) - renderForm({ - id: 3, - snippetCode: 'VS_EXISTING', - slotId: 2, - isPermanent: false, - skuIds: [7], - validTill: null, - createdAt: '2026-01-01T00:00:00.000Z', - }) - - fireEvent.press(screen.getByText('Update Snippet')) - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith('Error', expect.any(String)) - ) - }) - - it('cancels through the close button', () => { - setupApiMocks({ - procedures: { - 'user.slots.getSlots': slotsResponse, - 'common.product.getAllSkusSummary': skusResponse, - }, - }) - renderForm() - - fireEvent.press(screen.getByText('✕')) - expect(onClose).toHaveBeenCalled() - }) -}) diff --git a/apps/admin-ui/tests/contexts/staff-auth-context.test.tsx b/apps/admin-ui/tests/contexts/staff-auth-context.test.tsx deleted file mode 100644 index b85d5ef..0000000 --- a/apps/admin-ui/tests/contexts/staff-auth-context.test.tsx +++ /dev/null @@ -1,185 +0,0 @@ -/** - * staff-auth-context (components/context/staff-auth-context.tsx) — the REAL - * provider. tests/setup.ts mocks this module globally, so it is unmocked here. - * - * It imports the `@/utils/queryClient` singleton (cleared between tests) and - * needs expo-router (mocked) plus the trpc/React Query provider stack. - */ - -jest.unmock('@/components/context/staff-auth-context') -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { DeviceEventEmitter } from 'react-native' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' -import { MyText, MyTouchableOpacity } from 'common-ui' - -import { - StaffAuthProvider, - useStaffAuth, -} from '@/components/context/staff-auth-context' -import { getJWT, saveJWT } from '@/hooks/useJWT' -import queryClient from '@/utils/queryClient' -import { FORCE_LOGOUT_EVENT } from 'common-ui/src/lib/const-strs' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { expectProcedureCalled, lastProcedureInput } from '../mocks/procedures' -import { resetRouterMock, routerMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -type Auth = ReturnType - -const authSpy = jest.fn() - -function Consumer() { - const auth = useStaffAuth() - authSpy(auth) - - return ( - <> - auth.login('shafi', 'secret')}> - login - - auth.logout()}> - logout - - - ) -} - -const lastAuth = (): Auth => authSpy.mock.calls[authSpy.mock.calls.length - 1][0] - -const renderProvider = () => - renderWithProviders( - - - - ) - -const trpcErrorResponse = (message: string) => [ - { error: { message, code: -32600, data: { code: 'UNAUTHORIZED', httpStatus: 401 } } }, -] - -describe('staff-auth-context (real provider)', () => { - beforeEach(async () => { - authSpy.mockClear() - queryClient.clear() - resetRouterMock() - await resetStorage() - setupApiMocks({ - procedures: { - 'admin.staffUser.login': { token: 'jwt-abc', staff: { id: 1, name: 'shafi' } }, - }, - }) - }) - - it('redirects to /login when there is no token', async () => { - renderProvider() - - await waitFor(() => expect(routerMock.replace).toHaveBeenCalledWith('/login')) - await waitFor(() => expect(lastAuth().isLoading).toBe(false)) - expect(lastAuth().isLoggedIn).toBe(false) - expect(lastAuth().staff).toBeNull() - }) - - it('marks the session logged in when a token exists', async () => { - await saveJWT('existing-token') - - renderProvider() - - await waitFor(() => expect(lastAuth().isLoggedIn).toBe(true)) - expect(lastAuth().isLoading).toBe(false) - expect(routerMock.replace).not.toHaveBeenCalled() - }) - - it('login saves the JWT, sets staff and routes to the dashboard', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { - 'admin.staffUser.login': { token: 'jwt-abc', staff: { id: 7, name: 'shafi' } }, - }, - }) - - renderProvider() - await waitFor(() => expect(lastAuth().isLoading).toBe(false)) - - fireEvent.press(screen.getByTestId('login')) - - await waitFor(() => - expect(routerMock.replace).toHaveBeenCalledWith('/(drawer)/dashboard') - ) - await waitFor(async () => expect(await getJWT()).toBe('jwt-abc')) - - expect(lastAuth().staff).toEqual({ id: 7, name: 'shafi' }) - expect(lastAuth().isLoggedIn).toBe(true) - expect(lastAuth().loginError).toBeNull() - - expectProcedureCalled(fetchMock, 'admin.staffUser.login', { times: 1 }) - expect(lastProcedureInput(fetchMock, 'admin.staffUser.login')).toEqual({ - name: 'shafi', - password: 'secret', - }) - }) - - it('login sets loginError when the backend rejects', async () => { - setupApiMocks() - ;(global as unknown as { fetch: unknown }).fetch = jest.fn(async () => ({ - ok: true, - status: 200, - statusText: 'OK', - headers: new Map(), - url: '', - json: async () => trpcErrorResponse('Invalid credentials'), - text: async () => JSON.stringify(trpcErrorResponse('Invalid credentials')), - })) - - renderProvider() - await waitFor(() => expect(lastAuth().isLoading).toBe(false)) - - fireEvent.press(screen.getByTestId('login')) - - await waitFor(() => expect(lastAuth().loginError).toBe('Invalid credentials')) - expect(lastAuth().isLoggedIn).toBe(false) - expect(routerMock.replace).not.toHaveBeenCalledWith('/(drawer)/dashboard') - }) - - it('logout deletes the JWT, clears the query cache and routes to /login', async () => { - await saveJWT('existing-token') - const clearSpy = jest.spyOn(queryClient, 'clear') - - renderProvider() - await waitFor(() => expect(lastAuth().isLoggedIn).toBe(true)) - - fireEvent.press(screen.getByTestId('logout')) - - await waitFor(() => expect(routerMock.replace).toHaveBeenCalledWith('/login')) - await waitFor(async () => expect(await getJWT()).toBeNull()) - - expect(clearSpy).toHaveBeenCalled() - expect(lastAuth().isLoggedIn).toBe(false) - expect(lastAuth().staff).toBeNull() - }) - - it('FORCE_LOGOUT_EVENT logs the staff member out', async () => { - await saveJWT('existing-token') - - renderProvider() - await waitFor(() => expect(lastAuth().isLoggedIn).toBe(true)) - - await act(async () => { - DeviceEventEmitter.emit(FORCE_LOGOUT_EVENT) - }) - - await waitFor(() => expect(routerMock.replace).toHaveBeenCalledWith('/login')) - await waitFor(async () => expect(await getJWT()).toBeNull()) - expect(lastAuth().isLoggedIn).toBe(false) - }) - - it('useStaffAuth throws when used outside the provider', () => { - const consoleError = jest.spyOn(console, 'error').mockImplementation(() => {}) - - expect(() => renderWithProviders()).toThrow( - 'useStaffAuth must be used within a StaffAuthProvider' - ) - - consoleError.mockRestore() - }) -}) diff --git a/apps/admin-ui/tests/helpers/render.tsx b/apps/admin-ui/tests/helpers/render.tsx deleted file mode 100644 index 04d81f7..0000000 --- a/apps/admin-ui/tests/helpers/render.tsx +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Provider stack shared by the admin-ui tests. - * - * Mirrors app/_layout.tsx minus the native wrappers: trpc + React Query + - * Refresh. StaffAuthProvider is mocked globally in tests/setup.ts, so screens - * that read the session mount without it; real-provider tests render it - * explicitly. - */ - -import React from 'react' -import { QueryClient, QueryClientProvider } from '@tanstack/react-query' -import { render } from '@testing-library/react-native' -import { RefreshProvider } from 'common-ui' - -import { trpc, trpcClient } from '@/src/trpc-client' - -export function createQueryClient() { - return new QueryClient({ - defaultOptions: { queries: { retry: false, gcTime: 0 } }, - }) -} - -export interface ProviderOptions { - /** Reuse a specific query client (e.g. to assert refetches). */ - queryClient?: QueryClient -} - -export function Providers({ - children, - queryClient, -}: { children?: React.ReactNode } & ProviderOptions) { - const client = React.useMemo( - () => queryClient ?? createQueryClient(), - [queryClient] - ) - - return ( - - - {children} - - - ) -} - -/** Render a screen/component inside the standard provider stack. */ -export function renderWithProviders( - ui: React.ReactElement, - options?: ProviderOptions -) { - return render({ui}) -} diff --git a/apps/admin-ui/tests/hooks/useJWT.test.ts b/apps/admin-ui/tests/hooks/useJWT.test.ts deleted file mode 100644 index 9472924..0000000 --- a/apps/admin-ui/tests/hooks/useJWT.test.ts +++ /dev/null @@ -1,41 +0,0 @@ -/** - * useJWT (hooks/useJWT.ts) — secure-store token persistence. - * - * StorageService is globally mocked by tests/setup.ts with an in-memory map; - * resetStorage() clears the `jwt_token` slot between tests. - */ - -import { StorageService } from 'common-ui' - -import { deleteJWT, getJWT, JWT_KEY, saveJWT } from '@/hooks/useJWT' -import { resetStorage } from '../mocks/api' - -describe('useJWT', () => { - beforeEach(async () => { - await resetStorage() - }) - - it('uses the jwt_token storage key', () => { - expect(JWT_KEY).toBe('jwt_token') - }) - - it('returns null when no token has been stored', async () => { - await expect(getJWT()).resolves.toBeNull() - }) - - it('saves a token under JWT_KEY and reads it back', async () => { - await saveJWT('token-abc') - - expect(StorageService.setItem).toHaveBeenCalledWith('jwt_token', 'token-abc') - await expect(getJWT()).resolves.toBe('token-abc') - }) - - it('deletes the stored token', async () => { - await saveJWT('token-abc') - - await deleteJWT() - - expect(StorageService.removeItem).toHaveBeenCalledWith('jwt_token') - await expect(getJWT()).resolves.toBeNull() - }) -}) diff --git a/apps/admin-ui/tests/hooks/useUploadToObjectStore.test.tsx b/apps/admin-ui/tests/hooks/useUploadToObjectStore.test.tsx deleted file mode 100644 index 9ec265b..0000000 --- a/apps/admin-ui/tests/hooks/useUploadToObjectStore.test.tsx +++ /dev/null @@ -1,231 +0,0 @@ -/** - * useUploadToObjectStorage (hooks/useUploadToObjectStore.ts) — requests - * presigned URLs from `common.generateUploadUrls`, then PUTs each image in - * parallel and extracts the object key from the presigned URL. - * - * Fake timers: mutations are driven with act() + waitFor(), never awaited - * directly (see tests/screens/login.test.tsx for the pattern). - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { act, renderHook, waitFor } from '@testing-library/react-native' - -import { useUploadToObjectStorage } from '@/hooks/useUploadToObjectStore' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { - expectProcedureCalled, - lastProcedureInput, - procCount, -} from '../mocks/procedures' -import { Providers } from '../helpers/render' - -const wrapper = ({ children }: { children?: React.ReactNode }) => ( - {children} -) - -const presigned = (key: string) => - `https://meatfarmer.s3.amazonaws.com/meatfarmer/${key}` - -const blob = {} as Blob - -const jpeg = { blob, mimeType: 'image/jpeg' } -const png = { blob, mimeType: 'image/png' } - -/** Kick off `upload` without awaiting it (fake timers would deadlock). */ -const startUpload = ( - result: { current: ReturnType }, - input: Parameters['upload']>[0] -) => { - let promise: Promise = Promise.resolve() - act(() => { - promise = result.current.upload(input) - promise.catch(() => {}) - }) - return promise -} - -describe('useUploadToObjectStorage', () => { - beforeEach(async () => { - await resetStorage() - }) - - it('requests one presigned URL per image and uploads them in parallel', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { - 'common.generateUploadUrls': { - uploadUrls: [ - presigned('product-images/a.jpg'), - presigned('product-images/b.png'), - ], - }, - }, - }) - - const { result } = renderHook(() => useUploadToObjectStorage(), { wrapper }) - const promise = startUpload(result, { - images: [jpeg, png], - contextString: 'product_info', - }) - - await waitFor(() => expect(result.current.isUploading).toBe(false)) - - const uploaded = await promise - - expectProcedureCalled(fetchMock, 'common.generateUploadUrls', { times: 1 }) - expect(lastProcedureInput(fetchMock, 'common.generateUploadUrls')).toEqual({ - contextString: 'product_info', - mimeTypes: ['image/jpeg', 'image/png'], - }) - - expect(uploaded).toEqual({ - keys: ['product-images/a.jpg', 'product-images/b.png'], - presignedUrls: [ - presigned('product-images/a.jpg'), - presigned('product-images/b.png'), - ], - }) - - const putCalls = fetchMock.mock.calls.filter( - ([, options]) => (options as { method?: string } | undefined)?.method === 'PUT' - ) - expect(putCalls).toHaveLength(2) - expect(result.current.error).toBeNull() - }) - - it('resolves an empty batch without calling the backend', async () => { - const { fetchMock } = setupApiMocks() - const { result } = renderHook(() => useUploadToObjectStorage(), { wrapper }) - - let resolved: unknown - await act(async () => { - resolved = await result.current.upload({ images: [], contextString: 'store' }) - }) - - expect(resolved).toEqual({ keys: [], presignedUrls: [] }) - expect(procCount(fetchMock, 'common.generateUploadUrls')).toBe(0) - }) - - it('fails when the backend returns a URL count that does not match', async () => { - setupApiMocks({ - procedures: { - 'common.generateUploadUrls': { uploadUrls: [presigned('tags/only.jpg')] }, - }, - }) - - const { result } = renderHook(() => useUploadToObjectStorage(), { wrapper }) - const promise = startUpload(result, { - images: [jpeg, png], - contextString: 'tags', - }) - - await waitFor(() => - expect(result.current.error?.message).toBe('Expected 2 URLs, got 1') - ) - await expect(promise).rejects.toThrow('Expected 2 URLs, got 1') - }) - - it('surfaces the failed PUT status and stops uploading', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { - 'common.generateUploadUrls': { - uploadUrls: [presigned('store-images/x.jpg')], - }, - }, - }) - const trpcFetch = global.fetch - - ;(global as unknown as { fetch: unknown }).fetch = jest.fn( - async (url: string, options?: { method?: string }) => { - if (options?.method === 'PUT') { - return { - ok: false, - status: 500, - statusText: 'Server Error', - headers: new Map(), - url: String(url), - text: async (): Promise => 'AccessDenied', - json: async () => ({}), - } - } - return trpcFetch(url, options) - } - ) - const consoleError = jest.spyOn(console, 'error').mockImplementation(() => {}) - - const { result } = renderHook(() => useUploadToObjectStorage(), { wrapper }) - const promise = startUpload(result, { - images: [jpeg], - contextString: 'store', - }) - - await waitFor(() => - expect(result.current.error?.message).toBe('Upload 1 failed with status 500') - ) - await expect(promise).rejects.toThrow('Upload 1 failed with status 500') - - expect(result.current.isUploading).toBe(false) - expect(result.current.progress).toBeNull() - expectProcedureCalled(fetchMock, 'common.generateUploadUrls', { times: 1 }) - consoleError.mockRestore() - }) - - it('reports progress as each upload settles', async () => { - setupApiMocks({ - procedures: { - 'common.generateUploadUrls': { - uploadUrls: [ - presigned('product-images/a.jpg'), - presigned('product-images/b.jpg'), - ], - }, - }, - }) - const trpcFetch = global.fetch - const resolvers: Array<(value: unknown) => void> = [] - - ;(global as unknown as { fetch: unknown }).fetch = jest.fn( - (url: string, options?: { method?: string }) => { - if (options?.method === 'PUT') { - return new Promise((resolve) => resolvers.push(resolve)) - } - return trpcFetch(url, options) - } - ) - - const okResponse = { - ok: true, - status: 200, - statusText: 'OK', - headers: new Map(), - url: '', - text: async () => '', - json: async () => ({}), - } - - const { result } = renderHook(() => useUploadToObjectStorage(), { wrapper }) - const promise = startUpload(result, { - images: [jpeg, png], - contextString: 'product_info', - }) - - await waitFor(() => expect(resolvers).toHaveLength(2)) - expect(result.current.progress).toEqual({ completed: 0, total: 2 }) - - act(() => resolvers[0](okResponse)) - await waitFor(() => expect(result.current.progress).toEqual({ completed: 1, total: 2 })) - - act(() => resolvers[1](okResponse)) - await waitFor(() => expect(result.current.progress).toBeNull()) - - const uploaded = await promise - expect(uploaded).toEqual({ - keys: ['product-images/a.jpg', 'product-images/b.jpg'], - presignedUrls: [ - presigned('product-images/a.jpg'), - presigned('product-images/b.jpg'), - ], - }) - }) -}) diff --git a/apps/admin-ui/tests/jest-env.d.ts b/apps/admin-ui/tests/jest-env.d.ts deleted file mode 100644 index 9d3cb36..0000000 --- a/apps/admin-ui/tests/jest-env.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/// - -// Declares the Jest globals (describe, it, expect, jest, ...) for the tests in -// this folder. @types/jest is a devDependency, but the explicit reference means -// the globals are declared by a file inside the project rather than relying on -// ambient @types auto-inclusion. diff --git a/apps/admin-ui/tests/jest.config.js b/apps/admin-ui/tests/jest.config.js deleted file mode 100644 index ba3c377..0000000 --- a/apps/admin-ui/tests/jest.config.js +++ /dev/null @@ -1,62 +0,0 @@ -const path = require('path') - -const appRoot = path.resolve(__dirname, '..') - -/** - * Jest project for apps/admin-ui integration tests. - * - * Mirrors apps/user-ui/tests/jest.config.js. Tests live under tests/ and are - * kept out of the app build by living outside the app/ route tree. - */ -module.exports = { - preset: 'jest-expo', - rootDir: appRoot, - roots: ['/tests'], - testMatch: ['/tests/**/*.test.ts', '/tests/**/*.test.tsx'], - setupFiles: ['/tests/setup.ts'], - clearMocks: true, - // The suites are heavy (expo-router + react-query + fake timers) and several - // install module-level fakes; running them in parallel workers exhausts - // resources and hangs. Serial is ~80s and stable. - maxWorkers: 1, - forceExit: true, - moduleNameMapper: { - '^@backend/(.*)$': '/../backend/src/$1', - '^@/(.*)$': '/$1', - '^shared-types$': '/../shared-types', - '^@packages/shared$': '/../../packages/shared', - '^@packages/shared/(.*)$': '/../../packages/shared/$1', - '^global-shared$': '/../../packages/shared', - '^global-shared/(.*)$': '/../../packages/shared/$1', - '^common-ui$': '/../../packages/ui', - '^common-ui/(.*)$': '/../../packages/ui/$1', - }, - transformIgnorePatterns: [ - 'node_modules/(?!(?:.pnpm/)?(' + - [ - '(jest-)?react-native', - '@react-native(-community)?', - 'expo(nent)?', - '@expo(nent)?/.*', - '@expo-google-fonts/.*', - 'react-navigation', - '@react-navigation/.*', - '@sentry/react-native', - 'native-base', - 'react-native-svg', - 'react-native-gesture-handler', - 'react-native-reanimated', - 'react-native-safe-area-context', - 'react-native-screens', - 'react-native-draggable-flatlist', - 'react-native-tab-view', - 'react-native-toast-message', - '@trpc/.*', - '@tanstack/.*', - 'twrnc', - 'zod', - '@testing-library/react-native', - ].join('|') + - '))', - ], -} diff --git a/apps/admin-ui/tests/lib/queryClient.test.ts b/apps/admin-ui/tests/lib/queryClient.test.ts deleted file mode 100644 index e739c45..0000000 --- a/apps/admin-ui/tests/lib/queryClient.test.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * queryClient (utils/queryClient.ts) — the app-wide singleton defaults. - * - * The source only overrides `retry`. React Query therefore supplies the - * remaining observable defaults (staleTime resolves to 0, refetchOnWindowFocus - * behaves as true). We assert both the configured value and that the other two - * options are deliberately left unset. - */ - -import { QueryClient } from '@tanstack/react-query' - -import queryClient from '@/utils/queryClient' - -describe('queryClient', () => { - it('is a QueryClient instance', () => { - expect(queryClient).toBeInstanceOf(QueryClient) - }) - - it('retries failed queries 3 times by default', () => { - expect(queryClient.getDefaultOptions().queries?.retry).toBe(3) - }) - - it('retries every query with the configured default', () => { - const resolved = queryClient.defaultQueryOptions({ queryKey: ['probe'] }) - expect(resolved.retry).toBe(3) - }) - - it('does not override staleTime / refetchOnWindowFocus (library defaults apply)', () => { - const queries = queryClient.getDefaultOptions().queries - expect(queries?.staleTime).toBeUndefined() - expect(queries?.refetchOnWindowFocus).toBeUndefined() - - const resolved = queryClient.defaultQueryOptions({ queryKey: ['probe'] }) - expect(resolved.staleTime).toBeUndefined() - expect(resolved.refetchOnWindowFocus).toBeUndefined() - }) -}) diff --git a/apps/admin-ui/tests/lib/toaster.test.tsx b/apps/admin-ui/tests/lib/toaster.test.tsx deleted file mode 100644 index 4fca30b..0000000 --- a/apps/admin-ui/tests/lib/toaster.test.tsx +++ /dev/null @@ -1,51 +0,0 @@ -/** - * toaster (services/toaster.tsx) — Info/Error/Success helpers funnel into - * react-native-toast-message's Toast.show with the right type/position and an - * onPress that hides the toast. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import Toast from 'react-native-toast-message' - -import { ErrorToast, InfoToast, SuccessToast } from '@/services/toaster' - -const showMock = Toast.show as jest.Mock -const hideMock = Toast.hide as jest.Mock - -const showArg = (index: number) => showMock.mock.calls[index][0] - -describe('toaster', () => { - it('InfoToast shows an info toast at the top', () => { - InfoToast('heads up') - - expect(showMock).toHaveBeenCalledWith( - expect.objectContaining({ type: 'info', text1: 'heads up', position: 'top' }) - ) - expect(showArg(0).visibilityTime).toBe(10000) - }) - - it('ErrorToast shows an error toast at the top', () => { - ErrorToast('boom') - - expect(showMock).toHaveBeenCalledWith( - expect.objectContaining({ type: 'error', text1: 'boom', position: 'top' }) - ) - }) - - it('SuccessToast shows a success toast at the top', () => { - SuccessToast('done') - - expect(showMock).toHaveBeenCalledWith( - expect.objectContaining({ type: 'success', text1: 'done', position: 'top' }) - ) - }) - - it('hides the toast when pressed', () => { - SuccessToast('done') - - showArg(0).onPress() - - expect(hideMock).toHaveBeenCalledTimes(1) - }) -}) diff --git a/apps/admin-ui/tests/mocks/api.ts b/apps/admin-ui/tests/mocks/api.ts deleted file mode 100644 index d686a6d..0000000 --- a/apps/admin-ui/tests/mocks/api.ts +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Network-layer mocks for the admin-ui tests. - * - * All tRPC traffic goes through `global.fetch` (httpBatchLink). The registry - * resolves each batched procedure by name; anything not supplied resolves to - * `null`, and tests override with the exact shape they assert against. Tests - * that need to prove "nothing was called" use tests/mocks/procedures.ts. - */ - -import { StorageService } from 'common-ui/src/services/StorageService' -import { StorageServiceCasual } from 'common-ui/src/services/StorageServiceCasual' -import { parseTrpcUrl } from './procedures' - -const jsonResponse = (body: unknown) => ({ - ok: true, - status: 200, - statusText: 'OK', - headers: new Map(), - url: '', - json: async () => body, - text: async () => JSON.stringify(body), - clone: () => jsonResponse(body), -}) - -export interface ApiMockOptions { - /** - * Procedure registry: name -> data, or (input) => data. Unlisted procedures - * resolve to null. - */ - procedures?: Record unknown)> - /** The essentialConsts-style consts payload, if a screen reads it. */ - consts?: unknown -} - -export function setupApiMocks(opts: ApiMockOptions = {}) { - const resolveProcedure = (name: string, input: unknown): unknown => { - const override = opts.procedures?.[name] - if (override !== undefined) { - return typeof override === 'function' - ? (override as (value: unknown) => unknown)(input) - : override - } - return null - } - - const fetchMock = jest.fn( - async (url: string, options?: { method?: string; body?: unknown }) => { - const target = String(url) - const calls = parseTrpcUrl(target, options?.body) - - if (calls.length === 0) { - // Presigned S3 uploads PUT straight to a URL. - if (options?.method === 'PUT') return jsonResponse({}) - throw new Error(`[tests] unmocked fetch: ${url}`) - } - - const batch = calls.map(({ name, input }) => ({ - result: { data: resolveProcedure(name, input) }, - })) - return jsonResponse(batch) - } - ) - - ;(global as unknown as { fetch: unknown }).fetch = fetchMock - - return { fetchMock } -} - -/** Clear the in-memory auth token + cached staff identity + any casual storage. Call from beforeEach. */ -export async function resetStorage() { - await StorageService.clearAll(['jwt_token', 'staff_session']) - await StorageServiceCasual.clearAll([]) -} diff --git a/apps/admin-ui/tests/mocks/native.ts b/apps/admin-ui/tests/mocks/native.ts deleted file mode 100644 index 88a90fe..0000000 --- a/apps/admin-ui/tests/mocks/native.ts +++ /dev/null @@ -1,181 +0,0 @@ -/** - * Module stubs for native / third-party packages that cannot run under jest. - * Registered in tests/setup.ts via jest.mock factories. - * - * Deliberately permissive: tests that assert behaviour spy on the returned - * functions or override the module themselves. - */ - -import React from 'react' -import { View, Text } from 'react-native' - -/** react-native-draggable-flatlist: render children as a plain list. */ -export function draggableFlatListMock() { - const DraggableFlatList = ({ - data, - renderItem, - keyExtractor, - ListEmptyComponent, - }: { - data?: unknown[] - renderItem?: (info: { item: unknown; index: number; drag: () => void; isActive: boolean }) => React.ReactNode - keyExtractor?: (item: unknown, index: number) => string - ListEmptyComponent?: React.ReactNode - }) => { - if (!data || data.length === 0) { - return React.createElement(View, { testID: 'mock-draggable-list' }, ListEmptyComponent ?? null) - } - return React.createElement( - View, - { testID: 'mock-draggable-list' }, - data.map((item, index) => - React.createElement( - React.Fragment, - { key: keyExtractor ? keyExtractor(item, index) : index }, - renderItem?.({ item, index, drag: () => {}, isActive: false }) - ) - ) - ) - } - - return { - __esModule: true, - default: DraggableFlatList, - ScaleDecorator: ({ children }: { children?: React.ReactNode }) => - React.createElement(React.Fragment, null, children), - } -} - -/** react-native-tab-view: render every tab label and the focused scene. */ -export function tabViewMock() { - const TabView = ({ - navigationState, - renderScene, - onIndexChange, - }: { - navigationState: { index: number; routes: { key: string }[] } - renderScene: (info: { route: { key: string } }) => React.ReactNode - onIndexChange?: (index: number) => void - }) => { - const route = navigationState.routes[navigationState.index] - return React.createElement( - View, - { testID: 'mock-tab-view' }, - navigationState.routes.map((r, index) => - React.createElement( - Text, - { key: r.key, testID: `tab-${r.key}`, onPress: () => onIndexChange?.(index) }, - r.key - ) - ), - route ? renderScene({ route }) : null - ) - } - - return { - __esModule: true, - TabView, - // SceneMap must return a renderScene function, not the raw map. - SceneMap: (scenes: Record) => (info: { - route: { key: string } - }) => { - const Scene = scenes[info.route.key] - return Scene ? React.createElement(Scene) : null - }, - TabBar: () => null, - } -} - -/** react-native-toast-message: no-op show/hide. */ -export function toastMock() { - const Toast = { - show: jest.fn(), - hide: jest.fn(), - } - return { __esModule: true, default: Toast, ...Toast } -} - -/** expo-location: permissions granted, a fixed position. */ -export function locationMock() { - return { - __esModule: true, - Accuracy: { Lowest: 1, Low: 2, Balanced: 3, High: 4, Highest: 5 }, - requestForegroundPermissionsAsync: jest.fn(async () => ({ status: 'granted', granted: true })), - getForegroundPermissionsAsync: jest.fn(async () => ({ status: 'granted', granted: true })), - hasServicesEnabledAsync: jest.fn(async () => true), - getCurrentPositionAsync: jest.fn(async () => ({ - coords: { latitude: 16.75, longitude: 78.0, accuracy: 5 }, - timestamp: Date.now(), - })), - reverseGeocodeAsync: jest.fn(async () => [ - { street: 'Test Street', city: 'Mahabubnagar', region: 'Telangana', postalCode: '509001' }, - ]), - } -} - -/** expo-image-picker: one asset by default. */ -export function imagePickerMock() { - const asset = { uri: 'file:///tmp/pick.jpg', fileName: 'pick.jpg', mimeType: 'image/jpeg' } - return { - __esModule: true, - MediaTypeOptions: { Images: 'Images', All: 'All', Videos: 'Videos' }, - launchImageLibraryAsync: jest.fn(async () => ({ canceled: false, assets: [asset] })), - launchCameraAsync: jest.fn(async () => ({ canceled: false, assets: [asset] })), - requestMediaLibraryPermissionsAsync: jest.fn(async () => ({ granted: true, status: 'granted' })), - requestCameraPermissionsAsync: jest.fn(async () => ({ granted: true, status: 'granted' })), - } -} - -/** expo-document-picker: one document by default. */ -export function documentPickerMock() { - return { - __esModule: true, - getDocumentAsync: jest.fn(async () => ({ - canceled: false, - assets: [{ uri: 'file:///tmp/doc.pdf', name: 'doc.pdf', mimeType: 'application/pdf' }], - })), - } -} - -/** expo-device: a physical device. */ -export function deviceMock() { - return { - __esModule: true, - isDevice: true, - modelName: 'Jest Device', - osName: 'Android', - osVersion: '14', - } -} - -/** expo-haptics: no-ops. */ -export function hapticsMock() { - return { - __esModule: true, - impactAsync: jest.fn(async () => {}), - notificationAsync: jest.fn(async () => {}), - selectionAsync: jest.fn(async () => {}), - ImpactFeedbackStyle: { Light: 'light', Medium: 'medium', Heavy: 'heavy' }, - } -} - -/** expo-linear-gradient: passthrough View. */ -export function linearGradientMock() { - const LinearGradient = ({ children }: { children?: React.ReactNode }) => - React.createElement(View, { testID: 'mock-linear-gradient' }, children) - return { __esModule: true, LinearGradient } -} - -/** expo-blur: passthrough View. */ -export function blurMock() { - const BlurView = ({ children }: { children?: React.ReactNode }) => - React.createElement(View, { testID: 'mock-blur-view' }, children) - return { __esModule: true, BlurView } -} - -/** expo-image: passthrough Image. */ -export function imageMock() { - const Image = (props: Record) => - React.createElement(View, { testID: 'mock-image', ...props }) - return { __esModule: true, Image, default: Image } -} diff --git a/apps/admin-ui/tests/mocks/procedures.ts b/apps/admin-ui/tests/mocks/procedures.ts deleted file mode 100644 index 5e8cb7c..0000000 --- a/apps/admin-ui/tests/mocks/procedures.ts +++ /dev/null @@ -1,122 +0,0 @@ -/** - * Assert which tRPC procedures a screen called, and with what input. - * - * Every tRPC call goes through `global.fetch` (httpBatchLink), whose URL is - * `/api/trpc/[,...]?batch=1&input=`. The input param is an - * object keyed by the batch index: `{ "0": { json: }, ... }`. - * - * tests/mocks/api.ts installs the fetch stub; pass its returned `fetchMock` to - * these helpers. - */ - -export interface ProcedureCall { - name: string - input: unknown -} - -export interface FetchMockLike { - mock: { calls: unknown[][] } -} - -const MARKER = '/api/trpc/' - -const parseInputEnvelope = (raw: string | undefined) => { - if (!raw) return {} as Record - try { - return JSON.parse(raw) as Record - } catch { - return {} as Record - } -} - -const unwrapInput = (entry: unknown): unknown => { - if ( - entry != null && - typeof entry === 'object' && - 'json' in entry && - 'meta' in entry - ) { - return (entry as { json: unknown }).json - } - return entry -} - -/** Split a tRPC request URL into one entry per batched procedure. */ -export function parseTrpcUrl(url: string, body?: unknown): ProcedureCall[] { - const target = String(url) - const at = target.indexOf(MARKER) - if (at === -1) return [] - - const rest = target.slice(at + MARKER.length) - const queryAt = rest.indexOf('?') - const path = queryAt === -1 ? rest : rest.slice(0, queryAt) - const query = queryAt === -1 ? '' : rest.slice(queryAt + 1) - - const names = path.split(',').filter(Boolean) - - let inputsByIndex: Record = {} - const match = /(?:^|&)input=([^&]*)/.exec(query) - if (match) { - inputsByIndex = parseInputEnvelope(decodeURIComponent(match[1])) - } else if (typeof body === 'string') { - inputsByIndex = parseInputEnvelope(body) - } - - return names.map((name, index) => ({ - name, - input: unwrapInput(inputsByIndex[String(index)]), - })) -} - -/** Every procedure call recorded by the fetch mock, in order. */ -export function calledProcedures(fetchMock: FetchMockLike): ProcedureCall[] { - return fetchMock.mock.calls.flatMap(([url, options]) => { - const body = (options as { body?: unknown } | undefined)?.body - return parseTrpcUrl(String(url), body) - }) -} - -export function procedureCalls( - fetchMock: FetchMockLike, - name: string -): ProcedureCall[] { - return calledProcedures(fetchMock).filter((call) => call.name === name) -} - -/** Assert a procedure was called (optionally exactly `times`). */ -export function expectProcedureCalled( - fetchMock: FetchMockLike, - name: string, - options: { times?: number } = {} -): ProcedureCall[] { - const calls = procedureCalls(fetchMock, name) - - if (options.times != null) { - expect(calls).toHaveLength(options.times) - } else { - expect(calls.length).toBeGreaterThan(0) - } - - return calls -} - -/** Input of the most recent call to a procedure (undefined if never called). */ -export function lastProcedureInput( - fetchMock: FetchMockLike, - name: string -): unknown { - const calls = procedureCalls(fetchMock, name) - return calls.length === 0 ? undefined : calls[calls.length - 1].input -} - -export function procedureInput( - fetchMock: FetchMockLike, - name: string -): unknown { - return lastProcedureInput(fetchMock, name) -} - -/** Number of calls to a procedure. */ -export function procCount(fetchMock: FetchMockLike, name: string): number { - return procedureCalls(fetchMock, name).length -} diff --git a/apps/admin-ui/tests/mocks/refresh.ts b/apps/admin-ui/tests/mocks/refresh.ts deleted file mode 100644 index 3d02389..0000000 --- a/apps/admin-ui/tests/mocks/refresh.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Callbacks recorded from the mocked refresh hooks - * (common-ui/useMarkDataFetchers, common-ui/useManualRefresh) so a test can - * invoke a screen's refresh handler and assert what it refetches. - */ - -export const refreshHooks: { - markDataFetchers: (() => void) | null - manualRefresh: (() => void) | null -} = { - markDataFetchers: null, - manualRefresh: null, -} - -export function resetRefreshHooks() { - refreshHooks.markDataFetchers = null - refreshHooks.manualRefresh = null -} diff --git a/apps/admin-ui/tests/mocks/router.ts b/apps/admin-ui/tests/mocks/router.ts deleted file mode 100644 index fde616c..0000000 --- a/apps/admin-ui/tests/mocks/router.ts +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Shared spies for the mocked expo-router. - * - * The mock lives in each test file rather than in tests/setup.ts, so the ones - * that want real navigation can use expo-router/testing-library. Any file that - * renders a router consumer adds: - * - * jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - */ - -import React from 'react' - -export const routerMock = { - push: jest.fn(), - replace: jest.fn(), - back: jest.fn(), - navigate: jest.fn(), - canGoBack: jest.fn(() => false), - dismissTo: jest.fn(), - dismissAll: jest.fn(), - setParams: jest.fn(), -} - -export function resetRouterMock() { - routerMock.push.mockClear() - routerMock.replace.mockClear() - routerMock.back.mockClear() - routerMock.navigate.mockClear() - routerMock.dismissTo.mockClear() - routerMock.dismissAll.mockClear() -} - -/** Local search params returned by the mocked router. */ -export const searchParamsMock: { current: Record } = { - current: {}, -} - -/** Factory for jest.mock('expo-router', ...). */ -export function expoRouterMock() { - return { - useRouter: () => routerMock, - router: routerMock, - usePathname: () => '/dashboard', - useSegments: () => [], - useLocalSearchParams: () => searchParamsMock.current, - useGlobalSearchParams: () => searchParamsMock.current, - useFocusEffect: (callback: () => void | (() => void)) => { - const ran = React.useRef(false) - React.useEffect(() => { - if (ran.current) return - ran.current = true - return callback() - }, []) - }, - Link: ({ children }: { children?: unknown }) => children ?? null, - Slot: ({ children }: { children?: unknown }) => children ?? null, - // Layout primitives used by route files; render children through and give - // Stack/Tabs a no-op .Screen so `` does not crash. - Stack: Object.assign( - ({ children }: { children?: unknown }) => children ?? null, - { Screen: () => null } - ), - Tabs: Object.assign( - ({ children }: { children?: unknown }) => children ?? null, - { Screen: () => null } - ), - Drawer: ({ children }: { children?: unknown }) => children ?? null, - Redirect: () => null, - } -} diff --git a/apps/admin-ui/tests/mocks/staff-auth.ts b/apps/admin-ui/tests/mocks/staff-auth.ts deleted file mode 100644 index ce8f828..0000000 --- a/apps/admin-ui/tests/mocks/staff-auth.ts +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Overridable staff-auth mock with spies. - * - * tests/setup.ts stubs @/components/context/staff-auth-context with this - * factory so screens that read the staff session mount. Tests can flip the - * state in a beforeEach; reset with resetStaffAuthMock(). - */ - -import type { ReactNode } from 'react' - -export interface StaffAuthMockState { - isLoggedIn: boolean - isLoading: boolean - staff: unknown - /** Region of the signed-in staff member; suites opt in by setting this. */ - regionId: number | null - isLoggingIn: boolean - loginError: string | null - login: jest.Mock - logout: jest.Mock -} - -export const staffAuthMock: StaffAuthMockState = { - isLoggedIn: true, - isLoading: false, - staff: { id: 1, name: 'shafi' }, - regionId: null, - isLoggingIn: false, - loginError: null, - login: jest.fn(async () => {}), - logout: jest.fn(), -} - -export function resetStaffAuthMock() { - staffAuthMock.isLoggedIn = true - staffAuthMock.isLoading = false - staffAuthMock.staff = { id: 1, name: 'shafi' } - staffAuthMock.regionId = null - staffAuthMock.isLoggingIn = false - staffAuthMock.loginError = null -} - -export function staffAuthContextMock() { - return { - StaffAuthProvider: ({ children }: { children?: ReactNode }) => children ?? null, - useStaffAuth: () => ({ - isLoggedIn: staffAuthMock.isLoggedIn, - isLoading: staffAuthMock.isLoading, - staff: staffAuthMock.staff, - regionId: staffAuthMock.regionId, - isLoggingIn: staffAuthMock.isLoggingIn, - loginError: staffAuthMock.loginError, - login: staffAuthMock.login, - logout: staffAuthMock.logout, - }), - } -} diff --git a/apps/admin-ui/tests/screens/banners-create.test.tsx b/apps/admin-ui/tests/screens/banners-create.test.tsx deleted file mode 100644 index ce9a7eb..0000000 --- a/apps/admin-ui/tests/screens/banners-create.test.tsx +++ /dev/null @@ -1,214 +0,0 @@ -/** - * Create banner screen (app/(drawer)/dashboard/dashboard-banners/create.tsx) — - * BannerForm wiring, image requirement, upload + createBanner mutation, - * validation, cancel and success navigation. - * - * The common-ui ImageUploader add button lives behind a separate - * `@expo/vector-icons` copy, so instead of pressing it we intercept - * common-ui's usePickImage hook (test-local module mock) and invoke a pick. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -const mockPickState: { trigger: (() => Promise) | null } = { trigger: null } - -jest.mock('common-ui/src/components/use-pick-image', () => ({ - __esModule: true, - default: ({ setFile }: { setFile: (asset: unknown) => Promise }) => { - mockPickState.trigger = () => - setFile({ - uri: 'file:///tmp/pick.jpg', - fileName: 'pick.jpg', - mimeType: 'image/jpeg', - }) - return () => {} - }, -})) - -import React from 'react' -import { Alert } from 'react-native' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' - -import CreateBanner from '@/app/(drawer)/dashboard/dashboard-banners/create' -import { setupApiMocks } from '../mocks/api' -import { - expectProcedureCalled, - lastProcedureInput, - procCount, -} from '../mocks/procedures' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { routerMock, searchParamsMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const pressLastAlertButton = (label: string) => { - const calls = (Alert.alert as jest.Mock).mock.calls - const call = calls[calls.length - 1] - const buttons = (call?.[2] ?? []) as { text: string; onPress?: () => void }[] - act(() => buttons.find((b) => b.text === label)?.onPress?.()) -} - -// "Create Banner" appears as both the header title and the submit button. -const pressSubmit = () => { - const labels = screen.getAllByText('Create Banner') - fireEvent.press(labels[labels.length - 1]) -} - -const blur = (placeholder: string, name: string) => { - fireEvent(screen.getByPlaceholderText(placeholder), 'blur', { - target: { name }, - persist: () => {}, - }) -} - -const pickImage = async () => { - await act(async () => { - await mockPickState.trigger?.() - }) - await screen.findByText('Only one image allowed') -} - -/** The app GETs the picked file:// asset; the harness fetch only knows tRPC. */ -const installAssetFetchShim = (fetchMock: jest.Mock) => { - ;(global as unknown as { fetch: unknown }).fetch = jest.fn((url: string, opts: unknown) => { - if (String(url).startsWith('file:')) { - return Promise.resolve({ ok: true, blob: async () => ({}) }) - } - return fetchMock(url, opts) - }) -} - -const uploadProcedures = { - 'common.generateUploadUrls': { - uploadUrls: ['https://cdn.example.com/product-images/pic.jpg'], - }, -} - -describe('Create banner', () => { - beforeEach(() => { - resetStaffAuthMock() - searchParamsMock.current = {} - mockPickState.trigger = null - routerMock.back.mockClear() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('renders the create form', () => { - setupApiMocks() - renderWithProviders() - - expect(screen.getAllByText('Create Banner').length).toBeGreaterThan(1) - expect(screen.getByPlaceholderText('Enter banner name')).toBeVisible() - expect(screen.getByPlaceholderText('Enter banner description (optional)')).toBeVisible() - expect(screen.getByPlaceholderText('https://example.com/redirect')).toBeVisible() - }) - - it('shows the name validation error on blur', async () => { - setupApiMocks() - renderWithProviders() - - blur('Enter banner name', 'name') - - expect(await screen.findByText('Banner name is required')).toBeVisible() - }) - - it('rejects a malformed redirect URL', async () => { - setupApiMocks() - renderWithProviders() - - fireEvent.changeText(screen.getByPlaceholderText('https://example.com/redirect'), 'not-a-url') - blur('https://example.com/redirect', 'redirectUrl') - - expect(await screen.findByText('Please enter a valid URL')).toBeVisible() - }) - - it('does not create a banner without an image', async () => { - const { fetchMock } = setupApiMocks() - renderWithProviders() - - fireEvent.changeText(screen.getByPlaceholderText('Enter banner name'), 'My Banner') - pressSubmit() - - await waitFor(() => expect(Alert.alert).toHaveBeenCalledWith('Error', 'Image is required')) - expect(procCount(fetchMock, 'admin.banner.createBanner')).toBe(0) - }) - - it('uploads the image and creates the banner', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { - ...uploadProcedures, - 'admin.banner.createBanner': { id: 1, name: 'My Banner' }, - }, - }) - installAssetFetchShim(fetchMock as unknown as jest.Mock) - renderWithProviders() - - fireEvent.changeText(screen.getByPlaceholderText('Enter banner name'), 'My Banner') - await pickImage() - pressSubmit() - - await waitFor(() => expectProcedureCalled(fetchMock, 'admin.banner.createBanner')) - expect(lastProcedureInput(fetchMock, 'admin.banner.createBanner')).toMatchObject({ - name: 'My Banner', - imageUrl: 'https://cdn.example.com/product-images/pic.jpg', - skuIds: [], - }) - }) - - it('alerts and navigates back on successful creation', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { - ...uploadProcedures, - 'admin.banner.createBanner': { id: 1 }, - }, - }) - installAssetFetchShim(fetchMock as unknown as jest.Mock) - renderWithProviders() - - fireEvent.changeText(screen.getByPlaceholderText('Enter banner name'), 'My Banner') - await pickImage() - pressSubmit() - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith( - 'Success', - 'Banner created successfully', - expect.any(Array) - ) - ) - pressLastAlertButton('OK') - expect(routerMock.back).toHaveBeenCalled() - }) - - it('alerts an error when createBanner fails', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { - ...uploadProcedures, - 'admin.banner.createBanner': () => { - throw new Error('nope') - }, - }, - }) - installAssetFetchShim(fetchMock as unknown as jest.Mock) - renderWithProviders() - - fireEvent.changeText(screen.getByPlaceholderText('Enter banner name'), 'My Banner') - await pickImage() - pressSubmit() - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith( - 'Error', - 'Failed to create banner. Please try again.' - ) - ) - }) - - it('cancels and navigates back', () => { - setupApiMocks() - renderWithProviders() - - fireEvent.press(screen.getByText('Cancel')) - - expect(routerMock.back).toHaveBeenCalled() - }) -}) diff --git a/apps/admin-ui/tests/screens/banners-edit.test.tsx b/apps/admin-ui/tests/screens/banners-edit.test.tsx deleted file mode 100644 index 6b83bcf..0000000 --- a/apps/admin-ui/tests/screens/banners-edit.test.tsx +++ /dev/null @@ -1,215 +0,0 @@ -/** - * Edit banner screen (app/(drawer)/dashboard/dashboard-banners/edit/[id].tsx) — - * getBanner hydration, updateBanner mutation, validation and navigation. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' - -import EditBanner from '@/app/(drawer)/dashboard/dashboard-banners/edit/[id]' -import { setupApiMocks } from '../mocks/api' -import { - expectProcedureCalled, - lastProcedureInput, - procCount, -} from '../mocks/procedures' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { routerMock, searchParamsMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const banner = { - id: 7, - name: 'Banner Seven', - imageUrl: 'https://cdn.example.com/seven.jpg', - description: 'Seven desc', - skuIds: [], - redirectUrl: null, - serialNum: 1, - isActive: true, - createdAt: '2024-01-01T00:00:00.000Z', - lastUpdated: '2024-01-01T00:00:00.000Z', -} - -const pressLastAlertButton = (label: string) => { - const calls = (Alert.alert as jest.Mock).mock.calls - const call = calls[calls.length - 1] - const buttons = (call?.[2] ?? []) as { text: string; onPress?: () => void }[] - act(() => buttons.find((b) => b.text === label)?.onPress?.()) -} - -describe('Edit banner', () => { - beforeEach(() => { - resetStaffAuthMock() - searchParamsMock.current = { id: '7' } - routerMock.back.mockClear() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('requests the banner by the route id', async () => { - const { fetchMock } = setupApiMocks({ procedures: { 'admin.banner.getBanner': banner } }) - renderWithProviders() - - await waitFor(() => expectProcedureCalled(fetchMock, 'admin.banner.getBanner')) - expect(lastProcedureInput(fetchMock, 'admin.banner.getBanner')).toEqual({ id: 7 }) - }) - - it('hydrates the form from the fetched banner', async () => { - setupApiMocks({ procedures: { 'admin.banner.getBanner': banner } }) - renderWithProviders() - - expect(await screen.findByDisplayValue('Banner Seven')).toBeVisible() - expect(screen.getByDisplayValue('Seven desc')).toBeVisible() - }) - - it('renders the not-found state when the banner is missing', async () => { - setupApiMocks({ procedures: { 'admin.banner.getBanner': null } }) - renderWithProviders() - - expect(await screen.findByText('Banner not found')).toBeVisible() - }) - - it('updates the banner with the transformed payload', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { - 'admin.banner.getBanner': banner, - 'admin.banner.updateBanner': { ...banner, name: 'Renamed Banner' }, - }, - }) - renderWithProviders() - - await screen.findByDisplayValue('Banner Seven') - fireEvent.changeText(screen.getByDisplayValue('Banner Seven'), 'Renamed Banner') - fireEvent.press(screen.getByText('Update Banner')) - - await waitFor(() => expectProcedureCalled(fetchMock, 'admin.banner.updateBanner')) - expect(lastProcedureInput(fetchMock, 'admin.banner.updateBanner')).toMatchObject({ - id: 7, - name: 'Renamed Banner', - imageUrl: 'https://cdn.example.com/seven.jpg', - description: 'Seven desc', - skuIds: [], - }) - }) - - it('refreshes the banner list and refetches the mounted banner after a successful update', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { - 'admin.banner.getBanner': banner, - 'admin.banner.updateBanner': { ...banner, name: 'Renamed Banner' }, - 'admin.banner.getBanners': [banner], - }, - }) - renderWithProviders() - - await screen.findByDisplayValue('Banner Seven') - await waitFor(() => expectProcedureCalled(fetchMock, 'admin.banner.getBanner')) - - // Baselines: hydration has already pulled getBanner once, while getBanners - // is `enabled: false` — nothing fetches it until the screen calls refetch(). - const getBannerBefore = procCount(fetchMock, 'admin.banner.getBanner') - const getBannersBefore = procCount(fetchMock, 'admin.banner.getBanners') - expect(getBannerBefore).toBeGreaterThan(0) - - fireEvent.changeText(screen.getByDisplayValue('Banner Seven'), 'Renamed Banner') - fireEvent.press(screen.getByText('Update Banner')) - - await waitFor(() => expectProcedureCalled(fetchMock, 'admin.banner.updateBanner')) - - // `await refetchBanners()` — the explicit pull of the list query. - await waitFor(() => - expect(procCount(fetchMock, 'admin.banner.getBanners')).toBeGreaterThan( - getBannersBefore - ) - ) - expect(procCount(fetchMock, 'admin.banner.getBanners')).toBeGreaterThan(0) - - // `utils.admin.banner.getBanner.invalidate()` refetches the mounted query. - await waitFor(() => - expect(procCount(fetchMock, 'admin.banner.getBanner')).toBeGreaterThan( - getBannerBefore - ) - ) - }) - - it('does not update before the banner loads', () => { - const { fetchMock } = setupApiMocks({ - procedures: { 'admin.banner.getBanner': () => new Promise(() => {}) }, - }) - renderWithProviders() - - expect(procCount(fetchMock, 'admin.banner.updateBanner')).toBe(0) - }) - - it('alerts when the update fails', async () => { - setupApiMocks({ - procedures: { - 'admin.banner.getBanner': banner, - 'admin.banner.updateBanner': () => { - throw new Error('nope') - }, - }, - }) - renderWithProviders() - - await screen.findByDisplayValue('Banner Seven') - fireEvent.changeText(screen.getByDisplayValue('Banner Seven'), 'Renamed Banner') - fireEvent.press(screen.getByText('Update Banner')) - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith( - 'Error', - 'Failed to update banner. Please try again.' - ) - ) - }) - - it('alerts success and navigates back after update', async () => { - setupApiMocks({ - procedures: { - 'admin.banner.getBanner': banner, - 'admin.banner.updateBanner': { ...banner, name: 'Renamed Banner' }, - }, - }) - renderWithProviders() - - await screen.findByDisplayValue('Banner Seven') - fireEvent.changeText(screen.getByDisplayValue('Banner Seven'), 'Renamed Banner') - fireEvent.press(screen.getByText('Update Banner')) - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith( - 'Success', - 'Banner updated successfully', - expect.any(Array) - ) - ) - - routerMock.back.mockClear() - pressLastAlertButton('OK') - expect(routerMock.back).toHaveBeenCalled() - }) - - it('BUG: alerts "Banner not found" and navigates back on mount before getBanner resolves', async () => { - setupApiMocks({ procedures: { 'admin.banner.getBanner': banner } }) - renderWithProviders() - - await screen.findByDisplayValue('Banner Seven') - - expect(Alert.alert).toHaveBeenCalledWith('Error', 'Banner not found') - expect(routerMock.back).toHaveBeenCalled() - }) - - it('cancels and navigates back', async () => { - setupApiMocks({ procedures: { 'admin.banner.getBanner': banner } }) - renderWithProviders() - - await screen.findByDisplayValue('Banner Seven') - routerMock.back.mockClear() - fireEvent.press(screen.getByText('Cancel')) - - expect(routerMock.back).toHaveBeenCalled() - }) -}) diff --git a/apps/admin-ui/tests/screens/banners-index.test.tsx b/apps/admin-ui/tests/screens/banners-index.test.tsx deleted file mode 100644 index 2c11859..0000000 --- a/apps/admin-ui/tests/screens/banners-index.test.tsx +++ /dev/null @@ -1,237 +0,0 @@ -/** - * Dashboard banners list (app/(drawer)/dashboard/dashboard-banners/index.tsx) — - * banner rows, slot assignment/edit mode, save/empty-slot mutations, delete and - * navigation to create/edit. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import MaterialIcons from '@expo/vector-icons/MaterialIcons' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' - -import DashboardBanners from '@/app/(drawer)/dashboard/dashboard-banners/index' -import { setupApiMocks } from '../mocks/api' -import { - expectProcedureCalled, - lastProcedureInput, - procCount, -} from '../mocks/procedures' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { routerMock, searchParamsMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const bannerOne = { - id: 1, - name: 'Banner One', - imageUrl: 'https://cdn.example.com/one.jpg', - description: 'First banner', - skuIds: [], - redirectUrl: null, - serialNum: 1, - isActive: true, - createdAt: '2024-01-01T00:00:00.000Z', - lastUpdated: '2024-01-01T00:00:00.000Z', -} - -const bannerTwo = { - ...bannerOne, - id: 2, - name: 'Banner Two', - imageUrl: 'https://cdn.example.com/two.jpg', - description: null, - serialNum: null, - isActive: false, -} - -const pressLastAlertButton = (label: string) => { - const calls = (Alert.alert as jest.Mock).mock.calls - const call = calls[calls.length - 1] - const buttons = (call?.[2] ?? []) as { text: string; onPress?: () => void }[] - act(() => buttons.find((b) => b.text === label)?.onPress?.()) -} - -const iconByName = (name: string) => { - const icons = screen.UNSAFE_getAllByType(MaterialIcons) - return icons.find((icon) => icon.props.name === name) as unknown as Parameters< - typeof fireEvent.press - >[0] -} - -describe('Dashboard banners index', () => { - beforeEach(() => { - resetStaffAuthMock() - searchParamsMock.current = {} - routerMock.push.mockClear() - routerMock.back.mockClear() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('shows a loading state while banners are pending', () => { - setupApiMocks({ procedures: { 'admin.banner.getBanners': { banners: [bannerOne] } } }) - renderWithProviders() - - expect(screen.getByText('Loading banners...')).toBeVisible() - }) - - it('renders banner rows and assigns slotted banners to their slot', async () => { - setupApiMocks({ - procedures: { 'admin.banner.getBanners': { banners: [bannerOne, bannerTwo] } }, - }) - renderWithProviders() - - expect(await screen.findByText('First banner')).toBeVisible() - expect(screen.getByText('Banner Two')).toBeVisible() - // banner one occupies slot 1 (label appears on both the tile and the row) - expect(screen.getAllByText('Slot 1').length).toBeGreaterThan(1) - }) - - it('renders the empty state when there are no banners', async () => { - setupApiMocks({ procedures: { 'admin.banner.getBanners': { banners: [] } } }) - renderWithProviders() - - expect(await screen.findByText('No Banners Yet')).toBeVisible() - }) - - it('renders the error state when the query fails', async () => { - setupApiMocks({ - procedures: { - 'admin.banner.getBanners': () => { - throw new Error('boom') - }, - }, - }) - renderWithProviders() - - expect(await screen.findByText('Error loading banners')).toBeVisible() - }) - - it('navigates to create from the floating action button', async () => { - setupApiMocks({ procedures: { 'admin.banner.getBanners': { banners: [bannerOne] } } }) - renderWithProviders() - await screen.findByText('First banner') - - fireEvent.press(screen.getByLabelText('Add new banner')) - - expect(routerMock.push).toHaveBeenCalledWith( - '/(drawer)/dashboard/dashboard-banners/create' - ) - }) - - it('navigates to edit for the pressed banner', async () => { - setupApiMocks({ procedures: { 'admin.banner.getBanners': { banners: [bannerOne] } } }) - renderWithProviders() - await screen.findByText('First banner') - - fireEvent.press(iconByName('edit')) - - expect(routerMock.push).toHaveBeenCalledWith( - '/(drawer)/dashboard/dashboard-banners/edit/1' - ) - }) - - it('saves a new slot assignment through updateBanner', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { - 'admin.banner.getBanners': { banners: [bannerOne, bannerTwo] }, - 'admin.banner.updateBanner': { ...bannerTwo, serialNum: 2 }, - }, - }) - renderWithProviders() - await screen.findByText('Banner Two') - - const fetchesBeforeSave = procCount(fetchMock, 'admin.banner.getBanners') - - fireEvent.press(screen.getByText('Slot 2')) - fireEvent.press(screen.getByText('Banner Two')) - fireEvent.press(screen.getByText('Save Changes')) - - await waitFor(() => expectProcedureCalled(fetchMock, 'admin.banner.updateBanner')) - expect(lastProcedureInput(fetchMock, 'admin.banner.updateBanner')).toEqual({ - id: 2, - serialNum: 2, - }) - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith('Success', 'Slot assignments saved successfully') - ) - // let the post-save refetch settle before the test unmounts - await waitFor(() => - expect(procCount(fetchMock, 'admin.banner.getBanners')).toBeGreaterThan(fetchesBeforeSave) - ) - }) - - it('empties an occupied slot through updateBanner with serialNum null', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { - 'admin.banner.getBanners': { banners: [bannerOne, bannerTwo] }, - 'admin.banner.updateBanner': { ...bannerOne, serialNum: null }, - }, - }) - renderWithProviders() - await screen.findByText('First banner') - - const fetchesBeforeEmptySlot = procCount(fetchMock, 'admin.banner.getBanners') - - fireEvent.press(screen.getAllByText('Slot 1')[0]) - fireEvent.press(screen.getByText('Empty Slot')) - - await waitFor(() => expectProcedureCalled(fetchMock, 'admin.banner.updateBanner')) - expect(lastProcedureInput(fetchMock, 'admin.banner.updateBanner')).toEqual({ - id: 1, - serialNum: null, - }) - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith('Success', 'Slot 1 has been emptied') - ) - // let the post-empty-slot refetch settle before the test unmounts - await waitFor(() => - expect(procCount(fetchMock, 'admin.banner.getBanners')).toBeGreaterThan( - fetchesBeforeEmptySlot - ) - ) - }) - - it('cancels slot editing and restores assignments', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { 'admin.banner.getBanners': { banners: [bannerOne, bannerTwo] } }, - }) - renderWithProviders() - await screen.findByText('Banner Two') - - fireEvent.press(screen.getByText('Slot 2')) - fireEvent.press(screen.getByText('Banner Two')) - fireEvent.press(screen.getByText('Cancel')) - - expect(screen.queryByText('Save Changes')).toBeNull() - expect(procCount(fetchMock, 'admin.banner.updateBanner')).toBe(0) - }) - - it('deletes a banner after confirming the alert', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { - 'admin.banner.getBanners': { banners: [bannerOne] }, - 'admin.banner.deleteBanner': { success: true }, - }, - }) - renderWithProviders() - await screen.findByText('First banner') - - fireEvent.press(iconByName('delete')) - - expect(Alert.alert).toHaveBeenCalledWith( - 'Delete Banner', - 'Are you sure you want to delete this banner?', - expect.any(Array) - ) - pressLastAlertButton('Delete') - - await waitFor(() => expectProcedureCalled(fetchMock, 'admin.banner.deleteBanner')) - expect(lastProcedureInput(fetchMock, 'admin.banner.deleteBanner')).toEqual({ id: 1 }) - await waitFor(() => expect(Alert.alert).toHaveBeenCalledWith('Success', 'Banner deleted')) - // let the post-delete refetch settle before the test unmounts - await waitFor(() => - expect(procCount(fetchMock, 'admin.banner.getBanners')).toBeGreaterThan(1) - ) - }) -}) diff --git a/apps/admin-ui/tests/screens/complaints-index.test.tsx b/apps/admin-ui/tests/screens/complaints-index.test.tsx deleted file mode 100644 index da15834..0000000 --- a/apps/admin-ui/tests/screens/complaints-index.test.tsx +++ /dev/null @@ -1,250 +0,0 @@ -/** - * Complaints list (app/(drawer)/dashboard/complaints/index.tsx) — infinite list, - * rows, empty/error/loading, resolve mutation and navigation. - * - * HARNESS BUG WORKAROUND: tests/mocks/native.ts has a stray top-level `return` - * (line 89 → "'return' outside of function"), so any module that pulls in - * `common-ui` (which eagerly imports expo-image/picker/document-picker) fails to - * parse. The harness file is untouched; the three expo modules are re-mocked - * locally below with equivalent, self-contained fakes. See the final report. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -jest.mock('expo-image', () => { - const React = require('react') - const { View } = require('react-native') - const Image = (props: Record) => - React.createElement(View, { testID: 'mock-image', ...props }) - return { __esModule: true, Image, default: Image } -}) - -jest.mock('expo-image-picker', () => { - const asset = { uri: 'file:///tmp/pick.jpg', fileName: 'pick.jpg', mimeType: 'image/jpeg' } - return { - __esModule: true, - MediaTypeOptions: { Images: 'Images', All: 'All', Videos: 'Videos' }, - launchImageLibraryAsync: jest.fn(async () => ({ canceled: false, assets: [asset] })), - launchCameraAsync: jest.fn(async () => ({ canceled: false, assets: [asset] })), - requestMediaLibraryPermissionsAsync: jest.fn(async () => ({ granted: true, status: 'granted' })), - requestCameraPermissionsAsync: jest.fn(async () => ({ granted: true, status: 'granted' })), - } -}) - -jest.mock('expo-document-picker', () => ({ - __esModule: true, - getDocumentAsync: jest.fn(async () => ({ - canceled: false, - assets: [{ uri: 'file:///tmp/doc.pdf', name: 'doc.pdf', mimeType: 'application/pdf' }], - })), -})) - -import React from 'react' -import { Alert, FlatList } from 'react-native' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' - -import Complaints from '@/app/(drawer)/dashboard/complaints/index' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { - expectProcedureCalled, - lastProcedureInput, - procCount, -} from '../mocks/procedures' -import { resetRouterMock, routerMock, searchParamsMock } from '../mocks/router' -import { resetRefreshHooks } from '../mocks/refresh' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { renderWithProviders } from '../helpers/render' - -const pendingComplaint = { - id: 5, - text: 'Missing item in order', - userId: 3, - userName: 'Alice', - userMobile: '9999999999', - orderId: 7, - status: 'pending', - createdAt: '2026-01-01T10:00:00.000Z', - images: ['https://assets.test/c/1.png'], - response: null, -} - -const resolvedComplaint = { - ...pendingComplaint, - id: 6, - text: 'Late delivery', - status: 'resolved', - response: 'We have refunded the amount', - images: [], -} - -const page = (complaints: unknown[], nextCursor?: number) => ({ complaints, nextCursor }) - -describe('Complaints list', () => { - beforeEach(async () => { - resetStaffAuthMock() - resetRefreshHooks() - await resetStorage() - resetRouterMock() - searchParamsMock.current = {} - setupApiMocks() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('shows a loading state while the list query is pending', () => { - setupApiMocks({ - procedures: { 'admin.complaint.getAll': () => new Promise(() => {}) }, - }) - renderWithProviders() - - expect(screen.getByText('Loading complaints...')).toBeVisible() - }) - - it('renders each complaint with status, reply and linked user/order', async () => { - setupApiMocks({ - procedures: { - 'admin.complaint.getAll': page([pendingComplaint, resolvedComplaint]), - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Complaint #5')).toBeVisible()) - expect(screen.getByText('Complaint #6')).toBeVisible() - expect(screen.getByText('Missing item in order')).toBeVisible() - expect(screen.getByText('Pending')).toBeVisible() - expect(screen.getByText('Resolved')).toBeVisible() - expect(screen.getByText('We have refunded the amount')).toBeVisible() - expect(screen.getAllByText('Alice').length).toBeGreaterThan(0) - expect(screen.getAllByText('Order #7').length).toBeGreaterThan(0) - }) - - it('only offers Resolve on pending complaints', async () => { - setupApiMocks({ - procedures: { - 'admin.complaint.getAll': page([pendingComplaint, resolvedComplaint]), - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Complaint #5')).toBeVisible()) - expect(screen.getAllByText('Resolve Complaint')).toHaveLength(1) - }) - - it('shows the empty state when there are no complaints', async () => { - setupApiMocks({ procedures: { 'admin.complaint.getAll': page([]) } }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('No complaints')).toBeVisible()) - expect(screen.getByText('All complaints will appear here')).toBeVisible() - }) - - it('shows the error state and refetches on Retry', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.complaint.getAll': () => { - throw new Error('boom') - }, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Error')).toBeVisible()) - - const before = procCount(api.fetchMock, 'admin.complaint.getAll') - fireEvent.press(screen.getByText('Retry')) - - await waitFor(() => - expect(procCount(api.fetchMock, 'admin.complaint.getAll')).toBeGreaterThan(before) - ) - }) - - it('resolves a complaint with the admin response and refetches', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.complaint.getAll': page([pendingComplaint]), - 'admin.complaint.resolve': { message: 'Complaint resolved successfully' }, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Complaint #5')).toBeVisible()) - const before = procCount(api.fetchMock, 'admin.complaint.getAll') - - fireEvent.press(screen.getByText('Resolve Complaint')) - fireEvent.changeText( - await screen.findByPlaceholderText('Add a comment...'), - 'Refund issued' - ) - fireEvent.press(screen.getByText('Resolve')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'admin.complaint.resolve')) - expect(lastProcedureInput(api.fetchMock, 'admin.complaint.resolve')).toEqual({ - id: '5', - response: 'Refund issued', - }) - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith('Success', 'Complaint marked as resolved') - ) - await waitFor(() => - expect(procCount(api.fetchMock, 'admin.complaint.getAll')).toBeGreaterThan(before) - ) - }) - - it('sends an empty response when the admin confirms without a note', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.complaint.getAll': page([pendingComplaint]), - 'admin.complaint.resolve': { message: 'ok' }, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Complaint #5')).toBeVisible()) - fireEvent.press(screen.getByText('Resolve Complaint')) - fireEvent.press(await screen.findByText('Resolve')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'admin.complaint.resolve')) - expect(lastProcedureInput(api.fetchMock, 'admin.complaint.resolve')).toEqual({ - id: '5', - response: '', - }) - }) - - it('navigates to the user and the order from a complaint row', async () => { - setupApiMocks({ - procedures: { 'admin.complaint.getAll': page([pendingComplaint]) }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Complaint #5')).toBeVisible()) - - fireEvent.press(screen.getByText('Alice')) - expect(routerMock.push).toHaveBeenCalledWith('/(drawer)/dashboard/user-management/3') - - fireEvent.press(screen.getByText('Order #7')) - expect(routerMock.push).toHaveBeenCalledWith( - '/(drawer)/dashboard/manage-orders/order-details/7' - ) - }) - - it('fetches the next page when the list end is reached', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.complaint.getAll': (input: { cursor?: number }) => - input?.cursor - ? page([{ ...pendingComplaint, id: 9, text: 'Second page' }]) - : page([pendingComplaint], 100), - }, - }) - renderWithProviders() - - await screen.findByText('Complaint #5') - const list = screen.UNSAFE_getByType(FlatList as never) - act(() => list.props.onEndReached()) - - expect(await screen.findByText('Second page')).toBeVisible() - expect(lastProcedureInput(api.fetchMock, 'admin.complaint.getAll')).toMatchObject({ - limit: 20, - cursor: 100, - }) - }) -}) diff --git a/apps/admin-ui/tests/screens/coupons-create.test.tsx b/apps/admin-ui/tests/screens/coupons-create.test.tsx deleted file mode 100644 index d885e23..0000000 --- a/apps/admin-ui/tests/screens/coupons-create.test.tsx +++ /dev/null @@ -1,199 +0,0 @@ -/** - * Create coupon screen (app/(drawer)/dashboard/coupons/create.tsx) — CouponForm - * wiring, payload shaping (targetUsers->targetUser, flat->maxValue) and the - * create / createReservedCoupon mutations. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' - -import CreateCoupon from '@/app/(drawer)/dashboard/coupons/create' -import { setupApiMocks } from '../mocks/api' -import { - expectProcedureCalled, - lastProcedureInput, - procCount, -} from '../mocks/procedures' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { routerMock, searchParamsMock } from '../mocks/router' -import { createQueryClient, renderWithProviders } from '../helpers/render' - -const pressLastAlertButton = (label: string) => { - const calls = (Alert.alert as jest.Mock).mock.calls - const call = calls[calls.length - 1] - const buttons = (call?.[2] ?? []) as { text: string; onPress?: () => void }[] - act(() => buttons.find((b) => b.text === label)?.onPress?.()) -} - -const fillPercentageCoupon = (code = 'save10', percent = '10') => { - fireEvent.changeText(screen.getByPlaceholderText('e.g., SECRET10'), code) - fireEvent.press(screen.getByText('Percentage')) - fireEvent.changeText(screen.getByPlaceholderText('e.g., 10'), percent) -} - -describe('Create coupon', () => { - beforeEach(() => { - resetStaffAuthMock() - searchParamsMock.current = {} - routerMock.back.mockClear() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('renders the coupon form', () => { - setupApiMocks() - renderWithProviders() - - expect(screen.getByText('Coupon Codes')).toBeVisible() - expect(screen.getByText('Discount Type *')).toBeVisible() - expect(screen.getByText('Create Coupon')).toBeVisible() - }) - - it('does not submit when the form is invalid', async () => { - const { fetchMock } = setupApiMocks() - renderWithProviders() - - fireEvent.press(screen.getByText('Create Coupon')) - - await waitFor(() => expect(screen.getByText('Code 1')).toBeVisible()) - expect(procCount(fetchMock, 'admin.coupon.create')).toBe(0) - expect(procCount(fetchMock, 'admin.coupon.createReservedCoupon')).toBe(0) - }) - - it('uppercases the coupon code as it is typed', () => { - setupApiMocks() - renderWithProviders() - - fireEvent.changeText(screen.getByPlaceholderText('e.g., SECRET10'), 'save10') - - expect(screen.getByDisplayValue('SAVE10')).toBeVisible() - }) - - it('creates a percentage coupon with the expected payload', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { 'admin.coupon.create': [{ id: 1, couponCode: 'SAVE10' }] }, - }) - renderWithProviders() - - fillPercentageCoupon() - fireEvent.press(screen.getByText('Create Coupon')) - - await waitFor(() => expectProcedureCalled(fetchMock, 'admin.coupon.create')) - expect(lastProcedureInput(fetchMock, 'admin.coupon.create')).toMatchObject({ - couponCodes: ['SAVE10'], - discountPercent: 10, - isUserBased: false, - isApplyForAll: false, - exclusiveApply: false, - isFirstOrderOnly: false, - }) - expect(procCount(fetchMock, 'admin.coupon.createReservedCoupon')).toBe(0) - }) - - it('invalidates both coupon list queries by path after a create', async () => { - setupApiMocks({ - procedures: { 'admin.coupon.create': [{ id: 1, couponCode: 'SAVE10' }] }, - }) - // The list queries behind this form are not mounted here, so a fetch-count - // assertion cannot see the refresh. Spy on the injected query client - // instead; jest.spyOn keeps calling through, so invalidation still happens. - const client = createQueryClient() - const invalidateSpy = jest.spyOn(client, 'invalidateQueries') - renderWithProviders(, { queryClient: client }) - - fillPercentageCoupon() - fireEvent.press(screen.getByText('Create Coupon')) - - await waitFor(() => expect(invalidateSpy).toHaveBeenCalled()) - - // tRPC keys are [pathArray, ...]; assert the ARRAY path was used, so a - // differently-filtered list (any search term) still matches the refresh. - const paths = invalidateSpy.mock.calls.map((call) => { - const key = (call[0] as { queryKey?: unknown[] } | undefined)?.queryKey - return Array.isArray(key) ? key[0] : null - }) - expect(paths).toContainEqual(['admin', 'coupon', 'getAll']) - expect(paths).toContainEqual(['admin', 'coupon', 'getReservedCoupons']) - }) - - it('creates a flat-discount coupon and mirrors it into maxValue', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { 'admin.coupon.create': [{ id: 1 }] }, - }) - renderWithProviders() - - fireEvent.changeText(screen.getByPlaceholderText('e.g., SECRET10'), 'flat50') - fireEvent.press(screen.getByText('Flat Amount')) - fireEvent.changeText(screen.getByPlaceholderText('e.g., 50'), '50') - fireEvent.press(screen.getByText('Create Coupon')) - - await waitFor(() => expectProcedureCalled(fetchMock, 'admin.coupon.create')) - const input = lastProcedureInput(fetchMock, 'admin.coupon.create') as Record - expect(input).toMatchObject({ couponCodes: ['FLAT50'], flatDiscount: 50, maxValue: 50 }) - expect(input.discountPercent).toBeUndefined() - }) - - it('creates a reserved coupon when the checkbox is set', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { 'admin.coupon.createReservedCoupon': [{ id: 1 }] }, - }) - renderWithProviders() - - fillPercentageCoupon('secret20', '20') - fireEvent.press(screen.getByRole('checkbox')) - fireEvent.press(screen.getByText('Create Coupon')) - - await waitFor(() => - expectProcedureCalled(fetchMock, 'admin.coupon.createReservedCoupon') - ) - expect(lastProcedureInput(fetchMock, 'admin.coupon.createReservedCoupon')).toMatchObject({ - couponCodes: ['SECRET20'], - discountPercent: 20, - }) - expect(procCount(fetchMock, 'admin.coupon.create')).toBe(0) - }) - - it('alerts success and navigates back when the form is confirmed', async () => { - setupApiMocks({ - procedures: { 'admin.coupon.create': [{ id: 1 }] }, - }) - renderWithProviders() - - fillPercentageCoupon() - fireEvent.press(screen.getByText('Create Coupon')) - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith( - 'Success', - '1 coupon created successfully', - expect.any(Array) - ) - ) - - pressLastAlertButton('OK') - expect(routerMock.back).toHaveBeenCalled() - }) - - it('alerts the mutation error message', async () => { - setupApiMocks({ - procedures: { - 'admin.coupon.create': () => { - throw new Error('Coupon code already exists: SAVE10') - }, - }, - }) - renderWithProviders() - - fillPercentageCoupon() - fireEvent.press(screen.getByText('Create Coupon')) - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith( - 'Error', - 'Coupon code already exists: SAVE10' - ) - ) - }) -}) diff --git a/apps/admin-ui/tests/screens/coupons-edit.test.tsx b/apps/admin-ui/tests/screens/coupons-edit.test.tsx deleted file mode 100644 index ee72635..0000000 --- a/apps/admin-ui/tests/screens/coupons-edit.test.tsx +++ /dev/null @@ -1,217 +0,0 @@ -/** - * Edit coupon screen (app/(drawer)/dashboard/coupons/edit/[id].tsx) — hydrates - * CouponForm from getById and dispatches the update mutation. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' - -import EditCoupon from '@/app/(drawer)/dashboard/coupons/edit/[id]' -import { setupApiMocks } from '../mocks/api' -import { - expectProcedureCalled, - lastProcedureInput, - procCount, -} from '../mocks/procedures' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { routerMock, searchParamsMock } from '../mocks/router' -import { createQueryClient, renderWithProviders } from '../helpers/render' - -const coupon = { - id: 5, - couponCode: 'EDIT10', - isUserBased: false, - discountPercent: '10', - flatDiscount: null, - minOrder: '100', - skuIds: [], - maxValue: '50', - isApplyForAll: true, - validTill: '2099-01-01T00:00:00.000Z', - maxLimitForUser: 2, - exclusiveApply: false, - isFirstOrderOnly: false, - isInvalidated: false, - createdBy: 1, - targetUser: { id: 3, name: 'shafi', mobile: '9999999999' }, - applicableUsers: [], -} - -const pressLastAlertButton = (label: string) => { - const calls = (Alert.alert as jest.Mock).mock.calls - const call = calls[calls.length - 1] - const buttons = (call?.[2] ?? []) as { text: string; onPress?: () => void }[] - act(() => buttons.find((b) => b.text === label)?.onPress?.()) -} - -describe('Edit coupon', () => { - beforeEach(() => { - resetStaffAuthMock() - searchParamsMock.current = { id: '5' } - routerMock.back.mockClear() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('shows loading while getById is pending', () => { - setupApiMocks({ procedures: { 'admin.coupon.getById': coupon } }) - renderWithProviders() - - expect(screen.getByText('Loading...')).toBeVisible() - }) - - it('requests the coupon by the route id', async () => { - const { fetchMock } = setupApiMocks({ procedures: { 'admin.coupon.getById': coupon } }) - renderWithProviders() - - await waitFor(() => expectProcedureCalled(fetchMock, 'admin.coupon.getById')) - expect(lastProcedureInput(fetchMock, 'admin.coupon.getById')).toEqual({ id: 5 }) - }) - - it('prefills the form from the fetched coupon', async () => { - setupApiMocks({ procedures: { 'admin.coupon.getById': coupon } }) - renderWithProviders() - - expect(await screen.findByDisplayValue('EDIT10')).toBeVisible() - expect(screen.getByDisplayValue('10')).toBeVisible() - expect(screen.getByDisplayValue('100')).toBeVisible() - }) - - it('shows a not-found state when the coupon does not exist', async () => { - setupApiMocks({ procedures: { 'admin.coupon.getById': null } }) - renderWithProviders() - - expect(await screen.findByText('Coupon not found')).toBeVisible() - }) - - it('dispatches update with the transformed payload', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { - 'admin.coupon.getById': coupon, - 'admin.coupon.update': { ...coupon }, - }, - }) - renderWithProviders() - - await screen.findByDisplayValue('EDIT10') - fireEvent.press(screen.getByText('Create Coupon')) - - await waitFor(() => expectProcedureCalled(fetchMock, 'admin.coupon.update')) - const input = lastProcedureInput(fetchMock, 'admin.coupon.update') as { - id: number - updates: Record - } - expect(input.id).toBe(5) - expect(input.updates).toMatchObject({ - couponCodes: ['EDIT10'], - discountPercent: 10, - minOrder: 100, - maxValue: 50, - isApplyForAll: true, - isUserBased: false, - targetUser: 3, - isReservedCoupon: false, - }) - expect(input.updates.targetUsers).toBeUndefined() - }) - - it('does not call update before the coupon loads', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { - 'admin.coupon.getById': () => new Promise(() => {}), - }, - }) - renderWithProviders() - - expect(procCount(fetchMock, 'admin.coupon.update')).toBe(0) - }) - - it('alerts the update error message', async () => { - setupApiMocks({ - procedures: { - 'admin.coupon.getById': coupon, - 'admin.coupon.update': () => { - throw new Error('Cannot have both discountPercent and flatDiscount') - }, - }, - }) - renderWithProviders() - - await screen.findByDisplayValue('EDIT10') - fireEvent.press(screen.getByText('Create Coupon')) - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith( - 'Error', - 'Cannot have both discountPercent and flatDiscount' - ) - ) - }) - - it('alerts success and navigates back after update', async () => { - setupApiMocks({ - procedures: { - 'admin.coupon.getById': coupon, - 'admin.coupon.update': { ...coupon }, - }, - }) - renderWithProviders() - - await screen.findByDisplayValue('EDIT10') - fireEvent.press(screen.getByText('Create Coupon')) - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith( - 'Success', - 'Coupon updated successfully', - expect.any(Array) - ) - ) - - pressLastAlertButton('OK') - expect(routerMock.back).toHaveBeenCalled() - }) - - it('refetches the mounted coupon and invalidates both coupon lists by path after update', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { - 'admin.coupon.getById': coupon, - 'admin.coupon.update': { ...coupon }, - }, - }) - - const client = createQueryClient() - const invalidateSpy = jest.spyOn(client, 'invalidateQueries') - renderWithProviders(, { queryClient: client }) - - await screen.findByDisplayValue('EDIT10') - - // These suites share a module-singleton tRPC client, so baseline the count - // right before the interaction and assert a delta, never an absolute number. - const before = procCount(fetchMock, 'admin.coupon.getById') - fireEvent.press(screen.getByText('Create Coupon')) - - // (a) the mounted getById query really refetches. - await waitFor(() => - expect(procCount(fetchMock, 'admin.coupon.getById')).toBeGreaterThan(before) - ) - - // (b) the two list invalidations used the ARRAY path, not a dotted string. - const invalidatedPaths = () => - invalidateSpy.mock.calls.map((call) => { - const key = (call[0] as { queryKey?: unknown[] } | undefined)?.queryKey - return Array.isArray(key) ? key[0] : null - }) - - await waitFor(() => - expect(invalidatedPaths()).toContainEqual(['admin', 'coupon', 'getAll']) - ) - expect(invalidatedPaths()).toContainEqual([ - 'admin', - 'coupon', - 'getReservedCoupons', - ]) - }) -}) diff --git a/apps/admin-ui/tests/screens/coupons-index.test.tsx b/apps/admin-ui/tests/screens/coupons-index.test.tsx deleted file mode 100644 index 682508e..0000000 --- a/apps/admin-ui/tests/screens/coupons-index.test.tsx +++ /dev/null @@ -1,289 +0,0 @@ -/** - * Coupons list screen (app/(drawer)/dashboard/coupons/index.tsx) — the two - * TabView tabs (General / Reserved), infinite pagination, search, delete and - * navigation to create/edit. - * - * HARNESS BUG WORKAROUND: tests/mocks/native.ts `tabViewMock` is internally - * inconsistent — its `SceneMap` returns the scenes object while `TabView` - * invokes `renderScene({ route })` as a function, so rendering this screen - * throws `TypeError: renderScene is not a function`. Its tab press also - * hardcodes `onIndexChange(0)`. We override the module locally with a corrected - * copy (the harness file itself is untouched). See the final report. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -jest.mock('react-native-tab-view', () => { - const React = require('react') - const { View, Text } = require('react-native') - - const TabView = ({ - navigationState, - renderScene, - onIndexChange, - }: { - navigationState: { index: number; routes: { key: string }[] } - renderScene: (info: { route: { key: string } }) => React.ReactNode - onIndexChange?: (index: number) => void - }) => { - const route = navigationState.routes[navigationState.index] - return React.createElement( - View, - { testID: 'mock-tab-view' }, - navigationState.routes.map((r, i) => - React.createElement( - Text, - { key: r.key, testID: `tab-${r.key}`, onPress: () => onIndexChange?.(i) }, - r.key - ) - ), - route ? renderScene({ route }) : null - ) - } - - return { - __esModule: true, - TabView, - SceneMap: (scenes: Record) => ({ route }: { route: { key: string } }) => { - const Scene = scenes[route.key] - return React.createElement(Scene) - }, - TabBar: () => null, - } -}) - -import React from 'react' -import { Alert, FlatList } from 'react-native' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' - -import Coupons from '@/app/(drawer)/dashboard/coupons/index' -import { setupApiMocks } from '../mocks/api' -import { lastProcedureInput, expectProcedureCalled, procCount } from '../mocks/procedures' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { searchParamsMock, routerMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const activeCoupon = { - id: 1, - couponCode: 'SAVE10', - isUserBased: false, - discountPercent: '10', - flatDiscount: null, - minOrder: null, - skuIds: null, - maxValue: null, - isApplyForAll: true, - validTill: '2099-01-01T00:00:00.000Z', - maxLimitForUser: null, - exclusiveApply: false, - isFirstOrderOnly: false, - isInvalidated: false, - createdBy: 1, - applicableUsers: [], -} - -const expiredCoupon = { - ...activeCoupon, - id: 2, - couponCode: 'OLDCODE', - flatDiscount: '50', - discountPercent: null, - validTill: '2000-01-01T00:00:00.000Z', -} - -const reservedCoupon = { - id: 9, - secretCode: 'SECRET9', - couponCode: 'SECRET9', - discountPercent: '20', - flatDiscount: null, - minOrder: null, - maxValue: null, - validTill: '2099-01-01T00:00:00.000Z', - isRedeemed: false, - redeemedUser: null, - redeemedAt: null, - creator: { id: 1, name: 'shafi' }, -} - -const pressLastAlertButton = (label: string) => { - const calls = (Alert.alert as jest.Mock).mock.calls - const call = calls[calls.length - 1] - const buttons = (call?.[2] ?? []) as { text: string; onPress?: () => void }[] - const button = buttons.find((b) => b.text === label) - act(() => button?.onPress?.()) -} - -describe('Coupons index', () => { - beforeEach(() => { - resetStaffAuthMock() - searchParamsMock.current = {} - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - routerMock.push.mockClear() - }) - - it('shows a loading state while the list query is pending', () => { - setupApiMocks({ procedures: { 'admin.coupon.getAll': { coupons: [activeCoupon] } } }) - renderWithProviders() - - expect(screen.getByText('Loading Coupons...')).toBeVisible() - }) - - it('renders coupon rows from the getAll infinite query', async () => { - setupApiMocks({ - procedures: { 'admin.coupon.getAll': { coupons: [activeCoupon, expiredCoupon] } }, - }) - renderWithProviders() - - expect(await screen.findByText('SAVE10')).toBeVisible() - expect(screen.getByText('OLDCODE')).toBeVisible() - expect(screen.getByText('Discount: 10% off')).toBeVisible() - expect(screen.getByText('Discount: ₹50 off')).toBeVisible() - expect(screen.getAllByText('Expired').length).toBeGreaterThan(0) - }) - - it('renders the empty state when there are no coupons', async () => { - setupApiMocks({ procedures: { 'admin.coupon.getAll': { coupons: [] } } }) - renderWithProviders() - - expect(await screen.findByText('No Coupons Found')).toBeVisible() - }) - - it('renders the error state and retries on press', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { - 'admin.coupon.getAll': () => { - throw new Error('boom') - }, - }, - }) - renderWithProviders() - - expect(await screen.findByText('Failed to load coupons')).toBeVisible() - const before = procCount(fetchMock, 'admin.coupon.getAll') - - fireEvent.press(screen.getByText('Retry')) - - await waitFor(() => - expect(procCount(fetchMock, 'admin.coupon.getAll')).toBeGreaterThan(before) - ) - }) - - it('fetches the next page when the list end is reached', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { - 'admin.coupon.getAll': (input: any) => - input?.cursor - ? { coupons: [{ ...activeCoupon, id: 3, couponCode: 'PAGE2' }] } - : { coupons: [activeCoupon], nextCursor: 100 }, - }, - }) - renderWithProviders() - - await screen.findByText('SAVE10') - - const list = screen.UNSAFE_getByType(FlatList as any) - act(() => list.props.onEndReached()) - - expect(await screen.findByText('PAGE2')).toBeVisible() - expect(lastProcedureInput(fetchMock, 'admin.coupon.getAll')).toMatchObject({ - limit: 20, - cursor: 100, - }) - }) - - it('sends the search term to getAll', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { 'admin.coupon.getAll': { coupons: [activeCoupon] } }, - }) - renderWithProviders() - - await screen.findByText('SAVE10') - - fireEvent.changeText(screen.getByPlaceholderText('Search coupons...'), 'SAVE') - - await waitFor(() => - expect(lastProcedureInput(fetchMock, 'admin.coupon.getAll')).toMatchObject({ - limit: 20, - search: 'SAVE', - }) - ) - }) - - it('navigates to the create screen from the floating action button', async () => { - setupApiMocks({ procedures: { 'admin.coupon.getAll': { coupons: [activeCoupon] } } }) - renderWithProviders() - await screen.findByText('SAVE10') - - fireEvent.press(screen.getByTestId('mock-linear-gradient')) - - expect(routerMock.push).toHaveBeenCalledWith('/(drawer)/dashboard/coupons/create') - }) - - it('navigates to the edit screen for the pressed coupon', async () => { - setupApiMocks({ procedures: { 'admin.coupon.getAll': { coupons: [activeCoupon] } } }) - renderWithProviders() - await screen.findByText('SAVE10') - - fireEvent.press(screen.getByText('Edit')) - - expect(routerMock.push).toHaveBeenCalledWith('/(drawer)/dashboard/coupons/edit/1') - }) - - it('deletes a coupon after confirming the alert', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { - 'admin.coupon.getAll': { coupons: [activeCoupon] }, - 'admin.coupon.delete': { message: 'Coupon invalidated successfully' }, - }, - }) - renderWithProviders() - await screen.findByText('SAVE10') - - fireEvent.press(screen.getByText('Delete')) - - expect(Alert.alert).toHaveBeenCalledWith( - 'Delete Coupon', - 'Are you sure you want to delete this coupon?', - expect.any(Array) - ) - - pressLastAlertButton('Delete') - - await waitFor(() => expectProcedureCalled(fetchMock, 'admin.coupon.delete')) - expect(lastProcedureInput(fetchMock, 'admin.coupon.delete')).toEqual({ id: 1 }) - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith('Success', 'Coupon deleted successfully') - ) - }) - - it('switches to the Reserved tab and lists reserved coupons', async () => { - setupApiMocks({ - procedures: { - 'admin.coupon.getAll': { coupons: [activeCoupon] }, - 'admin.coupon.getReservedCoupons': { coupons: [reservedCoupon] }, - }, - }) - renderWithProviders() - await screen.findByText('SAVE10') - - fireEvent.press(screen.getByTestId('tab-reserved')) - - expect(await screen.findByText('SECRET9')).toBeVisible() - expect(screen.getByTestId('tab-reserved')).toBeVisible() - }) - - it('shows the reserved empty state', async () => { - setupApiMocks({ - procedures: { - 'admin.coupon.getAll': { coupons: [activeCoupon] }, - 'admin.coupon.getReservedCoupons': { coupons: [] }, - }, - }) - renderWithProviders() - - fireEvent.press(screen.getByTestId('tab-reserved')) - - expect(await screen.findByText('No Reserved Coupons Found')).toBeVisible() - }) -}) diff --git a/apps/admin-ui/tests/screens/customize-app-all-items-order.test.tsx b/apps/admin-ui/tests/screens/customize-app-all-items-order.test.tsx deleted file mode 100644 index e56e504..0000000 --- a/apps/admin-ui/tests/screens/customize-app-all-items-order.test.tsx +++ /dev/null @@ -1,220 +0,0 @@ -/** - * All items order editor - * (app/(drawer)/dashboard/customize-app/all-items-order.tsx) — sorts the - * catalogue by the `allItemsOrder` constant, supports drag reordering and saves - * the full ordered id list back to the constant. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' - -import AllItemsOrder from '@/app/(drawer)/dashboard/customize-app/all-items-order' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { - expectProcedureCalled, - lastProcedureInput, - procCount, -} from '../mocks/procedures' -import { routerMock } from '../mocks/router' -import { createQueryClient, renderWithProviders } from '../helpers/render' - -const productsResponse = { - products: [ - { id: 1, name: 'Chicken', images: ['chicken.jpg'], isOutOfStock: false }, - { id: 2, name: 'Mutton', images: ['mutton.jpg'], isOutOfStock: true }, - { id: 3, name: 'Fish', images: [], isOutOfStock: false }, - ], - count: 3, -} - -describe('All items order editor', () => { - beforeEach(async () => { - await resetStorage() - setupApiMocks() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('shows the loading state while constants load', () => { - setupApiMocks({ - procedures: { - 'admin.region.getRegionConstants': () => new Promise(() => {}), - 'common.product.getAllProductsSummary': productsResponse, - }, - }) - renderWithProviders() - - expect(screen.getByText('Loading order...')).toBeVisible() - }) - - it('shows the error state when constants fail', async () => { - setupApiMocks({ - procedures: { - 'admin.region.getRegionConstants': () => { - throw new Error('boom') - }, - 'common.product.getAllProductsSummary': productsResponse, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Failed to load order')).toBeVisible()) - }) - - it('sorts products by the constant and appends the rest', async () => { - setupApiMocks({ - procedures: { - 'admin.region.getRegionConstants': [{ key: 'allItemsOrder', value: [2, 1] }], - 'common.product.getAllProductsSummary': productsResponse, - }, - }) - const result = renderWithProviders() - - await waitFor(() => expect(screen.getByText('Mutton')).toBeVisible()) - - const list = result.UNSAFE_getByType(require('react-native-draggable-flatlist').default) - expect(list.props.data.map((p: { id: number }) => p.id)).toEqual([2, 1, 3]) - expect(screen.getByText(/3 items/)).toBeVisible() - }) - - it('accepts a comma-separated order string', async () => { - setupApiMocks({ - procedures: { - 'admin.region.getRegionConstants': [{ key: 'allItemsOrder', value: '3' }], - 'common.product.getAllProductsSummary': productsResponse, - }, - }) - const result = renderWithProviders() - - await waitFor(() => expect(screen.getByText('Fish')).toBeVisible()) - const list = result.UNSAFE_getByType(require('react-native-draggable-flatlist').default) - expect(list.props.data.map((p: { id: number }) => p.id)).toEqual([3, 1, 2]) - }) - - it('shows the empty state when there are no products', async () => { - setupApiMocks({ - procedures: { - 'admin.region.getRegionConstants': [{ key: 'allItemsOrder', value: [] }], - 'common.product.getAllProductsSummary': { products: [], count: 0 }, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('No products available')).toBeVisible()) - }) - - it('disables Save until the order changes, then saves the full list', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.region.getRegionConstants': [{ key: 'allItemsOrder', value: [1, 2, 3] }], - 'common.product.getAllProductsSummary': productsResponse, - 'admin.region.updateRegionConstants': { success: true, updatedCount: 1, keys: ['allItemsOrder'] }, - }, - }) - const result = renderWithProviders() - - await waitFor(() => expect(screen.getByText('Chicken')).toBeVisible()) - - fireEvent.press(screen.getByText('Save')) - expect(procCount(api.fetchMock, 'admin.region.updateRegionConstants')).toBe(0) - - const list = result.UNSAFE_getByType(require('react-native-draggable-flatlist').default) - act(() => { - list.props.onDragEnd({ data: [list.props.data[2], list.props.data[0], list.props.data[1]] }) - }) - fireEvent.press(screen.getByText('Save')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'admin.region.updateRegionConstants')) - expect(lastProcedureInput(api.fetchMock, 'admin.region.updateRegionConstants')).toEqual({ - constants: [{ key: 'allItemsOrder', value: [3, 1, 2] }], - }) - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith( - 'Success', - 'All items order updated successfully!' - ) - ) - }) - - it('refetches the constants after saving', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.region.getRegionConstants': [{ key: 'allItemsOrder', value: [1, 2, 3] }], - 'common.product.getAllProductsSummary': productsResponse, - 'admin.region.updateRegionConstants': { success: true, updatedCount: 1, keys: ['allItemsOrder'] }, - }, - }) - const client = createQueryClient() - const invalidateSpy = jest.spyOn(client, 'invalidateQueries') - const result = renderWithProviders(, { queryClient: client }) - - await waitFor(() => expect(screen.getByText('Chicken')).toBeVisible()) - const before = procCount(api.fetchMock, 'admin.region.getRegionConstants') - // Delta, not an absolute: the suite shares one httpBatchLink client, so a prior test's - // request can land in this test's fetchMock. - expect(before).toBeGreaterThan(0) - - const list = result.UNSAFE_getByType(require('react-native-draggable-flatlist').default) - act(() => { - list.props.onDragEnd({ data: [list.props.data[2], list.props.data[0], list.props.data[1]] }) - }) - fireEvent.press(screen.getByText('Save')) - - await waitFor(() => - expect(procCount(api.fetchMock, 'admin.region.getRegionConstants')).toBeGreaterThan(before) - ) - // The refetch is driven by the path-based invalidation, not by updateConstants itself. - // Asserting the ARRAY path is the point: the old dotted string matched no query at all. - await waitFor(() => expect(invalidateSpy).toHaveBeenCalled()) - expect( - invalidateSpy.mock.calls - .map((call) => (call[0] as { queryKey?: unknown[] } | undefined)?.queryKey) - .map((key) => (Array.isArray(key) ? key[0] : null)) - ).toContainEqual(['admin', 'const', 'getConstants']) - // Same client, same cache: the array path matches the live query, the dotted form matches none. - expect( - client.getQueryCache().findAll({ queryKey: [['admin', 'const', 'getConstants']] }).length - ).toBeGreaterThan(0) - expect( - client.getQueryCache().findAll({ queryKey: ['admin.region.getRegionConstants'] }) - ).toHaveLength(0) - }) - - it('shows the saving label while the update is pending', async () => { - setupApiMocks({ - procedures: { - 'admin.region.getRegionConstants': [{ key: 'allItemsOrder', value: [1, 2, 3] }], - 'common.product.getAllProductsSummary': productsResponse, - 'admin.region.updateRegionConstants': () => new Promise(() => {}), - }, - }) - const result = renderWithProviders() - - await waitFor(() => expect(screen.getByText('Chicken')).toBeVisible()) - const list = result.UNSAFE_getByType(require('react-native-draggable-flatlist').default) - act(() => { - list.props.onDragEnd({ data: [list.props.data[1], list.props.data[0], list.props.data[2]] }) - }) - fireEvent.press(screen.getByText('Save')) - - await waitFor(() => expect(screen.getByText('Saving...')).toBeVisible()) - }) - - it('goes back from the header and the error state', async () => { - setupApiMocks({ - procedures: { - 'admin.region.getRegionConstants': () => { - throw new Error('boom') - }, - 'common.product.getAllProductsSummary': productsResponse, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Failed to load order')).toBeVisible()) - fireEvent.press(screen.getByText('Go Back')) - expect(routerMock.back).toHaveBeenCalled() - }) -}) diff --git a/apps/admin-ui/tests/screens/customize-app-hub.test.tsx b/apps/admin-ui/tests/screens/customize-app-hub.test.tsx deleted file mode 100644 index e5dbf44..0000000 --- a/apps/admin-ui/tests/screens/customize-app-hub.test.tsx +++ /dev/null @@ -1,171 +0,0 @@ -/** - * Customize App hub (app/(drawer)/dashboard/customize-app/index.tsx) — renders - * the visible constants, links to the popular-items / all-items-order editors, - * and saves only the constants that changed. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import CustomizeApp from '@/app/(drawer)/dashboard/customize-app/index' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { - expectProcedureCalled, - lastProcedureInput, - procCount, -} from '../mocks/procedures' -import { routerMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const constants = [ - { key: 'deliveryCharge', value: 10 }, - { key: 'supportMobile', value: '9999999999' }, - { key: 'isFlashDeliveryEnabled', value: false }, - { key: 'popularItems', value: [1, 2] }, - { key: 'allItemsOrder', value: [3] }, -] - -const renderHub = () => - renderWithProviders() - -describe('Customize App hub', () => { - beforeEach(async () => { - await resetStorage() - setupApiMocks() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('shows the loading state while constants load', () => { - setupApiMocks({ - procedures: { 'admin.const.getConstants': () => new Promise(() => {}) }, - }) - renderHub() - - expect(screen.getByText('Loading constants...')).toBeVisible() - }) - - it('shows the failed state when constants are missing', async () => { - renderHub() - - await waitFor(() => expect(screen.getByText('Failed to load constants')).toBeVisible()) - }) - - it('renders the visible constants and section links', async () => { - setupApiMocks({ - procedures: { 'admin.const.getConstants': constants }, - }) - renderHub() - - expect(await screen.findByText('Customize App Constants')).toBeVisible() - expect(screen.getByText('Delivery Charge')).toBeVisible() - expect(screen.getByText('Support Mobile')).toBeVisible() - expect(screen.getByText('Enable Flash Delivery')).toBeVisible() - expect(screen.getByText('Manage Popular Items (2 items)')).toBeVisible() - expect(screen.getByText('Manage All Visible Items (1 items)')).toBeVisible() - expect(screen.getByText('Save Changes')).toBeVisible() - }) - - it('navigates to the popular items editor', async () => { - setupApiMocks({ - procedures: { 'admin.const.getConstants': constants }, - }) - renderHub() - - fireEvent.press(await screen.findByText('Manage Popular Items (2 items)')) - expect(routerMock.push).toHaveBeenCalledWith( - '/(drawer)/dashboard/customize-app/popular-items' - ) - }) - - it('navigates to the all items order editor', async () => { - setupApiMocks({ - procedures: { 'admin.const.getConstants': constants }, - }) - renderHub() - - fireEvent.press(await screen.findByText('Manage All Visible Items (1 items)')) - expect(routerMock.push).toHaveBeenCalledWith( - '/(drawer)/dashboard/customize-app/all-items-order' - ) - }) - - it('alerts when saving without changes and skips the mutation', async () => { - const api = setupApiMocks({ - procedures: { 'admin.const.getConstants': constants }, - }) - renderHub() - - fireEvent.press(await screen.findByText('Save Changes')) - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith('No Changes', 'No constants were modified.') - ) - expect(procCount(api.fetchMock, 'admin.const.updateConstants')).toBe(0) - }) - - it('saves only the changed constant', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.const.getConstants': constants, - 'admin.const.updateConstants': { success: true, updatedCount: 1, keys: ['deliveryCharge'] }, - }, - }) - renderHub() - - await screen.findByText('Delivery Charge') - fireEvent.changeText(screen.getAllByPlaceholderText('Enter number')[0], '25') - fireEvent.press(screen.getByText('Save Changes')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'admin.const.updateConstants')) - expect(lastProcedureInput(api.fetchMock, 'admin.const.updateConstants')).toEqual({ - constants: [{ key: 'deliveryCharge', value: 25 }], - }) - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith( - 'Success', - 'Updated 1 constants successfully.' - ) - ) - }) - - it('toggles a boolean constant and saves it', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.const.getConstants': constants, - 'admin.const.updateConstants': { success: true, updatedCount: 1, keys: ['isFlashDeliveryEnabled'] }, - }, - }) - renderHub() - - await screen.findByText('Enable Flash Delivery') - expect(screen.getByText('Disabled')).toBeVisible() - fireEvent.press(screen.getByRole('checkbox')) - await waitFor(() => expect(screen.getByText('Enabled')).toBeVisible()) - - fireEvent.press(screen.getByText('Save Changes')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'admin.const.updateConstants')) - expect(lastProcedureInput(api.fetchMock, 'admin.const.updateConstants')).toEqual({ - constants: [{ key: 'isFlashDeliveryEnabled', value: true }], - }) - }) - - it('shows the updating label while the mutation is pending', async () => { - setupApiMocks({ - procedures: { - 'admin.const.getConstants': constants, - 'admin.const.updateConstants': () => new Promise(() => {}), - }, - }) - renderHub() - - await screen.findByText('Delivery Charge') - fireEvent.changeText(screen.getAllByPlaceholderText('Enter number')[0], '25') - fireEvent.press(screen.getByText('Save Changes')) - - await waitFor(() => expect(screen.getByText('Updating...')).toBeVisible()) - }) -}) diff --git a/apps/admin-ui/tests/screens/customize-app-popular-items.test.tsx b/apps/admin-ui/tests/screens/customize-app-popular-items.test.tsx deleted file mode 100644 index 2151b61..0000000 --- a/apps/admin-ui/tests/screens/customize-app-popular-items.test.tsx +++ /dev/null @@ -1,298 +0,0 @@ -/** - * Popular items editor - * (app/(drawer)/dashboard/customize-app/popular-items.tsx) — resolves the - * `popularItems` constant against the product catalogue, supports removing / - * adding items and saves the ordered product ids back to the constant. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' -import MaterialIcons from '@expo/vector-icons/MaterialIcons' - -import PopularItems from '@/app/(drawer)/dashboard/customize-app/popular-items' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { - expectProcedureCalled, - lastProcedureInput, - procCount, -} from '../mocks/procedures' -import { routerMock } from '../mocks/router' -import { createQueryClient, renderWithProviders } from '../helpers/render' - -const product = (id: number, name: string, price: number) => ({ - id, - name, - price, - marketPrice: null, - images: [`${name}.jpg`], - storeId: null, - nextDeliveryDate: null, - isOutOfStock: false, -}) - -const productsResponse = { - products: [product(1, 'Chicken', 100), product(2, 'Mutton', 200), product(3, 'Fish', 50)], - count: 3, -} - -// SKU ids intentionally match product ids so the selector's ids resolve against -// the product catalogue (see the reported popular-items add-flow bug). -const skusResponse = { - skus: [ - { id: 3, productId: 3, productName: 'Fish', label: 'Fish 1kg' }, - ], -} - -const constants = [{ key: 'popularItems', value: [1, 2] }] - -const pressLastAlertButton = (label: string) => { - const calls = (Alert.alert as jest.Mock).mock.calls - const call = calls[calls.length - 1] - const buttons = (call?.[2] ?? []) as { text: string; onPress?: () => void }[] - act(() => buttons.find((b) => b.text === label)?.onPress?.()) -} - -const pressIcon = (result: ReturnType, name: string, index = 0) => { - const icons = result.UNSAFE_getAllByType(MaterialIcons).filter((n) => n.props.name === name) - fireEvent.press(icons[index]) -} - -describe('Popular items editor', () => { - beforeEach(async () => { - await resetStorage() - setupApiMocks() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('shows the loading state while constants load', () => { - setupApiMocks({ - procedures: { - 'admin.region.getRegionConstants': () => new Promise(() => {}), - 'common.product.getAllProductsSummary': productsResponse, - }, - }) - renderWithProviders() - - expect(screen.getByText('Loading constants...')).toBeVisible() - }) - - it('shows the error state when constants fail', async () => { - setupApiMocks({ - procedures: { - 'admin.region.getRegionConstants': () => { - throw new Error('boom') - }, - 'common.product.getAllProductsSummary': productsResponse, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Failed to load constants')).toBeVisible()) - }) - - it('renders the popular items resolved from the constant', async () => { - setupApiMocks({ - procedures: { - 'admin.region.getRegionConstants': constants, - 'common.product.getAllProductsSummary': productsResponse, - }, - }) - renderWithProviders() - - expect(await screen.findByText('Chicken')).toBeVisible() - expect(screen.getByText('Mutton')).toBeVisible() - expect(screen.getByText('₹100')).toBeVisible() - expect(screen.queryByText('Fish')).toBeNull() - }) - - it('shows the empty state when nothing is configured', async () => { - setupApiMocks({ - procedures: { - 'admin.region.getRegionConstants': [{ key: 'popularItems', value: [] }], - 'common.product.getAllProductsSummary': productsResponse, - }, - }) - renderWithProviders() - - await waitFor(() => - expect(screen.getByText('No popular items configured')).toBeVisible() - ) - }) - - it('removes a product and saves the remaining ids', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.region.getRegionConstants': constants, - 'common.product.getAllProductsSummary': productsResponse, - 'admin.region.updateRegionConstants': { success: true, updatedCount: 1, keys: ['popularItems'] }, - }, - }) - const result = renderWithProviders() - - await screen.findByText('Chicken') - pressIcon(result, 'delete', 0) - pressLastAlertButton('Remove') - await waitFor(() => expect(screen.queryByText('Chicken')).toBeNull()) - - fireEvent.press(screen.getByText('Save')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'admin.region.updateRegionConstants')) - expect(lastProcedureInput(api.fetchMock, 'admin.region.updateRegionConstants')).toEqual({ - constants: [{ key: 'popularItems', value: [2] }], - }) - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith( - 'Success', - 'Popular items updated successfully!' - ) - ) - }) - - it('saves a reordered list', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.region.getRegionConstants': constants, - 'common.product.getAllProductsSummary': productsResponse, - 'admin.region.updateRegionConstants': { success: true, updatedCount: 1, keys: ['popularItems'] }, - }, - }) - const result = renderWithProviders() - - await screen.findByText('Chicken') - const list = result.UNSAFE_getByType(require('react-native-draggable-flatlist').default) - act(() => { - list.props.onDragEnd({ data: [list.props.data[1], list.props.data[0]] }) - }) - fireEvent.press(screen.getByText('Save')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'admin.region.updateRegionConstants')) - expect(lastProcedureInput(api.fetchMock, 'admin.region.updateRegionConstants')).toEqual({ - constants: [{ key: 'popularItems', value: [2, 1] }], - }) - }) - - it('refetches the constants after saving', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.region.getRegionConstants': constants, - 'common.product.getAllProductsSummary': productsResponse, - 'admin.region.updateRegionConstants': { success: true, updatedCount: 1, keys: ['popularItems'] }, - }, - }) - const client = createQueryClient() - const invalidateSpy = jest.spyOn(client, 'invalidateQueries') - const result = renderWithProviders(, { queryClient: client }) - - await screen.findByText('Chicken') - const before = procCount(api.fetchMock, 'admin.region.getRegionConstants') - // Delta, not an absolute: the suite shares one httpBatchLink client, so a prior test's - // request can land in this test's fetchMock. - expect(before).toBeGreaterThan(0) - - const list = result.UNSAFE_getByType(require('react-native-draggable-flatlist').default) - act(() => { - list.props.onDragEnd({ data: [list.props.data[1], list.props.data[0]] }) - }) - fireEvent.press(screen.getByText('Save')) - - await waitFor(() => - expect(procCount(api.fetchMock, 'admin.region.getRegionConstants')).toBeGreaterThan(before) - ) - // The refetch is driven by the path-based invalidation, not by updateConstants itself. - // Asserting the ARRAY path is the point: the old dotted string matched no query at all. - await waitFor(() => expect(invalidateSpy).toHaveBeenCalled()) - expect( - invalidateSpy.mock.calls - .map((call) => (call[0] as { queryKey?: unknown[] } | undefined)?.queryKey) - .map((key) => (Array.isArray(key) ? key[0] : null)) - ).toContainEqual(['admin', 'const', 'getConstants']) - // Same client, same cache: the array path matches the live query, the dotted form matches none. - expect( - client.getQueryCache().findAll({ queryKey: [['admin', 'const', 'getConstants']] }).length - ).toBeGreaterThan(0) - expect( - client.getQueryCache().findAll({ queryKey: ['admin.region.getRegionConstants'] }) - ).toHaveLength(0) - }) - - it('does not save while nothing changed', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.region.getRegionConstants': constants, - 'common.product.getAllProductsSummary': productsResponse, - }, - }) - renderWithProviders() - - await screen.findByText('Chicken') - fireEvent.press(screen.getByText('Save')) - - expect(procCount(api.fetchMock, 'admin.region.updateRegionConstants')).toBe(0) - }) - - it('adds a product through the add dialog and saves it', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.region.getRegionConstants': constants, - 'common.product.getAllProductsSummary': productsResponse, - 'common.product.getAllSkusSummary': skusResponse, - 'admin.region.updateRegionConstants': { success: true, updatedCount: 1, keys: ['popularItems'] }, - }, - }) - const result = renderWithProviders() - - await screen.findByText('Chicken') - pressIcon(result, 'add') - expect(await screen.findByText('Add Popular Items')).toBeVisible() - - fireEvent.press(screen.getByText('Choose products...')) - fireEvent.press(await screen.findByTestId('undefined-option-3')) - fireEvent.press(screen.getByText('Done')) - fireEvent.press(await screen.findByText('Add 1 Product')) - - await waitFor(() => expect(screen.getByText('Fish')).toBeVisible()) - - fireEvent.press(screen.getByText('Save')) - await waitFor(() => expectProcedureCalled(api.fetchMock, 'admin.region.updateRegionConstants')) - expect(lastProcedureInput(api.fetchMock, 'admin.region.updateRegionConstants')).toEqual({ - constants: [{ key: 'popularItems', value: [1, 2, 3] }], - }) - }) - - it('shows the saving label while the update is pending', async () => { - setupApiMocks({ - procedures: { - 'admin.region.getRegionConstants': constants, - 'common.product.getAllProductsSummary': productsResponse, - 'admin.region.updateRegionConstants': () => new Promise(() => {}), - }, - }) - const result = renderWithProviders() - - await screen.findByText('Chicken') - pressIcon(result, 'delete', 0) - pressLastAlertButton('Remove') - fireEvent.press(screen.getByText('Save')) - - await waitFor(() => expect(screen.getByText('Saving...')).toBeVisible()) - }) - - it('goes back from the header and the error state', async () => { - setupApiMocks({ - procedures: { - 'admin.region.getRegionConstants': () => { - throw new Error('boom') - }, - 'common.product.getAllProductsSummary': productsResponse, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Failed to load constants')).toBeVisible()) - fireEvent.press(screen.getByText('Go Back')) - expect(routerMock.back).toHaveBeenCalled() - }) -}) diff --git a/apps/admin-ui/tests/screens/dashboard-hub.test.tsx b/apps/admin-ui/tests/screens/dashboard-hub.test.tsx deleted file mode 100644 index 91e5e09..0000000 --- a/apps/admin-ui/tests/screens/dashboard-hub.test.tsx +++ /dev/null @@ -1,116 +0,0 @@ -/** - * Dashboard hub (app/(drawer)/dashboard/index.tsx) — quick actions, the - * complaints badge from getEssentials, and navigation (incl. the navigation - * target set for the manage-orders flow). - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Text } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import Dashboard from '@/app/(drawer)/dashboard/index' -import { useNavigationTarget } from 'common-ui/hooks/useNavigationTarget' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { expectProcedureCalled } from '../mocks/procedures' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { resetRouterMock, routerMock, searchParamsMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const TargetProbe = () => { - const { navigationTarget } = useNavigationTarget() - return {navigationTarget ?? 'none'} -} - -describe('Dashboard hub', () => { - beforeEach(async () => { - resetStaffAuthMock() - await resetStorage() - resetRouterMock() - searchParamsMock.current = {} - setupApiMocks({ - procedures: { 'admin.user.getEssentials': { unresolvedComplaints: 3 } }, - }) - }) - - it('renders the quick actions and grouped menu items', async () => { - renderWithProviders() - - expect(screen.getByText('Quick Actions')).toBeVisible() - expect(screen.getByText('Delivery Slots')).toBeVisible() - expect(screen.getByText('Add Product')).toBeVisible() - expect(screen.getByText('Complaints')).toBeVisible() - expect(screen.getByText('Orders')).toBeVisible() - expect(screen.getByText('Manage Orders')).toBeVisible() - expect(screen.getByText('Delivery Sequences')).toBeVisible() - expect(screen.getByText('Products & Inventory')).toBeVisible() - expect(screen.getByText('Prices Overview')).toBeVisible() - expect(screen.getByText('Product Groupings')).toBeVisible() - expect(screen.getByText('Settings & Configuration')).toBeVisible() - // Both the category header and its menu tile say "User Management". - expect(screen.getAllByText('User Management').length).toBeGreaterThan(0) - }) - - it('shows the unresolved-complaints badge from getEssentials', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { 'admin.user.getEssentials': { unresolvedComplaints: 3 } }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('3')).toBeVisible()) - expectProcedureCalled(fetchMock, 'admin.user.getEssentials') - }) - - it('navigates to manage orders and sets the nested navigation target', () => { - renderWithProviders( - <> - - - - ) - - fireEvent.press(screen.getByText('Manage Orders')) - - expect(routerMock.push).toHaveBeenCalledWith('/(drawer)/dashboard/manage-orders') - expect(screen.getByTestId('target-probe')).toHaveTextContent( - '/(drawer)/dashboard/manage-orders/orders' - ) - }) - - it('navigates to delivery sequences with its nested navigation target', () => { - renderWithProviders( - <> - - - - ) - - fireEvent.press(screen.getByText('Delivery Sequences')) - - expect(routerMock.push).toHaveBeenCalledWith('/(drawer)/dashboard/manage-orders') - expect(screen.getByTestId('target-probe')).toHaveTextContent( - '/(drawer)/dashboard/manage-orders/delivery-sequences' - ) - }) - - it('navigates from the quick-action tiles by testID', () => { - renderWithProviders() - - fireEvent.press(screen.getByTestId('delivery-slots-menu-item')) - expect(routerMock.push).toHaveBeenCalledWith('/(drawer)/dashboard/slots') - - fireEvent.press(screen.getByTestId('add-product-menu-item')) - expect(routerMock.push).toHaveBeenCalledWith('/(drawer)/dashboard/products/add') - }) - - it('navigates to prices overview', () => { - renderWithProviders() - - fireEvent.press(screen.getByText('Prices Overview')) - - expect(routerMock.push).toHaveBeenCalledWith( - '/(drawer)/dashboard/prices-overview' - ) - }) -}) \ No newline at end of file diff --git a/apps/admin-ui/tests/screens/delivery-sequences.test.tsx b/apps/admin-ui/tests/screens/delivery-sequences.test.tsx deleted file mode 100644 index d7feb61..0000000 --- a/apps/admin-ui/tests/screens/delivery-sequences.test.tsx +++ /dev/null @@ -1,387 +0,0 @@ -/** - * Delivery sequences - * (app/(drawer)/dashboard/manage-orders/delivery-sequences/index.tsx) — slot - * picker, unassigned/all-users filtering, assigning & unassigning orders, - * packaged/delivered toggles, notes, cancel and order intents. - * - * NOTE: the "save sequence" FAB only appears after a drag (`hasSequenceChanged`). - * The mocked draggable list never fires onDragEnd on its own, but the prop is - * still on the rendered element and can be invoked through - * UNSAFE_getByType(...).props.onDragEnd({ data }) inside act(), which is how the - * reorder-save path (`handleSaveSequence`) is covered below. Assignment changes - * persist via updateDeliverySequence directly. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert, Linking } from 'react-native' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' -import dayjs from 'dayjs' -import MaterialIcons from '@expo/vector-icons/MaterialIcons' -import Entypo from '@expo/vector-icons/Entypo' -import Ionicons from '@expo/vector-icons/Ionicons' - -import DeliverySequences from '@/app/(drawer)/dashboard/manage-orders/delivery-sequences' -import { setupApiMocks, resetStorage } from '../mocks/api' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { resetRouterMock, routerMock, searchParamsMock } from '../mocks/router' -import { lastProcedureInput, procCount } from '../mocks/procedures' -import { refreshHooks, resetRefreshHooks } from '../mocks/refresh' -import { renderWithProviders } from '../helpers/render' - -const SLOTS = [ - { id: 3, deliveryTime: '2026-01-01T09:00:00.000Z' }, - { id: 4, deliveryTime: '2026-01-02T09:00:00.000Z' }, -] -const LABEL_3 = dayjs(SLOTS[0].deliveryTime).format('ddd DD MMM, h:mm a') -const LABEL_4 = dayjs(SLOTS[1].deliveryTime).format('ddd DD MMM, h:mm a') - -const slotOrder = (overrides: Record = {}) => ({ - id: 21, - readableId: 21, - customerName: 'Bob', - address: '12 Main St, Phone: 9876543210', - addressId: 5, - latitude: null, - longitude: null, - totalAmount: 300, - items: [], - deliveryTime: null, - status: 'pending', - isPackaged: false, - isDelivered: false, - slotId: 3, - adminNotes: 'fragile', - userNotes: null, - ...overrides, -}) - -const defaultProcedures = (overrides: Record = {}) => ({ - 'admin.slots.getAll': { slots: SLOTS, count: 2 }, - 'admin.order.getSlotOrders': { success: true, data: [slotOrder()] }, - 'admin.slots.getDeliverySequence': { deliverySequence: {} }, - 'admin.staffUser.getStaff': { staff: [{ id: 7, name: 'Ravi' }, { id: 8, name: 'Sita' }] }, - 'admin.slots.updateDeliverySequence': { slot: { id: 3, deliverySequence: {} }, message: 'ok' }, - 'admin.order.updatePackaged': { success: true, userId: 1 }, - 'admin.order.updateDelivered': { success: true, userId: 1 }, - 'admin.order.updateNotes': { id: 21 }, - 'admin.order.cancelOrder': { success: true, message: 'cancelled' }, - 'admin.order.updateAddressCoords': { success: true }, - ...overrides, -}) - -const renderScreen = (overrides: Record = {}) => { - const { fetchMock } = setupApiMocks({ procedures: defaultProcedures(overrides) }) - // `view` is returned so tests can reach props of the mocked DraggableFlatList - // (its `onDragEnd` prop is not fired by the mock component itself). - const view = renderWithProviders() - return { fetchMock, view } -} - -const openOrderMenu = async () => { - const dots = screen.UNSAFE_getAllByType(Entypo)[0] - fireEvent.press(dots) - await screen.findByText('Select an action to perform') -} - -const openUserDropdown = async () => { - fireEvent.press(await screen.findByText('Unassigned')) - await screen.findByText('All Users') -} - -const toggleMenuResponder = async (name: 'square-outline' | 'checkbox') => { - const icon = screen.UNSAFE_getAllByType(Ionicons).find((node) => node.props.name === name)! - fireEvent(icon, 'responderEnd', { stopPropagation: jest.fn() }) -} - -const openAssignDropdown = async () => { - const icon = screen - .UNSAFE_getAllByType(MaterialIcons) - .find((node) => node.props.name === 'person-add')! - fireEvent.press(icon) - await screen.findByText('Assign To') -} - -describe('Delivery sequences', () => { - beforeEach(async () => { - resetStaffAuthMock() - await resetStorage() - resetRouterMock() - resetRefreshHooks() - searchParamsMock.current = { slotId: '3' } - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - jest.spyOn(Linking, 'openURL').mockResolvedValue(true) - }) - - it('shows a loading message while slots load', () => { - renderScreen() - - expect(screen.getByText('Loading slots...')).toBeVisible() - }) - - it('reports when there are no slots', async () => { - renderScreen({ 'admin.slots.getAll': { slots: [], count: 0 } }) - - expect(await screen.findByText('No slots available')).toBeVisible() - }) - - it('auto-selects the first slot and prompts when no slot is given', async () => { - searchParamsMock.current = {} - renderScreen() - - expect( - await screen.findByText('No slot selected. Please select a slot to view delivery sequence.') - ).toBeVisible() - await waitFor(() => - expect(routerMock.replace).toHaveBeenCalledWith( - '/(drawer)/dashboard/manage-orders/delivery-sequences?slotId=3' - ) - ) - }) - - it('queries slot orders and sequence with the route slot id', async () => { - const { fetchMock } = renderScreen() - - await waitFor(() => expect(screen.getByText('#21')).toBeVisible()) - expect(lastProcedureInput(fetchMock, 'admin.order.getSlotOrders')).toEqual({ slotId: '3' }) - expect(lastProcedureInput(fetchMock, 'admin.slots.getDeliverySequence')).toEqual({ id: '3' }) - }) - - it('renders the order card details', async () => { - renderScreen() - - await waitFor(() => expect(screen.getByText('#21')).toBeVisible()) - expect(screen.getByText('₹300')).toBeVisible() - expect(screen.getByText('fragile')).toBeVisible() - }) - - it('renders an empty state when there are no orders', async () => { - renderScreen({ 'admin.order.getSlotOrders': { success: true, data: [] } }) - - expect(await screen.findByText('No orders found for this slot')).toBeVisible() - }) - - it('filters to a user with no sequence and reports empty', async () => { - renderScreen() - - await waitFor(() => expect(screen.getByText('#21')).toBeVisible()) - await openUserDropdown() - fireEvent.press(screen.getByText('Ravi')) - - expect(await screen.findByText('No orders found for this slot')).toBeVisible() - }) - - it('shows assignment info in the All Users view', async () => { - renderScreen({ 'admin.slots.getDeliverySequence': { deliverySequence: { '7': [21] } } }) - - await openUserDropdown() - fireEvent.press(screen.getByText('All Users')) - - expect(await screen.findByText('Assigned to')).toBeVisible() - expect(screen.getByText('Ravi')).toBeVisible() - expect(screen.getByText('#21')).toBeVisible() - }) - - it('assigns selected orders to a user', async () => { - const { fetchMock } = renderScreen() - - await waitFor(() => expect(screen.getByText('#21')).toBeVisible()) - fireEvent.press(screen.getAllByRole('checkbox')[0]) - await openAssignDropdown() - fireEvent.press(screen.getByText('Ravi')) - - await waitFor(() => - expect(lastProcedureInput(fetchMock, 'admin.slots.updateDeliverySequence')).toEqual({ - id: 3, - deliverySequence: { '7': [21] }, - }) - ) - }) - - it('unassigns selected orders from all users', async () => { - const { fetchMock } = renderScreen({ - 'admin.slots.getDeliverySequence': { deliverySequence: { '7': [21] } }, - }) - - await openUserDropdown() - fireEvent.press(screen.getByText('All Users')) - await waitFor(() => expect(screen.getByText('#21')).toBeVisible()) - - fireEvent.press(screen.getAllByRole('checkbox')[0]) - await openAssignDropdown() - fireEvent.press(screen.getByText('None')) - - await waitFor(() => - expect(lastProcedureInput(fetchMock, 'admin.slots.updateDeliverySequence')).toEqual({ - id: 3, - deliverySequence: { '7': [] }, - }) - ) - }) - - it('marks an order packaged from the options menu', async () => { - const { fetchMock } = renderScreen({ - 'admin.order.getSlotOrders': { success: true, data: [slotOrder({ isDelivered: true })] }, - }) - - await waitFor(() => expect(screen.getByText('#21')).toBeVisible()) - const beforeOrders = procCount(fetchMock, 'admin.order.getSlotOrders') - const beforeSequence = procCount(fetchMock, 'admin.slots.getDeliverySequence') - await openOrderMenu() - await toggleMenuResponder('square-outline') - - await waitFor(() => expect(lastProcedureInput(fetchMock, 'admin.order.updatePackaged')).toEqual({ - orderId: '21', - isPackaged: true, - })) - - // onSuccess refetches both the slot orders and the delivery sequence. - await waitFor(() => { - expect(procCount(fetchMock, 'admin.order.getSlotOrders')).toBeGreaterThan(beforeOrders) - expect(procCount(fetchMock, 'admin.slots.getDeliverySequence')).toBeGreaterThan(beforeSequence) - }) - }) - - it('marks an order delivered from the options menu', async () => { - const { fetchMock } = renderScreen({ - 'admin.order.getSlotOrders': { success: true, data: [slotOrder({ isPackaged: true })] }, - }) - - await waitFor(() => expect(screen.getByText('#21')).toBeVisible()) - await openOrderMenu() - await toggleMenuResponder('square-outline') - - await waitFor(() => expect(lastProcedureInput(fetchMock, 'admin.order.updateDelivered')).toEqual({ - orderId: '21', - isDelivered: true, - })) - }) - - it('saves admin notes from the options menu', async () => { - const { fetchMock } = renderScreen() - - await waitFor(() => expect(screen.getByText('#21')).toBeVisible()) - await openOrderMenu() - fireEvent.press(screen.getByText('Admin Notes')) - - fireEvent.changeText( - await screen.findByPlaceholderText('Enter notes for this order...'), - 'fragile item' - ) - fireEvent.press(screen.getByText('Save Notes')) - - await waitFor(() => - expect(lastProcedureInput(fetchMock, 'admin.order.updateNotes')).toEqual({ - orderId: 21, - adminNotes: 'fragile item', - }) - ) - }) - - it('opens the cancel dialog from the options menu', async () => { - renderScreen() - - await waitFor(() => expect(screen.getByText('#21')).toBeVisible()) - await openOrderMenu() - fireEvent.press(screen.getByText('Cancel Order')) - - expect(await screen.findByPlaceholderText('Enter reason for cancellation...')).toBeVisible() - }) - - it('navigates to order details from View Details', async () => { - renderScreen() - - await waitFor(() => expect(screen.getByText('#21')).toBeVisible()) - await openOrderMenu() - fireEvent.press(screen.getByText('View Details')) - - expect(routerMock.push).toHaveBeenCalledWith( - '/(drawer)/dashboard/manage-orders/order-details/21' - ) - }) - - it('switches slots through the slot picker', async () => { - renderScreen() - - await waitFor(() => expect(screen.getByText(LABEL_3)).toBeVisible()) - fireEvent.press(screen.getByText(LABEL_3)) - fireEvent.press(await screen.findByText(LABEL_4)) - - expect(routerMock.replace).toHaveBeenCalledWith( - '/(drawer)/dashboard/manage-orders/delivery-sequences?slotId=4' - ) - }) - - it('opens a Google Maps link for orders with coordinates', async () => { - renderScreen({ - 'admin.order.getSlotOrders': { - success: true, - data: [slotOrder({ latitude: 16.75, longitude: 78.0 })], - }, - }) - - await waitFor(() => expect(screen.getByText('#21')).toBeVisible()) - const mapIcon = screen - .UNSAFE_getAllByType(MaterialIcons) - .find((node) => node.props.name === 'map')! - fireEvent.press(mapIcon) - - expect(Linking.openURL).toHaveBeenCalledWith('https://www.google.com/maps?q=16.75,78') - }) - - it('goes back from the header', async () => { - renderScreen() - - await waitFor(() => expect(screen.getByText('#21')).toBeVisible()) - fireEvent.press(screen.getByLabelText('Go back')) - - expect(routerMock.back).toHaveBeenCalled() - }) - - it('refetches orders and sequence after saving a reordered sequence', async () => { - const { fetchMock, view } = renderScreen({ - 'admin.order.getSlotOrders': { - success: true, - data: [slotOrder({ id: 21, readableId: 21 }), slotOrder({ id: 22, readableId: 22 })], - }, - 'admin.slots.getDeliverySequence': { deliverySequence: { '7': [21, 22] } }, - }) - - // A real user must be selected: handleDragEnd/handleSaveSequence no-op for - // the Unassigned (-1) view. - await openUserDropdown() - fireEvent.press(screen.getByText('Ravi')) - await waitFor(() => expect(screen.getByText('#21')).toBeVisible()) - - const beforeOrders = procCount(fetchMock, 'admin.order.getSlotOrders') - const beforeSequence = procCount(fetchMock, 'admin.slots.getDeliverySequence') - - // The mocked list renders its data but never drags by itself. - const list = view.UNSAFE_getByType(require('react-native-draggable-flatlist').default) - act(() => { - list.props.onDragEnd({ data: [list.props.data[1], list.props.data[0]] }) - }) - - fireEvent.press(await screen.findByLabelText('Save sequence')) - - // handleSaveSequence's onSuccess refetches both the slot orders and the - // delivery sequence. - await waitFor(() => { - expect(procCount(fetchMock, 'admin.order.getSlotOrders')).toBeGreaterThan(beforeOrders) - expect(procCount(fetchMock, 'admin.slots.getDeliverySequence')).toBeGreaterThan(beforeSequence) - }) - }) - - it('refetches on mark-data-fetchers', async () => { - const { fetchMock } = renderScreen() - - await waitFor(() => expect(screen.getByText('#21')).toBeVisible()) - const before = procCount(fetchMock, 'admin.order.getSlotOrders') - - refreshHooks.markDataFetchers?.() - await waitFor(() => - expect(procCount(fetchMock, 'admin.order.getSlotOrders')).toBeGreaterThan(before) - ) - }) -}) diff --git a/apps/admin-ui/tests/screens/drawer-layout.test.tsx b/apps/admin-ui/tests/screens/drawer-layout.test.tsx deleted file mode 100644 index a72b256..0000000 --- a/apps/admin-ui/tests/screens/drawer-layout.test.tsx +++ /dev/null @@ -1,191 +0,0 @@ -/** - * Drawer layout (app/(drawer)/_layout.tsx) — auth gate, the custom drawer - * content (staff name, nav items, logout) and the header buttons. - * - * expo-router/drawer and @react-navigation/drawer are stubbed so the custom - * drawer content and the screenOptions header callbacks are reachable. - */ - -const mockRedirects: string[] = [] - -jest.mock('expo-router', () => { - const React = require('react') - const { Text } = require('react-native') - const base = require('../mocks/router').expoRouterMock() - return { - ...base, - Redirect: ({ href }: { href: string }) => { - mockRedirects.push(href) - return React.createElement(Text, { testID: 'redirect' }, String(href)) - }, - } -}) - -const mockNavigation = { - getState: () => ({ routes: [], index: 0 }), - openDrawer: jest.fn(), -} - -jest.mock('expo-router/drawer', () => { - const React = require('react') - const { View } = require('react-native') - const Drawer = ({ - drawerContent: DrawerContent, - screenOptions, - children, - }: { - drawerContent?: React.ComponentType - screenOptions?: (args: { navigation: unknown }) => Record - children?: React.ReactNode - }) => { - const options = - typeof screenOptions === 'function' - ? screenOptions({ navigation: mockNavigation }) - : {} - return React.createElement( - View, - null, - options.headerLeft ? options.headerLeft() : null, - options.headerRight ? options.headerRight() : null, - DrawerContent ? React.createElement(DrawerContent) : null, - children - ) - } - Drawer.Screen = () => null - return { Drawer } -}) - -jest.mock('@react-navigation/drawer', () => { - const React = require('react') - const { View, TouchableOpacity, Text } = require('react-native') - return { - DrawerContentScrollView: ({ children }: { children?: React.ReactNode }) => - React.createElement(View, null, children), - DrawerItem: ({ - label, - onPress, - }: { - label: string - onPress?: () => void - }) => - React.createElement( - TouchableOpacity, - { onPress, accessibilityLabel: label }, - React.createElement(Text, null, label) - ), - } -}) - -import React from 'react' -import { ActivityIndicator, DeviceEventEmitter } from 'react-native' -import MaterialIcons from '@expo/vector-icons/MaterialIcons' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' -import { REFRESH_EVENT } from 'common-ui/src/lib/const-strs' - -import Layout from '@/app/(drawer)/_layout' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { resetStaffAuthMock, staffAuthMock } from '../mocks/staff-auth' -import { resetRouterMock, routerMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const iconByName = (name: string) => - screen.UNSAFE_getAllByType(MaterialIcons).find((i) => i.props.name === name) as - | Parameters[0] - | undefined - -describe('Drawer layout', () => { - beforeEach(async () => { - resetStaffAuthMock() - staffAuthMock.regionId = 1 - mockRedirects.length = 0 - mockNavigation.openDrawer.mockClear() - resetRouterMock() - await resetStorage() - setupApiMocks({ - procedures: { - 'admin.staffUser.me': { - id: 1, - name: 'shafi', - regionId: 1, - regionName: 'Hyderabad', - }, - }, - }) - jest.spyOn(DeviceEventEmitter, 'emit') - }) - - it('shows a spinner while the session is loading', () => { - staffAuthMock.isLoading = true - renderWithProviders() - - expect(screen.UNSAFE_getByType(ActivityIndicator)).toBeTruthy() - expect(screen.queryByText('Logout')).toBeNull() - }) - - it('redirects to login when logged out', () => { - staffAuthMock.isLoggedIn = false - staffAuthMock.isLoading = false - renderWithProviders() - - expect(screen.getByTestId('redirect')).toHaveTextContent('/login') - expect(mockRedirects).toEqual(['/login']) - }) - - it('renders the staff name, region and navigation items', async () => { - renderWithProviders() - - expect(screen.getByText('shafi')).toBeVisible() - await waitFor(() => expect(screen.getByText('Hyderabad')).toBeVisible()) - expect(screen.getByText('Dashboard')).toBeVisible() - expect(screen.getByText('Products')).toBeVisible() - expect(screen.getByText('Prices Overview')).toBeVisible() - expect(screen.getByText('Product Groupings')).toBeVisible() - expect(screen.getByText('Manage Orders')).toBeVisible() - expect(screen.getByText('User Management')).toBeVisible() - expect(screen.getByText('Send Notifications')).toBeVisible() - expect(screen.getByText('Logout')).toBeVisible() - }) - - it('navigates from a drawer item', () => { - renderWithProviders() - - fireEvent.press(screen.getByText('Prices Overview')) - - expect(routerMock.push).toHaveBeenCalledWith( - '/(drawer)/dashboard/prices-overview' - ) - }) - - it('dismisses to the dashboard from the Dashboard item', () => { - renderWithProviders() - - fireEvent.press(screen.getByText('Dashboard')) - - expect(routerMock.dismissTo).toHaveBeenCalledWith('/(drawer)/dashboard') - }) - - it('logs out from the Logout item', () => { - renderWithProviders() - - fireEvent.press(screen.getByText('Logout')) - - expect(staffAuthMock.logout).toHaveBeenCalledTimes(1) - }) - - it('emits the refresh event from the header refresh button', () => { - renderWithProviders() - - fireEvent.press(iconByName('refresh')!) - - expect(DeviceEventEmitter.emit).toHaveBeenCalledWith(REFRESH_EVENT) - }) - - it('opens the drawer from the header menu button when there is no back stack', () => { - renderWithProviders() - - fireEvent.press(iconByName('menu')!) - - expect(mockNavigation.openDrawer).toHaveBeenCalledTimes(1) - expect(routerMock.back).not.toHaveBeenCalled() - }) -}) \ No newline at end of file diff --git a/apps/admin-ui/tests/screens/index-redirect.test.tsx b/apps/admin-ui/tests/screens/index-redirect.test.tsx deleted file mode 100644 index 98e1966..0000000 --- a/apps/admin-ui/tests/screens/index-redirect.test.tsx +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Root entry (app/index.tsx) — loading spinner while auth resolves, then a - * Redirect to the dashboard or to /login depending on the staff session. - */ - -const mockRedirects: string[] = [] - -jest.mock('expo-router', () => { - const React = require('react') - const { Text } = require('react-native') - const base = require('../mocks/router').expoRouterMock() - return { - ...base, - Redirect: ({ href }: { href: string }) => { - mockRedirects.push(href) - return React.createElement(Text, { testID: 'redirect' }, String(href)) - }, - } -}) - -import React from 'react' -import { ActivityIndicator } from 'react-native' -import { screen } from '@testing-library/react-native' - -import Index from '@/app/index' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { resetStaffAuthMock, staffAuthMock } from '../mocks/staff-auth' -import { renderWithProviders } from '../helpers/render' - -describe('Root index redirect', () => { - beforeEach(async () => { - resetStaffAuthMock() - mockRedirects.length = 0 - await resetStorage() - setupApiMocks() - }) - - it('shows a spinner while the session is loading', () => { - staffAuthMock.isLoading = true - renderWithProviders() - - expect(screen.UNSAFE_getByType(ActivityIndicator)).toBeTruthy() - expect(screen.queryByTestId('redirect')).toBeNull() - }) - - it('redirects to the dashboard when logged in', () => { - staffAuthMock.isLoggedIn = true - staffAuthMock.isLoading = false - renderWithProviders() - - expect(screen.getByTestId('redirect')).toHaveTextContent( - '/(drawer)/dashboard' - ) - expect(mockRedirects).toEqual(['/(drawer)/dashboard']) - }) - - it('redirects to login when logged out', () => { - staffAuthMock.isLoggedIn = false - staffAuthMock.isLoading = false - renderWithProviders() - - expect(screen.getByTestId('redirect')).toHaveTextContent('/login') - expect(mockRedirects).toEqual(['/login']) - }) -}) \ No newline at end of file diff --git a/apps/admin-ui/tests/screens/login.test.tsx b/apps/admin-ui/tests/screens/login.test.tsx deleted file mode 100644 index 1464071..0000000 --- a/apps/admin-ui/tests/screens/login.test.tsx +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Admin login screen (app/login.tsx) — validation and the staff-auth login call. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import LoginScreen from '@/app/login' -import { setupApiMocks } from '../mocks/api' -import { resetStaffAuthMock, staffAuthMock } from '../mocks/staff-auth' -import { renderWithProviders } from '../helpers/render' - -describe('Admin login', () => { - beforeEach(() => { - resetStaffAuthMock() - setupApiMocks() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('renders the login form', () => { - renderWithProviders() - - expect(screen.getByText('Admin Login')).toBeVisible() - expect(screen.getByTestId('login-name-input')).toBeVisible() - expect(screen.getByTestId('login-password-input')).toBeVisible() - expect(screen.getByTestId('login-button')).toBeVisible() - }) - - it('rejects an empty name or password without calling login', () => { - renderWithProviders() - - fireEvent.press(screen.getByTestId('login-button')) - - expect(Alert.alert).toHaveBeenCalledWith('Error', 'Please enter both name and password') - expect(staffAuthMock.login).not.toHaveBeenCalled() - }) - - it('trims the credentials and calls login', async () => { - renderWithProviders() - - fireEvent.changeText(screen.getByTestId('login-name-input'), ' shafi ') - fireEvent.changeText(screen.getByTestId('login-password-input'), 'secret') - fireEvent.press(screen.getByTestId('login-button')) - - await waitFor(() => expect(staffAuthMock.login).toHaveBeenCalledWith('shafi', 'secret')) - }) - - it('shows the login error from the context', () => { - staffAuthMock.loginError = 'Invalid credentials' - renderWithProviders() - - expect(screen.getByText('Invalid credentials')).toBeVisible() - }) - - it('disables the button while logging in', () => { - staffAuthMock.isLoggingIn = true - renderWithProviders() - - expect(screen.getByText('Logging in...')).toBeVisible() - expect(screen.getByTestId('login-button')).toBeDisabled() - }) -}) diff --git a/apps/admin-ui/tests/screens/manage-orders-hub.test.tsx b/apps/admin-ui/tests/screens/manage-orders-hub.test.tsx deleted file mode 100644 index 17c6544..0000000 --- a/apps/admin-ui/tests/screens/manage-orders-hub.test.tsx +++ /dev/null @@ -1,127 +0,0 @@ -/** - * Manage Orders hub (app/(drawer)/dashboard/manage-orders/index.tsx) — slot - * picker plus navigation into Orders / Delivery Sequences. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' -import dayjs from 'dayjs' - -import ManageOrders from '@/app/(drawer)/dashboard/manage-orders' -import { setupApiMocks, resetStorage } from '../mocks/api' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { resetRouterMock, routerMock, searchParamsMock } from '../mocks/router' -import { refreshHooks, resetRefreshHooks } from '../mocks/refresh' -import { procCount } from '../mocks/procedures' -import { renderWithProviders } from '../helpers/render' - -const SLOT = { id: 3, deliveryTime: '2026-01-01T10:00:00.000Z' } -const SLOT_LABEL = dayjs(SLOT.deliveryTime).format('ddd DD MMM, h:mm a') - -const slotsResult = { slots: [SLOT], count: 1 } - -describe('Manage Orders hub', () => { - beforeEach(async () => { - resetStaffAuthMock() - await resetStorage() - resetRouterMock() - resetRefreshHooks() - searchParamsMock.current = {} - setupApiMocks({ procedures: { 'admin.slots.getAll': slotsResult } }) - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('renders the slot picker and both menu tiles', async () => { - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Delivery Sequences')).toBeVisible()) - expect(screen.getByText('Orders')).toBeVisible() - expect(screen.getByText('Select Slot')).toBeVisible() - }) - - it('loads the slot options into the dropdown', async () => { - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Select Slot')).toBeVisible()) - fireEvent.press(screen.getByText('Select Slot')) - - expect(await screen.findByText('⚡ Flash Deliveries')).toBeVisible() - expect(await screen.findByText(SLOT_LABEL)).toBeVisible() - }) - - it('navigates to Orders without a filter when no slot is selected', async () => { - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Orders')).toBeVisible()) - fireEvent.press(screen.getByText('Orders')) - - expect(routerMock.push).toHaveBeenCalledWith( - '/(drawer)/dashboard/manage-orders/orders' - ) - }) - - it('navigates to Orders with filter=flash after picking flash deliveries', async () => { - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Select Slot')).toBeVisible()) - fireEvent.press(screen.getByText('Select Slot')) - fireEvent.press(await screen.findByText('⚡ Flash Deliveries')) - - fireEvent.press(screen.getByText('Orders')) - - expect(routerMock.push).toHaveBeenCalledWith( - '/(drawer)/dashboard/manage-orders/orders?filter=flash' - ) - }) - - it('navigates to Delivery Sequences for the selected slot', async () => { - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Select Slot')).toBeVisible()) - fireEvent.press(screen.getByText('Select Slot')) - fireEvent.press(await screen.findByText(SLOT_LABEL)) - - fireEvent.press(screen.getByText('Delivery Sequences')) - - expect(routerMock.push).toHaveBeenCalledWith( - '/(drawer)/dashboard/manage-orders/delivery-sequences?slotId=3' - ) - }) - - it('warns that flash deliveries have no delivery sequences', async () => { - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Select Slot')).toBeVisible()) - fireEvent.press(screen.getByText('Select Slot')) - fireEvent.press(await screen.findByText('⚡ Flash Deliveries')) - - fireEvent.press(screen.getByText('Delivery Sequences')) - - expect(Alert.alert).toHaveBeenCalledWith( - 'Flash Deliveries', - 'Flash deliveries do not have delivery sequences. Use the Orders menu to manage flash deliveries.' - ) - expect(routerMock.push).not.toHaveBeenCalled() - }) - - it('refetches slots when mark-data-fetchers fires', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { 'admin.slots.getAll': slotsResult }, - }) - - renderWithProviders() - await waitFor(() => expect(screen.getByText('Orders')).toBeVisible()) - - expect(typeof refreshHooks.markDataFetchers).toBe('function') - act(() => { - refreshHooks.markDataFetchers?.() - }) - - await waitFor(() => - expect(procCount(fetchMock, 'admin.slots.getAll')).toBeGreaterThanOrEqual(2) - ) - }) -}) diff --git a/apps/admin-ui/tests/screens/manage-orders-orders.test.tsx b/apps/admin-ui/tests/screens/manage-orders-orders.test.tsx deleted file mode 100644 index 979210e..0000000 --- a/apps/admin-ui/tests/screens/manage-orders-orders.test.tsx +++ /dev/null @@ -1,337 +0,0 @@ -/** - * Orders list (app/(drawer)/dashboard/manage-orders/orders/index.tsx) — rows, - * loading/empty/error, delivered toggle, item packaging, admin notes, filters, - * pagination and navigation. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert, FlatList } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' -import MaterialIcons from '@expo/vector-icons/MaterialIcons' -import Entypo from '@expo/vector-icons/Entypo' - -import Orders from '@/app/(drawer)/dashboard/manage-orders/orders' -import { setupApiMocks, resetStorage } from '../mocks/api' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { resetRouterMock, routerMock, searchParamsMock } from '../mocks/router' -import { lastProcedureInput, procCount } from '../mocks/procedures' -import { renderWithProviders } from '../helpers/render' - -const makeOrder = (overrides: Record = {}) => ({ - id: 11, - orderId: '11', - readableId: 11, - customerName: 'Alice', - customerMobile: '9999999999', - address: '12 Main St, City, State - 500001, Phone: 9876543210', - addressId: 3, - latitude: null, - longitude: null, - totalAmount: 500, - deliveryCharge: 20, - items: [ - { - id: 101, - name: 'Chicken', - quantity: 2, - price: 100, - amount: 200, - unit: 'kg', - skuName: 'Chicken', - features: [], - productSize: 1, - isPackaged: false, - isPackageVerified: false, - }, - ], - createdAt: '2026-01-01T10:00:00.000Z', - deliveryTime: null, - status: 'pending', - isPackaged: false, - isDelivered: false, - isFlashDelivery: false, - userNotes: null, - adminNotes: 'call before delivery', - userNegativityScore: 0, - ...overrides, -}) - -const mutateProcedures = { - 'admin.order.updateDelivered': { success: true, userId: 1 }, - 'admin.order.updatePackaged': { success: true, userId: 1 }, - 'admin.order.updateOrderItemPackaging': { success: true, updated: true }, - 'admin.order.updateNotes': { id: 11 }, - 'admin.order.cancelOrder': { success: true, message: 'cancelled' }, -} - -const renderOrders = (procedures: Record = {}) => { - const { fetchMock } = setupApiMocks({ - procedures: { - 'admin.slots.getAll': { slots: [], count: 0 }, - 'admin.order.getAll': { orders: [makeOrder()], nextCursor: null }, - ...procedures, - }, - }) - renderWithProviders() - return { fetchMock } -} - -// Checkboxes render in tree order: row [Packaged, Delivered] then the filter -// dialog rows [Packaged, Not Packaged, Delivered, Not Delivered, Cancelled, -// Not Cancelled, ⚡ 1 Hr, Regular]. -const checkboxAt = (index: number) => screen.getAllByRole('checkbox')[index] - -const openFilter = () => { - const icon = screen - .UNSAFE_getAllByType(MaterialIcons) - .find((node) => node.props.name === 'filter-list')! - fireEvent.press(icon) -} - -const FILTER_INDEX = { - packaged: 2, - notPackaged: 3, - delivered: 4, - notDelivered: 5, - cancelled: 6, - notCancelled: 7, - flash: 8, - regular: 9, -} as const - -describe('Orders list', () => { - beforeEach(async () => { - resetStaffAuthMock() - await resetStorage() - resetRouterMock() - searchParamsMock.current = {} - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('shows a loading indicator while the list is pending', () => { - renderOrders() - - expect(screen.getByText('Loading orders...')).toBeVisible() - }) - - it('renders a populated row', async () => { - renderOrders() - - await waitFor(() => expect(screen.getByText('Alice')).toBeVisible()) - expect(screen.getByText('#11')).toBeVisible() - expect(screen.getByText('1 item')).toBeVisible() - expect(screen.getByText('₹500')).toBeVisible() - expect(screen.getByText('₹20')).toBeVisible() - expect(screen.getByText('Admin Notes')).toBeVisible() - }) - - it('renders an empty list when there are no orders', async () => { - renderOrders({ 'admin.order.getAll': { orders: [], nextCursor: null } }) - - await waitFor(() => expect(screen.queryByText('Loading orders...')).toBeNull()) - expect(screen.queryByText('Alice')).toBeNull() - }) - - it('renders flash and cancelled order badges', async () => { - renderOrders({ - 'admin.order.getAll': { - orders: [ - makeOrder({ isFlashDelivery: true, status: 'cancelled', readableId: 42, id: 42, orderId: '42' }), - ], - nextCursor: null, - }, - }) - - await waitFor(() => expect(screen.getByText('FLASH')).toBeVisible()) - expect(screen.getByText('CANCELLED')).toBeVisible() - }) - - it('marks an order delivered from the row checkbox', async () => { - const { fetchMock } = renderOrders(mutateProcedures) - await waitFor(() => expect(screen.getByText('Alice')).toBeVisible()) - - fireEvent.press(checkboxAt(1)) - - await waitFor(() => expect(lastProcedureInput(fetchMock, 'admin.order.updateDelivered')).toEqual({ - orderId: '11', - isDelivered: true, - })) - }) - - it('does not toggle packaged from the (inert) inline row checkbox', async () => { - const { fetchMock } = renderOrders(mutateProcedures) - await waitFor(() => expect(screen.getByText('Alice')).toBeVisible()) - - fireEvent.press(checkboxAt(0)) - - expect(procCount(fetchMock, 'admin.order.updatePackaged')).toBe(0) - }) - - it('updates per-item packaging from the items dialog', async () => { - const { fetchMock } = renderOrders(mutateProcedures) - await waitFor(() => expect(screen.getByText('Alice')).toBeVisible()) - - fireEvent.press(screen.getByText('1 item')) - fireEvent.press(checkboxAt(2)) - - await waitFor(() => - expect(lastProcedureInput(fetchMock, 'admin.order.updateOrderItemPackaging')).toEqual({ - orderItemId: 101, - isPackaged: true, - }) - ) - }) - - it('applies the packaged filter to the query input', async () => { - const { fetchMock } = renderOrders(mutateProcedures) - await waitFor(() => expect(screen.getByText('Alice')).toBeVisible()) - - openFilter() - fireEvent.press(checkboxAt(FILTER_INDEX.packaged)) - - await waitFor(() => { - const input = lastProcedureInput(fetchMock, 'admin.order.getAll') as Record - expect(input.packagedFilter).toBe('packaged') - }) - }) - - it('applies the delivered and cancellation filters', async () => { - const { fetchMock } = renderOrders(mutateProcedures) - await waitFor(() => expect(screen.getByText('Alice')).toBeVisible()) - - openFilter() - fireEvent.press(checkboxAt(FILTER_INDEX.delivered)) - - await waitFor(() => { - const input = lastProcedureInput(fetchMock, 'admin.order.getAll') as Record - expect(input.deliveredFilter).toBe('delivered') - }) - }) - - it('applies the flash delivery type filter', async () => { - const { fetchMock } = renderOrders(mutateProcedures) - await waitFor(() => expect(screen.getByText('Alice')).toBeVisible()) - - openFilter() - fireEvent.press(checkboxAt(FILTER_INDEX.flash)) - - await waitFor(() => { - const input = lastProcedureInput(fetchMock, 'admin.order.getAll') as Record - expect(input.flashDeliveryFilter).toBe('flash') - }) - }) - - it('saves admin notes through the notes dialog', async () => { - const { fetchMock } = renderOrders(mutateProcedures) - await waitFor(() => expect(screen.getByText('Alice')).toBeVisible()) - - fireEvent.press(screen.getByText('Admin Notes')) - fireEvent.changeText( - screen.getByPlaceholderText('Enter admin notes...'), - 'leave at gate' - ) - fireEvent.press(screen.getByText('Save')) - - await waitFor(() => - expect(lastProcedureInput(fetchMock, 'admin.order.updateNotes')).toEqual({ - orderId: 11, - adminNotes: 'leave at gate', - }) - ) - }) - - it('opens the user notes dialog', async () => { - renderOrders({ - 'admin.order.getAll': { - orders: [makeOrder({ userNotes: 'ring the bell' })], - nextCursor: null, - }, - }) - await waitFor(() => expect(screen.getByText('User Notes')).toBeVisible()) - - fireEvent.press(screen.getByText('User Notes')) - - expect(await screen.findByText('ring the bell')).toBeVisible() - }) - - it('navigates to order details when a row is pressed', async () => { - renderOrders() - await waitFor(() => expect(screen.getByText('Alice')).toBeVisible()) - - fireEvent.press(screen.getByText('Alice')) - - expect(routerMock.push).toHaveBeenCalledWith( - '/(drawer)/dashboard/manage-orders/order-details/11' - ) - }) - - it('opens the options menu and navigates via View Details', async () => { - renderOrders() - await waitFor(() => expect(screen.getByText('Alice')).toBeVisible()) - - const dots = screen.UNSAFE_getAllByType(Entypo)[0] - fireEvent.press(dots) - - expect(await screen.findByText('Select an action to perform')).toBeVisible() - fireEvent.press(screen.getByText('View Details')) - - expect(routerMock.push).toHaveBeenCalledWith( - '/(drawer)/dashboard/manage-orders/order-details/11' - ) - }) - - it('opens the cancel dialog from the options menu', async () => { - renderOrders() - await waitFor(() => expect(screen.getByText('Alice')).toBeVisible()) - - fireEvent.press(screen.UNSAFE_getAllByType(Entypo)[0]) - fireEvent.press(await screen.findByText('Cancel Order')) - - expect(await screen.findByPlaceholderText('Enter reason for cancellation...')).toBeVisible() - }) - - it('loads the next page when the list end is reached', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { - 'admin.slots.getAll': { slots: [], count: 0 }, - 'admin.order.getAll': (input: unknown) => { - const cursor = (input as { cursor?: number } | undefined)?.cursor - if (cursor) { - return { - orders: [makeOrder({ id: 5, orderId: '5', readableId: 5, customerName: 'Fish Order' })], - nextCursor: null, - } - } - return { orders: [makeOrder()], nextCursor: 5 } - }, - }, - }) - - renderWithProviders() - await waitFor(() => expect(screen.getByText('Alice')).toBeVisible()) - - fireEvent(screen.UNSAFE_getByType(FlatList), 'endReached') - - await waitFor(() => expect(screen.getByText('Fish Order')).toBeVisible()) - const input = lastProcedureInput(fetchMock, 'admin.order.getAll') as Record - expect(input.cursor).toBe(5) - }) - - it('falls back to an empty list when the query fails', async () => { - setupApiMocks({ - procedures: { - 'admin.slots.getAll': { slots: [], count: 0 }, - 'admin.order.getAll': () => { - throw new Error('boom') - }, - }, - }) - - renderWithProviders() - - await waitFor(() => expect(screen.queryByText('Loading orders...')).toBeNull()) - expect(screen.queryByText('Alice')).toBeNull() - }) -}) diff --git a/apps/admin-ui/tests/screens/order-details.test.tsx b/apps/admin-ui/tests/screens/order-details.test.tsx deleted file mode 100644 index bf058b2..0000000 --- a/apps/admin-ui/tests/screens/order-details.test.tsx +++ /dev/null @@ -1,235 +0,0 @@ -/** - * Order details (app/(drawer)/dashboard/manage-orders/order-details/[id].tsx) — - * detail rendering, packaging toggles, delivery-charge removal, cancellation - * and navigation. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' - -import OrderDetails from '@/app/(drawer)/dashboard/manage-orders/order-details/[id]' -import { setupApiMocks, resetStorage } from '../mocks/api' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { resetRouterMock, routerMock, searchParamsMock } from '../mocks/router' -import { expectProcedureCalled, lastProcedureInput } from '../mocks/procedures' -import { renderWithProviders } from '../helpers/render' - -const makeDetails = (overrides: Record = {}) => ({ - id: 11, - readableId: 11, - userId: 5, - customerName: 'Alice', - customerEmail: 'alice@example.com', - customerMobile: '9999999999', - address: { - name: 'Alice', - line1: '12 Main St', - line2: null, - city: 'City', - state: 'State', - phone: '9876543210', - }, - slotInfo: { time: '2026-01-02T10:00:00.000Z', sequence: null }, - totalAmount: 500, - deliveryCharge: 20, - adminNotes: 'handle with care', - userNotes: null, - createdAt: '2026-01-01T10:00:00.000Z', - status: 'pending', - isPackaged: false, - isDelivered: false, - items: [ - { - id: 101, - name: 'Chicken', - amount: 200, - isPackaged: false, - isPackageVerified: false, - quantity: '2', - price: '100', - productSize: 1, - unit: 'kg', - }, - ], - cancelReason: null, - cancellationReviewed: false, - couponData: null, - couponCode: null, - couponDescription: null, - discountAmount: 0, - orderStatus: null, - isFlashDelivery: false, - ...overrides, -}) - -const procedures = (overrides: Record = {}) => ({ - 'admin.order.getOrderDetails': makeDetails(), - 'admin.order.updateOrderItemPackaging': { success: true, updated: true }, - 'admin.order.removeDeliveryCharge': { message: 'removed' }, - 'admin.order.cancelOrder': { success: true, message: 'cancelled' }, - 'admin.user.getUserIncidents': { incidents: [] }, - ...overrides, -}) - -const renderDetails = (overrides: Record = {}) => { - const { fetchMock } = setupApiMocks({ procedures: procedures(overrides) }) - renderWithProviders() - return { fetchMock } -} - -describe('Order details', () => { - beforeEach(async () => { - resetStaffAuthMock() - await resetStorage() - resetRouterMock() - searchParamsMock.current = { id: '11' } - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('shows a loading message while the order is pending', () => { - renderDetails() - - expect(screen.getByText('Loading order details...')).toBeVisible() - }) - - it('queries the order with the route id', async () => { - const { fetchMock } = renderDetails() - - await waitFor(() => expect(screen.getByText('#11')).toBeVisible()) - expect(lastProcedureInput(fetchMock, 'admin.order.getOrderDetails')).toEqual({ orderId: 11 }) - }) - - it('renders the order, customer, items and totals', async () => { - renderDetails() - - await waitFor(() => expect(screen.getByText('#11')).toBeVisible()) - expect(screen.getByText('Alice')).toBeVisible() - expect(screen.getByText('9999999999')).toBeVisible() - expect(screen.getByText('Chicken')).toBeVisible() - expect(screen.getByText('Subtotal (1 items)')).toBeVisible() - expect(screen.getByText('handle with care')).toBeVisible() - expect(screen.getByText('Manage Orders')).toBeVisible() - }) - - it('renders an error state with a back action when the order is missing', async () => { - renderDetails({ 'admin.order.getOrderDetails': null }) - - await waitFor(() => expect(screen.getByText('Oops!')).toBeVisible()) - expect(screen.getByText('Failed to load order details')).toBeVisible() - - fireEvent.press(screen.getByText('Go Back')) - expect(routerMock.back).toHaveBeenCalled() - }) - - it('toggles item packaged state', async () => { - const { fetchMock } = renderDetails() - - await waitFor(() => expect(screen.getByText('Chicken')).toBeVisible()) - fireEvent.press(screen.getAllByText('Packaged').pop()!) - - await waitFor(() => - expect(lastProcedureInput(fetchMock, 'admin.order.updateOrderItemPackaging')).toEqual({ - orderItemId: 101, - isPackaged: true, - }) - ) - }) - - it('toggles item verified state', async () => { - const { fetchMock } = renderDetails() - - await waitFor(() => expect(screen.getByText('Chicken')).toBeVisible()) - fireEvent.press(screen.getByText('Pkg Verified')) - - await waitFor(() => - expect(lastProcedureInput(fetchMock, 'admin.order.updateOrderItemPackaging')).toEqual({ - orderItemId: 101, - isPackageVerified: true, - }) - ) - }) - - it('removes the delivery charge after confirmation', async () => { - const { fetchMock } = renderDetails() - - await waitFor(() => expect(screen.getByText('Remove')).toBeVisible()) - fireEvent.press(screen.getByText('Remove')) - - const call = (Alert.alert as jest.Mock).mock.calls.find((c) => c[0] === 'Remove Delivery Cost') - expect(call).toBeTruthy() - const buttons = call![2] as { text: string; onPress?: () => void }[] - - await act(async () => { - buttons.find((b) => b.text === 'Remove')!.onPress?.() - }) - - await waitFor(() => expectProcedureCalled(fetchMock, 'admin.order.removeDeliveryCharge')) - expect(lastProcedureInput(fetchMock, 'admin.order.removeDeliveryCharge')).toEqual({ orderId: 11 }) - }) - - it('opens the cancel order dialog', async () => { - renderDetails() - - await waitFor(() => expect(screen.getByText('Cancel Order')).toBeVisible()) - fireEvent.press(screen.getByText('Cancel Order')) - - expect(await screen.findByPlaceholderText('Enter reason for cancellation...')).toBeVisible() - }) - - it('renders the cancellation reason and hides the cancel button when cancelled', async () => { - renderDetails({ - 'admin.order.getOrderDetails': makeDetails({ - status: 'cancelled', - cancelReason: 'Customer requested', - }), - }) - - await waitFor(() => expect(screen.getByText('Cancellation Reason')).toBeVisible()) - expect(screen.getByText('Customer requested')).toBeVisible() - expect(screen.queryByText('Cancel Order')).toBeNull() - }) - - it('renders the flash delivery notice', async () => { - renderDetails({ - 'admin.order.getOrderDetails': makeDetails({ isFlashDelivery: true }), - }) - - await waitFor(() => expect(screen.getByText('1 Hr Delivery Order')).toBeVisible()) - expect(screen.getByText(/high-priority flash delivery order/)).toBeVisible() - }) - - it('renders the applied coupon block', async () => { - renderDetails({ - 'admin.order.getOrderDetails': makeDetails({ - couponCode: 'SAVE50', - couponDescription: 'Flat ₹50 off', - discountAmount: 50, - }), - }) - - await waitFor(() => expect(screen.getByText('Coupon Applied')).toBeVisible()) - expect(screen.getByText('SAVE50')).toBeVisible() - expect(screen.getAllByText('-₹50').length).toBeGreaterThan(0) - }) - - it('navigates to user management from customer details', async () => { - renderDetails() - - await waitFor(() => expect(screen.getByText('Customer Details')).toBeVisible()) - fireEvent.press(screen.getByText('Customer Details')) - - expect(routerMock.push).toHaveBeenCalledWith('/(drawer)/dashboard/user-management/5') - }) - - it('navigates back to Manage Orders from the bottom bar', async () => { - renderDetails() - - await waitFor(() => expect(screen.getByText('Manage Orders')).toBeVisible()) - fireEvent.press(screen.getByText('Manage Orders')) - - expect(routerMock.push).toHaveBeenCalledWith('/(drawer)/dashboard/manage-orders') - }) -}) diff --git a/apps/admin-ui/tests/screens/prices-overview.test.tsx b/apps/admin-ui/tests/screens/prices-overview.test.tsx deleted file mode 100644 index d8cebd7..0000000 --- a/apps/admin-ui/tests/screens/prices-overview.test.tsx +++ /dev/null @@ -1,317 +0,0 @@ -/** - * Prices overview (app/(drawer)/dashboard/prices-overview/index.tsx) — SKU - * price grid, store filter, edit-dialog validation, flash toggle, the - * updateProductPrices mutation and navigation to rebalance orders. - * - * NOTE: the screen collects SKUs and sends `skuId: sku.id`. The field was renamed from the misleading - * `productId` (product ids and SKU ids overlap, so passing a product id silently repriced another - * product's SKU); the backend now takes `skuId` and reports only rows it actually wrote. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import { Entypo } from '@expo/vector-icons' -import MaterialIcons from '@expo/vector-icons/MaterialIcons' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import PricesOverview from '@/app/(drawer)/dashboard/prices-overview/index' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { - expectProcedureCalled, - lastProcedureInput, - procCount, -} from '../mocks/procedures' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { routerMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const chickenSku = { - id: 11, - productId: 1, - name: 'Chicken 1kg', - displayName: '1 kg pack', - price: '100', - marketPrice: '120', - flashPrice: '90', - isFlashAvailable: false, - images: ['https://cdn.freshyo.in/chicken.jpg'], - features: [{ featureValue: '1kg' }], -} - -const muttonSku = { - id: 22, - productId: 2, - name: 'Mutton 1kg', - displayName: '1 kg pack', - price: '200', - marketPrice: null, - flashPrice: null, - isFlashAvailable: false, - images: [], - features: [], -} - -const product = (id: number, name: string, storeId: number, skus: unknown[]) => ({ - id, - name, - shortDescription: null, - longDescription: null, - storeId, - incrementStep: 1, - productType: 'item', - store: null, - skus, -}) - -const productsResponse = { - products: [ - product(1, 'Chicken', 1, [chickenSku]), - product(2, 'Mutton', 2, [muttonSku]), - ], - count: 2, -} - -const storesResponse = { - stores: [ - { id: 1, name: 'Main Store' }, - { id: 2, name: 'Other Store' }, - ], - count: 2, -} - -const baseProcedures = { - 'admin.product.getProducts': productsResponse, - 'admin.store.getStores': storesResponse, - 'admin.product.updateProductPrices': { - message: 'Updated prices for 1 product(s)', - updatedCount: 1, - }, -} - -const pressLastAlertButton = (label: string) => { - const calls = (Alert.alert as jest.Mock).mock.calls - const call = calls[calls.length - 1] - const buttons = (call?.[2] ?? []) as { text: string; onPress?: () => void }[] - buttons.find((b) => b.text === label)?.onPress?.() -} - -const editIcon = () => - screen.UNSAFE_getAllByType(MaterialIcons).find((i) => i.props.name === 'edit') as - | Parameters[0] - | undefined - -const openEditDialog = () => { - fireEvent.press(editIcon()!) -} - -describe('Prices overview', () => { - beforeEach(async () => { - resetStaffAuthMock() - await resetStorage() - routerMock.push.mockClear() - setupApiMocks({ procedures: baseProcedures }) - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('shows a loading state while products or stores are pending', () => { - setupApiMocks({ - procedures: { - 'admin.product.getProducts': () => new Promise(() => {}), - 'admin.store.getStores': () => new Promise(() => {}), - }, - }) - renderWithProviders() - - expect(screen.getByText('Loading...')).toBeVisible() - }) - - it('renders the SKU price grid', async () => { - renderWithProviders() - - expect(await screen.findByText('Chicken')).toBeVisible() - expect(screen.getByText('Mutton')).toBeVisible() - expect(screen.getByText('₹100')).toBeVisible() - expect(screen.getByText('₹120')).toBeVisible() - expect(screen.getByText('₹90')).toBeVisible() - expect(screen.getByText('1kg')).toBeVisible() - // Mutton has no market/flash price. - expect(screen.getAllByText('N/A')).toHaveLength(2) - expect(screen.getByText('Save (0)')).toBeVisible() - }) - - it('renders without rows when there are no products', async () => { - setupApiMocks({ - procedures: { - ...baseProcedures, - 'admin.product.getProducts': { products: [], count: 0 }, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Save (0)')).toBeVisible()) - expect(screen.queryByText('Chicken')).toBeNull() - }) - - it('filters SKUs by store', async () => { - renderWithProviders() - await screen.findByText('Chicken') - - fireEvent.press(screen.getByText('Main Store, Other Store')) - fireEvent.press(await screen.findByText('Main Store')) - fireEvent.press(screen.getByText('Done')) - - await waitFor(() => expect(screen.queryByText('Chicken')).toBeNull()) - expect(screen.getByText('Mutton')).toBeVisible() - }) - - it('rejects an invalid price in the edit dialog', async () => { - renderWithProviders() - await screen.findByText('Chicken') - - openEditDialog() - fireEvent.changeText(screen.getByPlaceholderText('Enter price'), '0') - fireEvent.press(screen.getByText('Update Price')) - - expect(Alert.alert).toHaveBeenCalledWith('Error', 'Please enter a valid price') - expect(screen.getByText('Save (0)')).toBeVisible() - }) - - it('rejects an invalid market price in the edit dialog', async () => { - renderWithProviders() - await screen.findByText('Chicken') - - openEditDialog() - fireEvent.changeText(screen.getByPlaceholderText('Enter price'), '150') - fireEvent.changeText(screen.getByPlaceholderText('Enter market price'), '0') - fireEvent.press(screen.getByText('Update Price')) - - expect(Alert.alert).toHaveBeenCalledWith( - 'Error', - 'Please enter a valid market price' - ) - }) - - it('rejects an invalid flash price in the edit dialog', async () => { - renderWithProviders() - await screen.findByText('Chicken') - - openEditDialog() - fireEvent.changeText(screen.getByPlaceholderText('Enter price'), '150') - fireEvent.changeText(screen.getByPlaceholderText('Enter flash price'), '0') - fireEvent.press(screen.getByText('Update Price')) - - expect(Alert.alert).toHaveBeenCalledWith( - 'Error', - 'Please enter a valid flash price' - ) - }) - - it('saves an edited price through updateProductPrices', async () => { - const { fetchMock } = setupApiMocks({ procedures: baseProcedures }) - renderWithProviders() - await screen.findByText('Chicken') - - openEditDialog() - fireEvent.changeText(screen.getByPlaceholderText('Enter price'), '150') - fireEvent.press(screen.getByText('Update Price')) - expect(screen.getByText('Save (1)')).toBeVisible() - - fireEvent.press(screen.getByText('Save (1)')) - - await waitFor(() => - expectProcedureCalled(fetchMock, 'admin.product.updateProductPrices') - ) - expect(lastProcedureInput(fetchMock, 'admin.product.updateProductPrices')).toEqual({ - updates: [{ skuId: 11, price: 150 }], - }) - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith('Success', 'Prices updated successfully') - ) - await waitFor(() => - expect(procCount(fetchMock, 'admin.product.getProducts')).toBeGreaterThan(1) - ) - }) - - it('saves the flash-availability toggle through updateProductPrices', async () => { - const { fetchMock } = setupApiMocks({ procedures: baseProcedures }) - renderWithProviders() - await screen.findByText('Chicken') - - fireEvent.press(screen.getAllByRole('checkbox')[0]) - expect(screen.getByText('Save (1)')).toBeVisible() - fireEvent.press(screen.getByText('Save (1)')) - - await waitFor(() => - expectProcedureCalled(fetchMock, 'admin.product.updateProductPrices') - ) - expect(lastProcedureInput(fetchMock, 'admin.product.updateProductPrices')).toEqual({ - updates: [{ skuId: 11, isFlashAvailable: true }], - }) - }) - - it('shows an error alert when the update fails', async () => { - setupApiMocks({ - procedures: { - ...baseProcedures, - 'admin.product.updateProductPrices': () => { - throw new Error('boom') - }, - }, - }) - renderWithProviders() - await screen.findByText('Chicken') - - openEditDialog() - fireEvent.changeText(screen.getByPlaceholderText('Enter price'), '150') - fireEvent.press(screen.getByText('Update Price')) - fireEvent.press(screen.getByText('Save (1)')) - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith( - 'Error', - expect.stringContaining('Failed to update prices') - ) - ) - }) - - it('does not submit while no change was made', async () => { - const { fetchMock } = setupApiMocks({ procedures: baseProcedures }) - renderWithProviders() - await screen.findByText('Chicken') - - fireEvent.press(screen.getByText('Save (0)')) - - expect(procCount(fetchMock, 'admin.product.updateProductPrices')).toBe(0) - }) - - it('navigates to rebalance orders from the options menu', async () => { - renderWithProviders() - await screen.findByText('Chicken') - - const dots = screen.UNSAFE_getAllByType(Entypo)[0] - fireEvent.press(dots) - fireEvent.press(await screen.findByText('Re-Balance Orders')) - - expect(routerMock.push).toHaveBeenCalledWith( - '/(drawer)/dashboard/rebalance-orders' - ) - }) - - it('acknowledges the success alert', async () => { - renderWithProviders() - await screen.findByText('Chicken') - - openEditDialog() - fireEvent.changeText(screen.getByPlaceholderText('Enter price'), '150') - fireEvent.press(screen.getByText('Update Price')) - fireEvent.press(screen.getByText('Save (1)')) - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith('Success', 'Prices updated successfully') - ) - pressLastAlertButton('OK') - expect(routerMock.push).not.toHaveBeenCalled() - }) -}) \ No newline at end of file diff --git a/apps/admin-ui/tests/screens/product-groupings-create.test.tsx b/apps/admin-ui/tests/screens/product-groupings-create.test.tsx deleted file mode 100644 index 38c147a..0000000 --- a/apps/admin-ui/tests/screens/product-groupings-create.test.tsx +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Create product group (app/(drawer)/dashboard/product-groupings/create.tsx) — - * renders ProductGroupForm in create mode and wires onClose/onSuccess to - * router.back(). - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import CreateProductGroup from '@/app/(drawer)/dashboard/product-groupings/create' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { expectProcedureCalled, procCount } from '../mocks/procedures' -import { resetRouterMock, routerMock, searchParamsMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const procedures = { - 'common.product.getAllProductsSummary': { products: [] }, - 'common.product.getAllSkusSummary': { - skus: [{ id: 1, productId: 10, productName: 'Chicken', label: 'Chicken 1kg' }], - }, - 'admin.product.createGroup': { - group: { id: 1, groupName: 'Meat', description: null, createdAt: '2024-01-01' }, - message: 'Group created successfully', - }, -} - -describe('Create product group', () => { - beforeEach(async () => { - await resetStorage() - resetRouterMock() - searchParamsMock.current = {} - setupApiMocks({ procedures }) - jest.spyOn(console, 'error').mockImplementation(() => {}) - }) - - it('renders the create form', () => { - renderWithProviders() - - expect(screen.getByText('Create Product Group')).toBeVisible() - expect(screen.getByPlaceholderText('Enter group name')).toBeVisible() - expect(screen.getByText('Save')).toBeVisible() - }) - - it('does not create a group when the name is empty', async () => { - const { fetchMock } = setupApiMocks({ procedures }) - renderWithProviders() - - fireEvent.press(screen.getByText('Save')) - - expect(await screen.findByText('Group name is required')).toBeVisible() - expect(procCount(fetchMock, 'admin.product.createGroup')).toBe(0) - }) - - it('creates the group then navigates back', async () => { - const { fetchMock } = setupApiMocks({ procedures }) - renderWithProviders() - - fireEvent.changeText(screen.getByPlaceholderText('Enter group name'), 'Meat') - fireEvent.press(screen.getByText('Save')) - - await waitFor(() => expectProcedureCalled(fetchMock, 'admin.product.createGroup')) - await waitFor(() => expect(routerMock.back).toHaveBeenCalled()) - }) - - it('navigates back when cancelled', () => { - renderWithProviders() - - fireEvent.press(screen.getByText('Cancel')) - - expect(routerMock.back).toHaveBeenCalled() - }) -}) \ No newline at end of file diff --git a/apps/admin-ui/tests/screens/product-groupings-edit.test.tsx b/apps/admin-ui/tests/screens/product-groupings-edit.test.tsx deleted file mode 100644 index e97d6a7..0000000 --- a/apps/admin-ui/tests/screens/product-groupings-edit.test.tsx +++ /dev/null @@ -1,98 +0,0 @@ -/** - * Edit product group (app/(drawer)/dashboard/product-groupings/edit/[id].tsx) — - * loads getGroups, finds the group by the route id, and wires the form to - * updateGroup() + router.back(). - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import EditProductGroup from '@/app/(drawer)/dashboard/product-groupings/edit/[id]' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { - expectProcedureCalled, - lastProcedureInput, -} from '../mocks/procedures' -import { resetRouterMock, routerMock, searchParamsMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const group = (overrides: Record = {}) => ({ - id: 5, - groupName: 'Beef Box', - description: 'Bundle', - createdAt: '2024-01-01T00:00:00.000Z', - products: [{ id: 10 }, { id: 11 }], - productCount: 2, - ...overrides, -}) - -const procedures = (groups: unknown[]) => ({ - 'admin.product.getGroups': { groups }, - 'common.product.getAllProductsSummary': { products: [] }, - 'common.product.getAllSkusSummary': { - skus: [ - { id: 1, productId: 10, productName: 'Chicken', label: 'Chicken 1kg' }, - { id: 2, productId: 11, productName: 'Mutton', label: 'Mutton 1kg' }, - ], - }, - 'admin.product.updateGroup': { - group: { id: 5, groupName: 'Beef Combo', description: 'Bundle', createdAt: '2024-01-01' }, - message: 'Group updated successfully', - }, -}) - -describe('Edit product group', () => { - beforeEach(async () => { - await resetStorage() - resetRouterMock() - searchParamsMock.current = { id: '5' } - setupApiMocks({ procedures: procedures([group()]) }) - jest.spyOn(console, 'error').mockImplementation(() => {}) - }) - - it('shows the loading state while groups are pending', () => { - searchParamsMock.current = { id: '5' } - setupApiMocks({ - procedures: { ...procedures([group()]), 'admin.product.getGroups': () => new Promise(() => {}) }, - }) - renderWithProviders() - - expect(screen.getByText('Loading group...')).toBeVisible() - }) - - it('shows a not-found state when the id does not match a group', async () => { - searchParamsMock.current = { id: '99' } - setupApiMocks({ procedures: procedures([group()]) }) - renderWithProviders() - - expect(await screen.findByText('Group not found')).toBeVisible() - }) - - it('renders the edit form seeded with the group', async () => { - renderWithProviders() - - expect(await screen.findByText('Edit Product Group')).toBeVisible() - expect(screen.getByDisplayValue('Beef Box')).toBeVisible() - expect(screen.getByDisplayValue('Bundle')).toBeVisible() - }) - - it('updates the group and navigates back', async () => { - const { fetchMock } = setupApiMocks({ procedures: procedures([group()]) }) - renderWithProviders() - await screen.findByDisplayValue('Beef Box') - - fireEvent.changeText(screen.getByDisplayValue('Beef Box'), 'Beef Combo') - fireEvent.press(screen.getByText('Save')) - - await waitFor(() => expectProcedureCalled(fetchMock, 'admin.product.updateGroup')) - expect(lastProcedureInput(fetchMock, 'admin.product.updateGroup')).toEqual({ - id: 5, - group_name: 'Beef Combo', - description: 'Bundle', - product_ids: [10, 11], - }) - await waitFor(() => expect(routerMock.back).toHaveBeenCalled()) - }) -}) \ No newline at end of file diff --git a/apps/admin-ui/tests/screens/product-groupings-index.test.tsx b/apps/admin-ui/tests/screens/product-groupings-index.test.tsx deleted file mode 100644 index 4863548..0000000 --- a/apps/admin-ui/tests/screens/product-groupings-index.test.tsx +++ /dev/null @@ -1,201 +0,0 @@ -/** - * Product groupings list (app/(drawer)/dashboard/product-groupings/index.tsx) — - * group rows, empty/loading/error states, create/edit navigation, delete via - * the confirm alert and the manual-refresh hooks. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import dayjs from 'dayjs' -import MaterialIcons from '@expo/vector-icons/MaterialIcons' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' - -import ProductGroupings from '@/app/(drawer)/dashboard/product-groupings/index' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { - expectProcedureCalled, - lastProcedureInput, - procCount, -} from '../mocks/procedures' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { resetRouterMock, routerMock, searchParamsMock } from '../mocks/router' -import { refreshHooks, resetRefreshHooks } from '../mocks/refresh' -import { renderWithProviders } from '../helpers/render' - -const group = (overrides: Record = {}) => ({ - id: 1, - groupName: 'Meat Box', - description: 'Protein bundle', - createdAt: '2024-05-01T00:00:00.000Z', - products: [{ id: 10 }, { id: 11 }], - productCount: 2, - ...overrides, -}) - -const groupsResponse = (groups: unknown[]) => ({ groups }) - -const iconByName = (name: string) => - screen.UNSAFE_getAllByType(MaterialIcons).find((i) => i.props.name === name) as - | Parameters[0] - | undefined - -const pressLastAlertButton = (label: string) => { - const calls = (Alert.alert as jest.Mock).mock.calls - const call = calls[calls.length - 1] - const buttons = (call?.[2] ?? []) as { text: string; onPress?: () => void }[] - act(() => buttons.find((b) => b.text === label)?.onPress?.()) -} - -describe('Product groupings list', () => { - beforeEach(async () => { - resetStaffAuthMock() - await resetStorage() - resetRouterMock() - resetRefreshHooks() - searchParamsMock.current = {} - setupApiMocks({ procedures: { 'admin.product.getGroups': groupsResponse([group()]) } }) - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('shows the loading state', () => { - setupApiMocks({ - procedures: { 'admin.product.getGroups': () => new Promise(() => {}) }, - }) - renderWithProviders() - - expect(screen.getByText('Loading product groups...')).toBeVisible() - }) - - it('shows the error state when the query fails', async () => { - const { fetchMock } = setupApiMocks() - fetchMock.mockRejectedValue(new Error('network down')) - renderWithProviders() - - expect(await screen.findByText('Error loading groups')).toBeVisible() - }) - - it('shows the empty state', async () => { - setupApiMocks({ - procedures: { 'admin.product.getGroups': groupsResponse([]) }, - }) - renderWithProviders() - - expect(await screen.findByText('No Groups Yet')).toBeVisible() - expect( - screen.getByText('Start by creating your first product group using the button below.') - ).toBeVisible() - }) - - it('renders a group row with description, product count and date', async () => { - setupApiMocks({ - procedures: { - 'admin.product.getGroups': groupsResponse([ - group(), - group({ id: 2, groupName: 'Fish Box', description: null, productCount: 1 }), - ]), - }, - }) - renderWithProviders() - - expect(await screen.findByText('Meat Box')).toBeVisible() - expect(screen.getByText('Protein bundle')).toBeVisible() - expect(screen.getByText('2 Products')).toBeVisible() - expect(screen.getByText('Fish Box')).toBeVisible() - expect(screen.getByText('1 Products')).toBeVisible() - expect( - screen.getAllByText(dayjs('2024-05-01T00:00:00.000Z').format('MMM DD, YYYY')) - ).toHaveLength(2) - }) - - it('navigates to create from the floating action button', async () => { - renderWithProviders() - await screen.findByText('Meat Box') - - fireEvent.press(iconByName('add')!) - - expect(routerMock.push).toHaveBeenCalledWith( - '/(drawer)/dashboard/product-groupings/create' - ) - }) - - it('navigates to edit for the pressed group', async () => { - renderWithProviders() - await screen.findByText('Meat Box') - - fireEvent.press(iconByName('edit')!) - - expect(routerMock.push).toHaveBeenCalledWith( - '/(drawer)/dashboard/product-groupings/edit/1' - ) - }) - - it('deletes a group after confirming the alert and refetches', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { - 'admin.product.getGroups': groupsResponse([group()]), - 'admin.product.deleteGroup': { message: 'Group deleted successfully' }, - }, - }) - renderWithProviders() - await screen.findByText('Meat Box') - - fireEvent.press(iconByName('delete')!) - - expect(Alert.alert).toHaveBeenCalledWith( - 'Delete Group', - 'Are you sure you want to delete this group?', - expect.any(Array) - ) - pressLastAlertButton('Delete') - - await waitFor(() => - expectProcedureCalled(fetchMock, 'admin.product.deleteGroup') - ) - expect(lastProcedureInput(fetchMock, 'admin.product.deleteGroup')).toEqual({ - id: 1, - }) - await waitFor(() => - expect(procCount(fetchMock, 'admin.product.getGroups')).toBeGreaterThan(1) - ) - }) - - it('does not delete when the alert is cancelled', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { - 'admin.product.getGroups': groupsResponse([group()]), - 'admin.product.deleteGroup': { message: 'Group deleted successfully' }, - }, - }) - renderWithProviders() - await screen.findByText('Meat Box') - - fireEvent.press(iconByName('delete')!) - pressLastAlertButton('Cancel') - - expect(procCount(fetchMock, 'admin.product.deleteGroup')).toBe(0) - }) - - it('refetches through the manual-refresh and mark-data-fetchers hooks', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { 'admin.product.getGroups': groupsResponse([group()]) }, - }) - renderWithProviders() - await screen.findByText('Meat Box') - - const before = procCount(fetchMock, 'admin.product.getGroups') - expect(refreshHooks.manualRefresh).toBeTruthy() - refreshHooks.manualRefresh?.() - await waitFor(() => - expect(procCount(fetchMock, 'admin.product.getGroups')).toBeGreaterThan(before) - ) - - const afterManual = procCount(fetchMock, 'admin.product.getGroups') - expect(refreshHooks.markDataFetchers).toBeTruthy() - refreshHooks.markDataFetchers?.() - await waitFor(() => - expect(procCount(fetchMock, 'admin.product.getGroups')).toBeGreaterThan(afterManual) - ) - }) -}) \ No newline at end of file diff --git a/apps/admin-ui/tests/screens/product-tags-add.test.tsx b/apps/admin-ui/tests/screens/product-tags-add.test.tsx deleted file mode 100644 index 9a90e07..0000000 --- a/apps/admin-ui/tests/screens/product-tags-add.test.tsx +++ /dev/null @@ -1,125 +0,0 @@ -/** - * Add product tag (app/(drawer)/dashboard/product-tags/add.tsx) — creates a tag - * (with optional image upload) then navigates back on success. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' - -import AddTag from '@/app/(drawer)/dashboard/product-tags/add' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { - expectProcedureCalled, - lastProcedureInput, - procCount, -} from '../mocks/procedures' -import { routerMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const storesResponse = { - stores: [{ id: 1, name: 'Main Store' }], - count: 1, -} - -const pressLastAlertButton = (label: string) => { - const calls = (Alert.alert as jest.Mock).mock.calls - const call = calls[calls.length - 1] - const buttons = (call?.[2] ?? []) as { text: string; onPress?: () => void }[] - act(() => buttons.find((b) => b.text === label)?.onPress?.()) -} - -describe('Add product tag', () => { - beforeEach(async () => { - await resetStorage() - setupApiMocks() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('renders the create form', () => { - setupApiMocks({ - procedures: { - 'admin.store.getStores': storesResponse, - 'common.product.getAllSkusSummary': { skus: [] }, - }, - }) - renderWithProviders() - - expect(screen.getByText('Create Tag')).toBeVisible() - }) - - it('creates the tag with the entered values', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.store.getStores': storesResponse, - 'common.product.getAllSkusSummary': { skus: [] }, - 'admin.product.createProductTag': { - tag: { id: 3, tagName: 'Featured' }, - message: 'Tag created successfully', - }, - 'admin.product.getProductTags': { tags: [], message: 'ok' }, - }, - }) - renderWithProviders() - - fireEvent.changeText(screen.getByPlaceholderText('Enter tag name'), 'Featured') - fireEvent.press(screen.getByText('Create Tag')) - - await waitFor(() => - expectProcedureCalled(api.fetchMock, 'admin.product.createProductTag') - ) - expect(lastProcedureInput(api.fetchMock, 'admin.product.createProductTag')).toMatchObject({ - tagName: 'Featured', - isDashboardTag: false, - relatedStores: [], - productIds: [], - uploadUrls: [], - }) - }) - - it('navigates back after the success alert is acknowledged', async () => { - setupApiMocks({ - procedures: { - 'admin.store.getStores': storesResponse, - 'common.product.getAllSkusSummary': { skus: [] }, - 'admin.product.createProductTag': { - tag: { id: 3, tagName: 'Featured' }, - message: 'Tag created successfully', - }, - 'admin.product.getProductTags': { tags: [], message: 'ok' }, - }, - }) - renderWithProviders() - - fireEvent.changeText(screen.getByPlaceholderText('Enter tag name'), 'Featured') - fireEvent.press(screen.getByText('Create Tag')) - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith( - 'Success', - 'Tag created successfully', - expect.any(Array) - ) - ) - pressLastAlertButton('OK') - expect(routerMock.back).toHaveBeenCalled() - }) - - it('does not create the tag when the name is empty', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.store.getStores': storesResponse, - 'common.product.getAllSkusSummary': { skus: [] }, - }, - }) - renderWithProviders() - - fireEvent.press(screen.getByText('Create Tag')) - - await waitFor(() => - expect(procCount(api.fetchMock, 'admin.product.createProductTag')).toBe(0) - ) - }) -}) diff --git a/apps/admin-ui/tests/screens/product-tags-edit.test.tsx b/apps/admin-ui/tests/screens/product-tags-edit.test.tsx deleted file mode 100644 index f8ce6f5..0000000 --- a/apps/admin-ui/tests/screens/product-tags-edit.test.tsx +++ /dev/null @@ -1,226 +0,0 @@ -/** - * Edit product tag (app/(drawer)/dashboard/product-tags/edit/index.tsx) — - * loads the tag by route param, seeds TagForm, and updates it. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' - -import EditTag from '@/app/(drawer)/dashboard/product-tags/edit/index' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { - expectProcedureCalled, - lastProcedureInput, - procCount, -} from '../mocks/procedures' -import { routerMock, searchParamsMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const tag = { - id: 7, - tagName: 'Bestsellers', - tagDescription: 'Top picks', - imageUrl: null, - isDashboardTag: true, - relatedStores: [1], - sortOrder: [11, 10], - createdAt: '2024-01-01T00:00:00.000Z', - products: [ - { productId: 10, tagId: 7, assignedAt: '2024-01-01T00:00:00.000Z', product: {} }, - { productId: 11, tagId: 7, assignedAt: '2024-01-01T00:00:00.000Z', product: {} }, - ], - productIds: [10, 11], -} - -const storesResponse = { stores: [{ id: 1, name: 'Main Store' }], count: 1 } -const skusResponse = { - skus: [ - { id: 1, productId: 10, productName: 'Chicken', label: 'Chicken 1kg' }, - { id: 2, productId: 11, productName: 'Mutton', label: 'Mutton 1kg' }, - ], -} - -const pressLastAlertButton = (label: string) => { - const calls = (Alert.alert as jest.Mock).mock.calls - const call = calls[calls.length - 1] - const buttons = (call?.[2] ?? []) as { text: string; onPress?: () => void }[] - act(() => buttons.find((b) => b.text === label)?.onPress?.()) -} - -describe('Edit product tag', () => { - beforeEach(async () => { - await resetStorage() - searchParamsMock.current = { tagId: '7' } - setupApiMocks() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('shows the loading state while the tag is fetched', () => { - setupApiMocks({ - procedures: { - 'admin.product.getProductTagById': () => new Promise(() => {}), - }, - }) - renderWithProviders() - - expect(screen.getByText('Loading tag...')).toBeVisible() - }) - - it('shows "Tag not found" when the query errors', async () => { - setupApiMocks({ - procedures: { - 'admin.product.getProductTagById': () => { - throw new Error('404') - }, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Tag not found')).toBeVisible()) - }) - - it('seeds the form from the fetched tag', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.product.getProductTagById': { tag, message: 'ok' }, - 'admin.store.getStores': storesResponse, - 'common.product.getAllSkusSummary': skusResponse, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByDisplayValue('Bestsellers')).toBeVisible()) - expect(screen.getByDisplayValue('Top picks')).toBeVisible() - expect(screen.getByText('Update Tag')).toBeVisible() - expect(lastProcedureInput(api.fetchMock, 'admin.product.getProductTagById')).toEqual({ id: 7 }) - }) - - it('orders the seeded products by sortOrder', async () => { - setupApiMocks({ - procedures: { - 'admin.product.getProductTagById': { tag, message: 'ok' }, - 'admin.store.getStores': storesResponse, - 'common.product.getAllSkusSummary': skusResponse, - }, - }) - renderWithProviders() - - // sortOrder [11, 10] puts Mutton (product 11) before Chicken (product 10). - await waitFor(() => expect(screen.getByText('Mutton 1kg')).toBeVisible()) - expect(screen.getByText('Chicken 1kg')).toBeVisible() - }) - - it('updates the tag with the expected payload', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.product.getProductTagById': { tag, message: 'ok' }, - 'admin.store.getStores': storesResponse, - 'common.product.getAllSkusSummary': skusResponse, - 'admin.product.updateProductTag': { tag: { id: 7 }, message: 'Tag updated successfully' }, - 'admin.product.getProductTags': { tags: [], message: 'ok' }, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByDisplayValue('Bestsellers')).toBeVisible()) - fireEvent.press(screen.getByText('Update Tag')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'admin.product.updateProductTag')) - expect(lastProcedureInput(api.fetchMock, 'admin.product.updateProductTag')).toMatchObject({ - id: 7, - tagName: 'Bestsellers', - isDashboardTag: true, - relatedStores: [1], - productIds: [11, 10], - }) - }) - - it('navigates back after the success alert is acknowledged', async () => { - setupApiMocks({ - procedures: { - 'admin.product.getProductTagById': { tag, message: 'ok' }, - 'admin.store.getStores': storesResponse, - 'common.product.getAllSkusSummary': skusResponse, - 'admin.product.updateProductTag': { tag: { id: 7 }, message: 'Tag updated successfully' }, - 'admin.product.getProductTags': { tags: [], message: 'ok' }, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByDisplayValue('Bestsellers')).toBeVisible()) - fireEvent.press(screen.getByText('Update Tag')) - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith( - 'Success', - 'Tag updated successfully', - expect.any(Array) - ) - ) - pressLastAlertButton('OK') - expect(routerMock.back).toHaveBeenCalled() - }) - - it('refetches the tag list after a successful update', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.product.getProductTagById': { tag, message: 'ok' }, - 'admin.store.getStores': storesResponse, - 'common.product.getAllSkusSummary': skusResponse, - 'admin.product.updateProductTag': { tag: { id: 7 }, message: 'Tag updated successfully' }, - 'admin.product.getProductTags': { tags: [], message: 'ok' }, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByDisplayValue('Bestsellers')).toBeVisible()) - const before = procCount(api.fetchMock, 'admin.product.getProductTags') - fireEvent.press(screen.getByText('Update Tag')) - - await waitFor(() => - expect(procCount(api.fetchMock, 'admin.product.getProductTags')).toBeGreaterThan(before) - ) - }) - - it('refetches the tag by id after a successful update', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.product.getProductTagById': { tag, message: 'ok' }, - 'admin.store.getStores': storesResponse, - 'common.product.getAllSkusSummary': skusResponse, - 'admin.product.updateProductTag': { tag: { id: 7 }, message: 'Tag updated successfully' }, - 'admin.product.getProductTags': { tags: [], message: 'ok' }, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByDisplayValue('Bestsellers')).toBeVisible()) - const before = procCount(api.fetchMock, 'admin.product.getProductTagById') - expect(before).toBeGreaterThan(0) - fireEvent.press(screen.getByText('Update Tag')) - - await waitFor(() => - expect(procCount(api.fetchMock, 'admin.product.getProductTagById')).toBeGreaterThan(before) - ) - }) - - it('shows the updating label while the mutation is pending', async () => { - setupApiMocks({ - procedures: { - 'admin.product.getProductTagById': { tag, message: 'ok' }, - 'admin.store.getStores': storesResponse, - 'common.product.getAllSkusSummary': skusResponse, - 'admin.product.updateProductTag': () => new Promise(() => {}), - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByDisplayValue('Bestsellers')).toBeVisible()) - fireEvent.press(screen.getByText('Update Tag')) - - await waitFor(() => expect(screen.getByText('Updating...')).toBeVisible()) - }) -}) diff --git a/apps/admin-ui/tests/screens/product-tags-index.test.tsx b/apps/admin-ui/tests/screens/product-tags-index.test.tsx deleted file mode 100644 index 6aa0a43..0000000 --- a/apps/admin-ui/tests/screens/product-tags-index.test.tsx +++ /dev/null @@ -1,141 +0,0 @@ -/** - * Product tags list (app/(drawer)/dashboard/product-tags/index.tsx) — list, - * dashboard-tag badge, empty/error states, navigation and delete via TagMenu. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import ProductTags from '@/app/(drawer)/dashboard/product-tags/index' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { procCount } from '../mocks/procedures' -import { routerMock } from '../mocks/router' -import { refreshHooks, resetRefreshHooks } from '../mocks/refresh' -import { renderWithProviders } from '../helpers/render' - -const tag = (overrides: Record = {}) => ({ - id: 1, - tagName: 'Bestsellers', - tagDescription: 'Top picks', - imageUrl: null, - isDashboardTag: true, - relatedStores: [], - createdAt: '2024-01-01T00:00:00.000Z', - ...overrides, -}) - -const tagsResponse = (tags: unknown[]) => ({ tags, message: 'ok' }) - -describe('Product tags list', () => { - beforeEach(async () => { - resetRefreshHooks() - await resetStorage() - setupApiMocks() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('shows the loading state while the query is pending', () => { - setupApiMocks({ - procedures: { 'admin.product.getProductTags': () => new Promise(() => {}) }, - }) - renderWithProviders() - - expect(screen.getByText('Loading tags...')).toBeVisible() - }) - - it('renders the tags with the dashboard badge', async () => { - setupApiMocks({ - procedures: { - 'admin.product.getProductTags': tagsResponse([ - tag(), - tag({ id: 2, tagName: 'New', tagDescription: null, isDashboardTag: false }), - ]), - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Bestsellers')).toBeVisible()) - expect(screen.getByText('New')).toBeVisible() - expect(screen.getByText('Top picks')).toBeVisible() - expect(screen.getByText('Dashboard Tag')).toBeVisible() - }) - - it('shows the empty state', async () => { - setupApiMocks({ - procedures: { 'admin.product.getProductTags': tagsResponse([]) }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('No tags yet')).toBeVisible()) - }) - - it('shows the error state and retries', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.product.getProductTags': () => { - throw new Error('boom') - }, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Error')).toBeVisible()) - const before = procCount(api.fetchMock, 'admin.product.getProductTags') - fireEvent.press(screen.getByText('Retry')) - - await waitFor(() => - expect(procCount(api.fetchMock, 'admin.product.getProductTags')).toBeGreaterThan(before) - ) - }) - - it('navigates to add and order screens', async () => { - setupApiMocks({ - procedures: { 'admin.product.getProductTags': tagsResponse([tag()]) }, - }) - renderWithProviders() - await waitFor(() => expect(screen.getByText('Bestsellers')).toBeVisible()) - - fireEvent.press(screen.getByText('Add New Tag')) - expect(routerMock.push).toHaveBeenCalledWith('/(drawer)/dashboard/product-tags/add') - - fireEvent.press(screen.getByText('Tag Orders')) - expect(routerMock.push).toHaveBeenCalledWith('/(drawer)/dashboard/product-tags/order') - }) - - it('renders a TagMenu per row that opens the tag options', async () => { - setupApiMocks({ - procedures: { 'admin.product.getProductTags': tagsResponse([tag()]) }, - }) - const { UNSAFE_getAllByType } = renderWithProviders() - await waitFor(() => expect(screen.getByText('Bestsellers')).toBeVisible()) - - const TouchableOpacity = require('react-native').TouchableOpacity - // One trigger per rendered tag row. - expect(UNSAFE_getAllByType(TouchableOpacity).length).toBeGreaterThan(0) - }) - - it('refetches through the manual-refresh and mark-data-fetchers hooks', async () => { - const api = setupApiMocks({ - procedures: { 'admin.product.getProductTags': tagsResponse([tag()]) }, - }) - renderWithProviders() - await waitFor(() => expect(screen.getByText('Bestsellers')).toBeVisible()) - - const before = procCount(api.fetchMock, 'admin.product.getProductTags') - expect(refreshHooks.manualRefresh).toBeTruthy() - refreshHooks.manualRefresh?.() - await waitFor(() => - expect(procCount(api.fetchMock, 'admin.product.getProductTags')).toBeGreaterThan(before) - ) - - const afterManual = procCount(api.fetchMock, 'admin.product.getProductTags') - expect(refreshHooks.markDataFetchers).toBeTruthy() - refreshHooks.markDataFetchers?.() - await waitFor(() => - expect(procCount(api.fetchMock, 'admin.product.getProductTags')).toBeGreaterThan(afterManual) - ) - }) -}) diff --git a/apps/admin-ui/tests/screens/product-tags-order.test.tsx b/apps/admin-ui/tests/screens/product-tags-order.test.tsx deleted file mode 100644 index 08a49d9..0000000 --- a/apps/admin-ui/tests/screens/product-tags-order.test.tsx +++ /dev/null @@ -1,231 +0,0 @@ -/** - * Tag orders (app/(drawer)/dashboard/product-tags/order.tsx) — orders tags by - * the `tagsOrder` constant, supports save via updateConstants and shows - * loading/empty/error states. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' - -import TagOrders from '@/app/(drawer)/dashboard/product-tags/order' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { - expectProcedureCalled, - lastProcedureInput, - procCount, -} from '../mocks/procedures' -import { routerMock, searchParamsMock } from '../mocks/router' -import { createQueryClient, renderWithProviders } from '../helpers/render' - -const tagsResponse = { - tags: [ - { id: 1, tagName: 'Chicken Tag', tagDescription: null, imageUrl: null, isDashboardTag: false, relatedStores: [], createdAt: '2024-01-01T00:00:00.000Z' }, - { id: 2, tagName: 'Mutton Tag', tagDescription: null, imageUrl: null, isDashboardTag: false, relatedStores: [], createdAt: '2024-01-01T00:00:00.000Z' }, - ], - message: 'ok', -} - -describe('Tag orders', () => { - beforeEach(async () => { - await resetStorage() - searchParamsMock.current = {} - setupApiMocks() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('shows the loading state while constants load', () => { - setupApiMocks({ - procedures: { - 'admin.region.getRegionConstants': () => new Promise(() => {}), - 'admin.product.getProductTags': tagsResponse, - }, - }) - renderWithProviders() - - expect(screen.getByText('Loading order...')).toBeVisible() - }) - - it('shows the error state when the constants query fails', async () => { - setupApiMocks({ - procedures: { - 'admin.region.getRegionConstants': () => { - throw new Error('boom') - }, - 'admin.product.getProductTags': tagsResponse, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Failed to load order')).toBeVisible()) - }) - - it('orders the tags by the tagsOrder constant', async () => { - setupApiMocks({ - procedures: { - 'admin.region.getRegionConstants': [{ key: 'tagsOrder', value: [2, 1] }], - 'admin.product.getProductTags': tagsResponse, - }, - }) - const result = renderWithProviders() - - await waitFor(() => expect(screen.getByText('Mutton Tag')).toBeVisible()) - - const list = result.UNSAFE_getByType( - require('react-native-draggable-flatlist').default - ) - expect(list.props.data.map((t: { id: number }) => t.id)).toEqual([2, 1]) - expect(screen.getByText(/2 items/)).toBeVisible() - }) - - it('appends tags missing from the order and accepts comma lists', async () => { - setupApiMocks({ - procedures: { - 'admin.region.getRegionConstants': [{ key: 'tagsOrder', value: '2' }], - 'admin.product.getProductTags': tagsResponse, - }, - }) - const result = renderWithProviders() - - await waitFor(() => expect(screen.getByText('Mutton Tag')).toBeVisible()) - const list = result.UNSAFE_getByType( - require('react-native-draggable-flatlist').default - ) - expect(list.props.data.map((t: { id: number }) => t.id)).toEqual([2, 1]) - }) - - it('shows the empty state when there are no tags', async () => { - setupApiMocks({ - procedures: { - 'admin.region.getRegionConstants': [{ key: 'tagsOrder', value: [] }], - 'admin.product.getProductTags': { tags: [], message: 'ok' }, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('No tags available')).toBeVisible()) - }) - - it('disables Save until the order changes, then saves', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.region.getRegionConstants': [{ key: 'tagsOrder', value: [1, 2] }], - 'admin.product.getProductTags': tagsResponse, - 'admin.region.updateRegionConstants': { success: true, updatedCount: 1, keys: ['tagsOrder'] }, - }, - }) - const result = renderWithProviders() - - await waitFor(() => expect(screen.getByText('Chicken Tag')).toBeVisible()) - - // Save is disabled before any drag. - fireEvent.press(screen.getByText('Save')) - expect(procCount(api.fetchMock, 'admin.region.updateRegionConstants')).toBe(0) - - // Reorder and save. - const list = result.UNSAFE_getByType( - require('react-native-draggable-flatlist').default - ) - act(() => { - list.props.onDragEnd({ data: [list.props.data[1], list.props.data[0]] }) - }) - await waitFor(() => expect(screen.getByText('Save')).toBeVisible()) - - fireEvent.press(screen.getByText('Save')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'admin.region.updateRegionConstants')) - expect(lastProcedureInput(api.fetchMock, 'admin.region.updateRegionConstants')).toEqual({ - constants: [{ key: 'tagsOrder', value: [2, 1] }], - }) - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith('Success', 'Tag order updated successfully!') - ) - expect(routerMock.back).not.toHaveBeenCalled() - }) - - it('refetches the constants after saving', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.region.getRegionConstants': [{ key: 'tagsOrder', value: [1, 2] }], - 'admin.product.getProductTags': tagsResponse, - 'admin.region.updateRegionConstants': { success: true, updatedCount: 1, keys: ['tagsOrder'] }, - }, - }) - const client = createQueryClient() - const invalidateSpy = jest.spyOn(client, 'invalidateQueries') - const result = renderWithProviders(, { queryClient: client }) - - await waitFor(() => expect(screen.getByText('Chicken Tag')).toBeVisible()) - const before = procCount(api.fetchMock, 'admin.region.getRegionConstants') - // Delta, not an absolute: the suite shares one httpBatchLink client, so a prior test's - // request can land in this test's fetchMock. - expect(before).toBeGreaterThan(0) - - const list = result.UNSAFE_getByType( - require('react-native-draggable-flatlist').default - ) - act(() => { - list.props.onDragEnd({ data: [list.props.data[1], list.props.data[0]] }) - }) - fireEvent.press(screen.getByText('Save')) - - await waitFor(() => - expect(procCount(api.fetchMock, 'admin.region.getRegionConstants')).toBeGreaterThan(before) - ) - // The refetch is driven by the path-based invalidation, not by updateConstants itself. - // Asserting the ARRAY path is the point: the old dotted string matched no query at all. - await waitFor(() => expect(invalidateSpy).toHaveBeenCalled()) - expect( - invalidateSpy.mock.calls - .map((call) => (call[0] as { queryKey?: unknown[] } | undefined)?.queryKey) - .map((key) => (Array.isArray(key) ? key[0] : null)) - ).toContainEqual(['admin', 'const', 'getConstants']) - // Same client, same cache: the array path matches the live query, the dotted form matches none. - expect( - client.getQueryCache().findAll({ queryKey: [['admin', 'const', 'getConstants']] }).length - ).toBeGreaterThan(0) - expect( - client.getQueryCache().findAll({ queryKey: ['admin.region.getRegionConstants'] }) - ).toHaveLength(0) - }) - - it('shows the saving label while the update is pending', async () => { - setupApiMocks({ - procedures: { - 'admin.region.getRegionConstants': [{ key: 'tagsOrder', value: [1, 2] }], - 'admin.product.getProductTags': tagsResponse, - 'admin.region.updateRegionConstants': () => new Promise(() => {}), - }, - }) - const result = renderWithProviders() - - await waitFor(() => expect(screen.getByText('Chicken Tag')).toBeVisible()) - const list = result.UNSAFE_getByType( - require('react-native-draggable-flatlist').default - ) - act(() => { - list.props.onDragEnd({ data: [list.props.data[1], list.props.data[0]] }) - }) - - fireEvent.press(screen.getByText('Save')) - await waitFor(() => expect(screen.getByText('Saving...')).toBeVisible()) - }) - - it('goes back from the header and the error state', async () => { - setupApiMocks({ - procedures: { - 'admin.region.getRegionConstants': () => { - throw new Error('boom') - }, - 'admin.product.getProductTags': tagsResponse, - }, - }) - renderWithProviders() - await waitFor(() => expect(screen.getByText('Failed to load order')).toBeVisible()) - - fireEvent.press(screen.getByText('Go Back')) - expect(routerMock.back).toHaveBeenCalled() - }) -}) diff --git a/apps/admin-ui/tests/screens/products-add.test.tsx b/apps/admin-ui/tests/screens/products-add.test.tsx deleted file mode 100644 index 7a6255b..0000000 --- a/apps/admin-ui/tests/screens/products-add.test.tsx +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Add product (app/(drawer)/dashboard/products/add.tsx) — create-mode screen. - * - * KNOWN APP BUG (src/components/ProductForm.tsx:80): `variantSignature` calls - * `a.featureValue.trim()` unguarded. The create form starts every variant with - * an empty `quantity` value, so any keystroke / variant add makes Yup throw - * `TypeError: Cannot read properties of undefined (reading 'trim')`, - * `validateForm()` never resolves, and the form cannot be submitted. This - * screen therefore can only be asserted for render/loading; the submit payload - * is covered against ProductForm with valid seeded values (see - * tests/components/product-form.test.tsx). See the final report. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import { fireEvent, screen } from '@testing-library/react-native' - -import AddProduct from '@/app/(drawer)/dashboard/products/add' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { procCount } from '../mocks/procedures' -import { searchParamsMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -describe('Add product', () => { - beforeEach(async () => { - await resetStorage() - searchParamsMock.current = {} - setupApiMocks() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('renders the create form with a single seeded variant', () => { - renderWithProviders() - - expect(screen.getByText('Create Product')).toBeVisible() - expect(screen.getByTestId('product-name-input')).toBeVisible() - expect(screen.getByTestId('variant-0-price')).toBeVisible() - expect(screen.getByTestId('variant-0-attr-0-name').props.value).toBe('quantity') - expect(screen.queryByTestId('variant-1-price')).toBeNull() - }) - - it('starts the form empty', () => { - renderWithProviders() - - expect(screen.getByTestId('product-name-input').props.value).toBe('') - expect(screen.getByTestId('variant-0-price').props.value).toBe('') - expect(screen.getByTestId('variant-0-attr-0-value').props.value).toBe('') - }) - - it('does not call createProduct on mount', () => { - const api = setupApiMocks() - renderWithProviders() - - expect(procCount(api.fetchMock, 'admin.product.createProduct')).toBe(0) - }) -}) diff --git a/apps/admin-ui/tests/screens/products-detail.test.tsx b/apps/admin-ui/tests/screens/products-detail.test.tsx deleted file mode 100644 index 0c2c4d9..0000000 --- a/apps/admin-ui/tests/screens/products-detail.test.tsx +++ /dev/null @@ -1,273 +0,0 @@ -/** - * Product detail (app/(drawer)/dashboard/products/detail/[id].tsx) — product - * fetch, variants/deals/reviews render, empty reviews, edit/back navigation and - * the respondToReview flow. - * - * HARNESS GAP: tests/mocks/router.ts `expoRouterMock()` (admin-ui) does not - * expose a `Stack`/`Tabs` primitive, but this screen renders - * ``. Without a stub the render - * hangs indefinitely. We spread the harness mock and add a `Stack.Screen` - * no-op locally (the harness file itself is untouched). See the final report. - */ - -jest.mock('expo-router', () => { - const base = require('../mocks/router').expoRouterMock() - return { - ...base, - Stack: Object.assign(() => null, { Screen: () => null }), - } -}) - -import React from 'react' -import { Alert } from 'react-native' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' - -import ProductDetail from '@/app/(drawer)/dashboard/products/detail/[id]' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { - expectProcedureCalled, - lastProcedureInput, - procCount, -} from '../mocks/procedures' -import { routerMock, searchParamsMock } from '../mocks/router' -import { refreshHooks, resetRefreshHooks } from '../mocks/refresh' -import { renderWithProviders } from '../helpers/render' - -const product = { - id: 5, - name: 'Chicken Breast', - shortDescription: 'Boneless', - longDescription: 'Farm fresh boneless breast', - incrementStep: 1, - skus: [ - { - id: 51, - price: '215', - marketPrice: '220', - flashPrice: '199', - isFlashAvailable: true, - isOutOfStock: false, - images: ['https://assets.test/p/1.png'], - features: [{ id: 1, featureName: 'quantity', featureValue: '0.5 kg' }], - }, - ], - deals: [ - { quantity: 3, price: 600, validTill: '2099-01-01T00:00:00.000Z' }, - ], -} - -const review = { - id: 91, - userName: 'Asha', - ratings: 5, - reviewBody: 'Great meat', - imageUrls: [], - signedImageUrls: [], - adminResponse: null, - adminResponseImages: [], - signedAdminImageUrls: [], -} - -const reviewsResponse = (reviews: unknown[]) => ({ reviews, hasMore: false }) - -describe('Product detail', () => { - beforeEach(async () => { - resetRefreshHooks() - await resetStorage() - searchParamsMock.current = { id: '5' } - setupApiMocks() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('shows the loading state while the product is fetched', () => { - setupApiMocks({ - procedures: { 'admin.product.getProductById': () => new Promise(() => {}) }, - }) - renderWithProviders() - - expect(screen.getByText('Loading...')).toBeVisible() - }) - - it('shows Product Not Found when the query errors', async () => { - setupApiMocks({ - procedures: { - 'admin.product.getProductById': () => { - throw new Error('404') - }, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Product Not Found')).toBeVisible()) - }) - - it('renders the product, variants, deals and reviews', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.product.getProductById': { product }, - 'admin.product.getProductReviews': reviewsResponse([review]), - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Chicken Breast')).toBeVisible()) - expect(screen.getByText('Boneless')).toBeVisible() - expect(screen.getByText('1 Variant')).toBeVisible() - expect(screen.getByText('₹215')).toBeVisible() - expect(screen.getByText('₹220')).toBeVisible() - expect(screen.getByText('0.5 kg')).toBeVisible() - expect(screen.getByText('Special Deals')).toBeVisible() - expect(screen.getByText('Buy 3')).toBeVisible() - expect(screen.getByText('Great meat')).toBeVisible() - expect(screen.getByText('Asha')).toBeVisible() - - await waitFor(() => - expect(lastProcedureInput(api.fetchMock, 'admin.product.getProductById')).toEqual({ id: 5 }) - ) - await waitFor(() => - expect(lastProcedureInput(api.fetchMock, 'admin.product.getProductReviews')).toMatchObject({ - productId: 5, - }) - ) - }) - - it('shows the no-reviews state', async () => { - setupApiMocks({ - procedures: { - 'admin.product.getProductById': { product }, - 'admin.product.getProductReviews': reviewsResponse([]), - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('No reviews yet')).toBeVisible()) - }) - - it('shows an existing admin response', async () => { - setupApiMocks({ - procedures: { - 'admin.product.getProductById': { product }, - 'admin.product.getProductReviews': reviewsResponse([ - { ...review, adminResponse: 'Thanks for the feedback!' }, - ]), - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Admin Response')).toBeVisible()) - expect(screen.getByText('Thanks for the feedback!')).toBeVisible() - expect(screen.queryByText('Reply')).toBeNull() - }) - - it('navigates to edit and back', async () => { - setupApiMocks({ - procedures: { - 'admin.product.getProductById': { product }, - 'admin.product.getProductReviews': reviewsResponse([]), - }, - }) - renderWithProviders() - await waitFor(() => expect(screen.getByText('Chicken Breast')).toBeVisible()) - - fireEvent.press(screen.getByText('Edit')) - expect(routerMock.push).toHaveBeenCalledWith('/(drawer)/dashboard/products/edit?id=5') - }) - - it('goes back from the error state', async () => { - setupApiMocks({ - procedures: { - 'admin.product.getProductById': () => { - throw new Error('404') - }, - }, - }) - renderWithProviders() - await waitFor(() => expect(screen.getByText('Product Not Found')).toBeVisible()) - - fireEvent.press(screen.getByText('Go Back')) - expect(routerMock.back).toHaveBeenCalled() - }) - - it('opens the reply dialog and submits a review response', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.product.getProductById': { product }, - 'admin.product.getProductReviews': reviewsResponse([review]), - 'admin.product.respondToReview': { success: true, review: { id: 91 } }, - }, - }) - renderWithProviders() - await waitFor(() => expect(screen.getByText('Great meat')).toBeVisible()) - - fireEvent.press(screen.getByText('Reply')) - - // The reply form opens inside a bottom dialog; its placeholder identifies it. - const input = await screen.findByPlaceholderText('Write your response here...') - fireEvent.changeText(input, 'Thank you!') - act(() => { - fireEvent.press(screen.getByText('Submit Response')) - }) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'admin.product.respondToReview')) - expect(lastProcedureInput(api.fetchMock, 'admin.product.respondToReview')).toMatchObject({ - reviewId: 91, - adminResponse: 'Thank you!', - adminResponseImages: [], - }) - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith('Success', 'Response submitted') - ) - }) - - it('refetches the reviews after a review response is submitted', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.product.getProductById': { product }, - 'admin.product.getProductReviews': reviewsResponse([review]), - 'admin.product.respondToReview': { success: true, review: { id: 91 } }, - }, - }) - renderWithProviders() - - // The mounted reviews query (fed by `reviewsResponse([review])`) has loaded. - await waitFor(() => expect(screen.getByText('Great meat')).toBeVisible()) - const before = procCount(api.fetchMock, 'admin.product.getProductReviews') - - fireEvent.press(screen.getByText('Reply')) - const input = await screen.findByPlaceholderText('Write your response here...') - fireEvent.changeText(input, 'Thank you!') - - // Opening the dialog and typing do not refetch the reviews, so any increase - // below can only come from the submit handler invalidating the query. - expect(procCount(api.fetchMock, 'admin.product.getProductReviews')).toBe(before) - - act(() => { - fireEvent.press(screen.getByText('Submit Response')) - }) - - // Submitting invalidates admin.product.getProductReviews, which refetches - // the mounted reviews query this screen renders. - await waitFor(() => - expect(procCount(api.fetchMock, 'admin.product.getProductReviews')).toBeGreaterThan(before) - ) - }) - - it('refetches the product through useMarkDataFetchers', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.product.getProductById': { product }, - 'admin.product.getProductReviews': reviewsResponse([]), - }, - }) - renderWithProviders() - await waitFor(() => expect(screen.getByText('Chicken Breast')).toBeVisible()) - - const before = procCount(api.fetchMock, 'admin.product.getProductById') - expect(refreshHooks.markDataFetchers).toBeTruthy() - refreshHooks.markDataFetchers?.() - - await waitFor(() => - expect(procCount(api.fetchMock, 'admin.product.getProductById')).toBeGreaterThan(before) - ) - }) -}) diff --git a/apps/admin-ui/tests/screens/products-edit.test.tsx b/apps/admin-ui/tests/screens/products-edit.test.tsx deleted file mode 100644 index bb95e4f..0000000 --- a/apps/admin-ui/tests/screens/products-edit.test.tsx +++ /dev/null @@ -1,216 +0,0 @@ -/** - * Edit product (app/(drawer)/dashboard/products/edit.tsx) — loads a product by - * route id, seeds ProductForm, loads/refetches, validation and the - * updateProduct payload. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import EditProduct from '@/app/(drawer)/dashboard/products/edit' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { - expectProcedureCalled, - lastProcedureInput, - procCount, -} from '../mocks/procedures' -import { searchParamsMock } from '../mocks/router' -import { refreshHooks, resetRefreshHooks } from '../mocks/refresh' -import { renderWithProviders } from '../helpers/render' - -const product = { - id: 7, - name: 'Chicken', - shortDescription: 'Fresh', - longDescription: 'Very fresh', - storeId: 1, - productType: 'item', - incrementStep: 1, - skus: [ - { - id: 71, - name: null, - price: '250', - marketPrice: '300', - flashPrice: null, - isFlashAvailable: false, - isOffer: false, - isComboOnly: false, - isDeleted: false, - isSuspended: false, - images: ['https://assets.test/p/1.png'], - imageKeys: ['product-images/1.png'], - features: [{ id: 1, featureName: 'quantity', featureValue: '1 kg' }], - comboItems: [], - }, - ], -} - -const updateResponse = { product: { id: 7 }, message: 'Product updated successfully' } -const listResponse = { products: [], count: 0 } - -describe('Edit product', () => { - beforeEach(async () => { - resetRefreshHooks() - await resetStorage() - searchParamsMock.current = { id: '7' } - setupApiMocks() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('shows the loading state while the product is fetched', () => { - setupApiMocks({ - procedures: { - 'admin.product.getProductById': () => new Promise(() => {}), - }, - }) - renderWithProviders() - - expect(screen.getByText('Loading product...')).toBeVisible() - }) - - it('shows "Product not found" when the query resolves without a product', async () => { - setupApiMocks({ - procedures: { 'admin.product.getProductById': { product: null } }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Product not found')).toBeVisible()) - }) - - it('seeds the form from the fetched product', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.product.getProductById': { product }, - 'common.getStoresSummary': { stores: [{ id: 1, name: 'Main Store' }] }, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByTestId('product-name-input').props.value).toBe('Chicken')) - expect(screen.getByTestId('variant-0-price').props.value).toBe('250') - expect(screen.getByTestId('variant-0-attr-0-value').props.value).toBe('1 kg') - expect(screen.getByText('Save Changes')).toBeVisible() - - await waitFor(() => - expect(lastProcedureInput(api.fetchMock, 'admin.product.getProductById')).toEqual({ id: 7 }) - ) - }) - - it('routes the product id from the URL params', async () => { - searchParamsMock.current = { id: '42' } - const api = setupApiMocks({ - procedures: { - 'admin.product.getProductById': { product: { ...product, id: 42 } }, - 'common.getStoresSummary': { stores: [] }, - }, - }) - renderWithProviders() - - await waitFor(() => - expect(lastProcedureInput(api.fetchMock, 'admin.product.getProductById')).toEqual({ id: 42 }) - ) - }) - - it('updates the product with the expected payload', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.product.getProductById': { product }, - 'admin.product.updateProduct': updateResponse, - 'admin.product.getProducts': listResponse, - 'common.getStoresSummary': { stores: [{ id: 1, name: 'Main Store' }] }, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByTestId('product-name-input').props.value).toBe('Chicken')) - fireEvent.press(screen.getByTestId('create-product-button')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'admin.product.updateProduct')) - - expect(lastProcedureInput(api.fetchMock, 'admin.product.updateProduct')).toMatchObject({ - id: 7, - name: 'Chicken', - storeId: 1, - productType: 'item', - skus: [ - expect.objectContaining({ - id: 71, - price: 250, - marketPrice: 300, - features: [{ featureName: 'quantity', featureValue: '1 kg' }], - }), - ], - }) - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith('Success', 'Product updated successfully!') - ) - }) - - it('refetches the product and list after a successful update', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.product.getProductById': { product }, - 'admin.product.updateProduct': updateResponse, - 'admin.product.getProducts': listResponse, - 'common.getStoresSummary': { stores: [{ id: 1, name: 'Main Store' }] }, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByTestId('product-name-input').props.value).toBe('Chicken')) - - const productBefore = procCount(api.fetchMock, 'admin.product.getProductById') - const listBefore = procCount(api.fetchMock, 'admin.product.getProducts') - - fireEvent.press(screen.getByTestId('create-product-button')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'admin.product.updateProduct')) - await waitFor(() => - expect(procCount(api.fetchMock, 'admin.product.getProductById')).toBeGreaterThan(productBefore) - ) - await waitFor(() => - expect(procCount(api.fetchMock, 'admin.product.getProducts')).toBeGreaterThan(listBefore) - ) - }) - - it('refetches through useManualRefresh', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.product.getProductById': { product }, - 'common.getStoresSummary': { stores: [{ id: 1, name: 'Main Store' }] }, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByTestId('product-name-input').props.value).toBe('Chicken')) - - const before = procCount(api.fetchMock, 'admin.product.getProductById') - expect(refreshHooks.manualRefresh).toBeTruthy() - refreshHooks.manualRefresh?.() - - await waitFor(() => - expect(procCount(api.fetchMock, 'admin.product.getProductById')).toBeGreaterThan(before) - ) - }) - - it('shows the saving label while the update is pending', async () => { - setupApiMocks({ - procedures: { - 'admin.product.getProductById': { product }, - 'admin.product.updateProduct': () => new Promise(() => {}), - 'common.getStoresSummary': { stores: [{ id: 1, name: 'Main Store' }] }, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByTestId('product-name-input').props.value).toBe('Chicken')) - fireEvent.press(screen.getByTestId('create-product-button')) - - await waitFor(() => expect(screen.getByText('Saving...')).toBeVisible()) - }) -}) diff --git a/apps/admin-ui/tests/screens/products-index.test.tsx b/apps/admin-ui/tests/screens/products-index.test.tsx deleted file mode 100644 index 3fd1063..0000000 --- a/apps/admin-ui/tests/screens/products-index.test.tsx +++ /dev/null @@ -1,252 +0,0 @@ -/** - * Products list (app/(drawer)/dashboard/products/index.tsx) — list, search, - * stock filters, stock toggle, empty/error states and navigation. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import Toast from 'react-native-toast-message' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import Products from '@/app/(drawer)/dashboard/products/index' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { - expectProcedureCalled, - lastProcedureInput, - procCount, -} from '../mocks/procedures' -import { routerMock } from '../mocks/router' -import { refreshHooks, resetRefreshHooks } from '../mocks/refresh' -import { renderWithProviders } from '../helpers/render' - -const chicken = { - id: 1, - name: 'Chicken', - shortDescription: 'Fresh farm chicken', - skus: [ - { - id: 11, - price: '200', - images: ['https://assets.test/p/1.png'], - isOutOfStock: false, - }, - ], -} - -const mutton = { - id: 2, - name: 'Mutton', - shortDescription: 'Tender goat meat', - skus: [ - { - id: 22, - price: '500', - images: [], - isOutOfStock: true, - }, - ], -} - -const listResponse = (products: unknown[]) => ({ products, count: products.length }) - -describe('Products list', () => { - beforeEach(async () => { - resetRefreshHooks() - await resetStorage() - setupApiMocks() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('renders each product with its variant count and stock state', async () => { - setupApiMocks({ - procedures: { 'admin.product.getProducts': listResponse([chicken, mutton]) }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Chicken')).toBeVisible()) - expect(screen.getByText('Mutton')).toBeVisible() - expect(screen.getAllByText('1 Variants')).toHaveLength(2) - // Stock labels: chicken shows In, mutton shows Out (plus the toggle button - // label "Out" on the in-stock chicken row). - expect(screen.getByText('In')).toBeVisible() - expect(screen.getAllByText('Out').length).toBeGreaterThan(0) - }) - - it('shows the loading state while the query is pending', async () => { - setupApiMocks({ - procedures: { 'admin.product.getProducts': () => new Promise(() => {}) }, - }) - renderWithProviders() - - expect(screen.getByText('Loading products...')).toBeVisible() - }) - - it('shows the empty state when there are no products', async () => { - setupApiMocks({ - procedures: { 'admin.product.getProducts': listResponse([]) }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('No products found')).toBeVisible()) - expect(screen.getByText('Start by adding your first product')).toBeVisible() - }) - - it('shows the error state and refetches on Retry', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.product.getProducts': () => { - throw new Error('boom') - }, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Error loading products')).toBeVisible()) - - const before = procCount(api.fetchMock, 'admin.product.getProducts') - fireEvent.press(screen.getByText('Retry')) - - await waitFor(() => - expect(procCount(api.fetchMock, 'admin.product.getProducts')).toBeGreaterThan(before) - ) - }) - - it('filters products by search term', async () => { - setupApiMocks({ - procedures: { 'admin.product.getProducts': listResponse([chicken, mutton]) }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Chicken')).toBeVisible()) - - fireEvent.changeText(screen.getByPlaceholderText('Search products...'), 'mutton') - - expect(screen.getByText('Mutton')).toBeVisible() - expect(screen.queryByText('Chicken')).toBeNull() - }) - - it('filters by stock and clears the filters from the empty state', async () => { - setupApiMocks({ - procedures: { 'admin.product.getProducts': listResponse([chicken, mutton]) }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Chicken')).toBeVisible()) - expect(screen.getByText('All (2)')).toBeVisible() - expect(screen.getByText('In Stock (1)')).toBeVisible() - expect(screen.getByText('Out of Stock (1)')).toBeVisible() - - fireEvent.press(screen.getByText('In Stock (1)')) - expect(screen.getByText('Chicken')).toBeVisible() - expect(screen.queryByText('Mutton')).toBeNull() - - fireEvent.press(screen.getByText('Out of Stock (1)')) - expect(screen.getByText('Mutton')).toBeVisible() - expect(screen.queryByText('Chicken')).toBeNull() - - fireEvent.changeText(screen.getByPlaceholderText('Search products...'), 'nothing') - expect(screen.getByText('No products match your filters')).toBeVisible() - - fireEvent.press(screen.getByText('Clear Filters')) - expect(screen.getByText('Chicken')).toBeVisible() - expect(screen.getByText('Mutton')).toBeVisible() - }) - - it('navigates to add, edit and detail', async () => { - setupApiMocks({ - procedures: { 'admin.product.getProducts': listResponse([chicken, mutton]) }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Chicken')).toBeVisible()) - - fireEvent.press(screen.getByTestId('add-product-button')) - expect(routerMock.push).toHaveBeenCalledWith('/(drawer)/dashboard/products/add') - - fireEvent.press(screen.getAllByText('View')[0]) - expect(routerMock.push).toHaveBeenCalledWith('/(drawer)/dashboard/products/detail/1') - - fireEvent.press(screen.getAllByText('Edit')[0]) - expect(routerMock.push).toHaveBeenCalledWith('/(drawer)/dashboard/products/edit?id=1') - }) - - it('toggles an in-stock product out of stock and refetches', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.product.getProducts': listResponse([mutton]), - 'admin.product.toggleOutOfStock': { - productId: 2, - isOutOfStock: false, - message: 'Product marked as in stock', - }, - }, - }) - renderWithProviders() - - // mutton is out of stock, so its toggle button offers "Stock". - await waitFor(() => expect(screen.getByText('Mutton')).toBeVisible()) - - const before = procCount(api.fetchMock, 'admin.product.getProducts') - fireEvent.press(screen.getByText('Stock')) - - await waitFor(() => - expectProcedureCalled(api.fetchMock, 'admin.product.toggleOutOfStock') - ) - expect(lastProcedureInput(api.fetchMock, 'admin.product.toggleOutOfStock')).toEqual({ - id: 2, - }) - await waitFor(() => - expect(procCount(api.fetchMock, 'admin.product.getProducts')).toBeGreaterThan(before) - ) - }) - - it('shows the success toast after toggling stock', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.product.getProducts': listResponse([mutton]), - 'admin.product.toggleOutOfStock': { - productId: 2, - isOutOfStock: false, - message: 'Product marked as in stock', - }, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Mutton')).toBeVisible()) - fireEvent.press(screen.getByText('Stock')) - - await waitFor(() => - expect(Toast.show).toHaveBeenCalledWith( - expect.objectContaining({ text1: 'Product marked as in stock' }) - ) - ) - expect(expectProcedureCalled(api.fetchMock, 'admin.product.toggleOutOfStock')).toHaveLength(1) - }) - - it('refetches through the manual-refresh and mark-data-fetchers hooks', async () => { - const api = setupApiMocks({ - procedures: { 'admin.product.getProducts': listResponse([chicken]) }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Chicken')).toBeVisible()) - - const before = procCount(api.fetchMock, 'admin.product.getProducts') - - expect(refreshHooks.manualRefresh).toBeTruthy() - refreshHooks.manualRefresh?.() - await waitFor(() => - expect(procCount(api.fetchMock, 'admin.product.getProducts')).toBeGreaterThan(before) - ) - - const afterManual = procCount(api.fetchMock, 'admin.product.getProducts') - expect(refreshHooks.markDataFetchers).toBeTruthy() - refreshHooks.markDataFetchers?.() - await waitFor(() => - expect(procCount(api.fetchMock, 'admin.product.getProducts')).toBeGreaterThan(afterManual) - ) - }) -}) diff --git a/apps/admin-ui/tests/screens/rebalance-orders.test.tsx b/apps/admin-ui/tests/screens/rebalance-orders.test.tsx deleted file mode 100644 index c738760..0000000 --- a/apps/admin-ui/tests/screens/rebalance-orders.test.tsx +++ /dev/null @@ -1,188 +0,0 @@ -/** - * Rebalance orders (app/(drawer)/dashboard/rebalance-orders/index.tsx) — - * upcoming-slot list, past-slot filtering, selection, the rebalanceSlots - * mutation and the +N-more product dialog. - */ - -import React from 'react' -import { Alert } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import RebalanceOrders from '@/app/(drawer)/dashboard/rebalance-orders/index' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { - expectProcedureCalled, - lastProcedureInput, - procCount, -} from '../mocks/procedures' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { renderWithProviders } from '../helpers/render' - -const futureSlot = (overrides: Record = {}) => ({ - id: 1, - deliveryTime: '2099-01-01T10:00:00.000Z', - freezeTime: '2099-01-01T09:00:00.000Z', - isActive: true, - products: [ - { id: 10, name: 'Chicken' }, - { id: 11, name: 'Mutton' }, - { id: 12, name: 'Fish' }, - ], - ...overrides, -}) - -const slotsResult = (slots: unknown[]) => ({ slots, count: slots.length }) - -describe('Rebalance orders', () => { - beforeEach(async () => { - resetStaffAuthMock() - await resetStorage() - setupApiMocks() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('shows the loading state while slots are pending', () => { - setupApiMocks({ - procedures: { 'admin.slots.getAll': () => new Promise(() => {}) }, - }) - renderWithProviders() - - expect(screen.getByText('Loading slots...')).toBeVisible() - }) - - it('renders an upcoming slot row with products and status', async () => { - setupApiMocks({ - procedures: { 'admin.slots.getAll': slotsResult([futureSlot()]) }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Slot #1')).toBeVisible()) - expect(screen.getByText('Active')).toBeVisible() - // Only the first two product names are shown. - expect(screen.getByText('Chicken, Mutton')).toBeVisible() - expect(screen.getByText('+1 more')).toBeVisible() - }) - - it('marks an inactive slot as Inactive', async () => { - setupApiMocks({ - procedures: { - 'admin.slots.getAll': slotsResult([futureSlot({ isActive: false })]), - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Inactive')).toBeVisible()) - }) - - it('hides slots whose delivery time has already passed', async () => { - setupApiMocks({ - procedures: { - 'admin.slots.getAll': slotsResult([ - futureSlot({ id: 1, deliveryTime: '2099-01-01T10:00:00.000Z' }), - futureSlot({ id: 2, deliveryTime: '2000-01-01T10:00:00.000Z' }), - ]), - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Slot #1')).toBeVisible()) - expect(screen.queryByText('Slot #2')).toBeNull() - }) - - it('shows the empty state when there are no upcoming slots', async () => { - setupApiMocks({ - procedures: { - 'admin.slots.getAll': slotsResult([ - futureSlot({ deliveryTime: '2000-01-01T10:00:00.000Z' }), - ]), - }, - }) - renderWithProviders() - - expect( - await screen.findByText('No upcoming slots available for rebalancing.') - ).toBeVisible() - }) - - it('does not rebalance while nothing is selected', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { 'admin.slots.getAll': slotsResult([futureSlot()]) }, - }) - renderWithProviders() - await screen.findByText('Slot #1') - - fireEvent.press(screen.getByTestId('mock-linear-gradient')) - - expect(procCount(fetchMock, 'admin.order.rebalanceSlots')).toBe(0) - }) - - it('rebalances the selected slots through rebalanceSlots', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { - 'admin.slots.getAll': slotsResult([futureSlot(), futureSlot({ id: 2 })]), - 'admin.order.rebalanceSlots': { - message: 'Rebalanced', - updatedSlotIds: [1], - }, - }, - }) - renderWithProviders() - await screen.findByText('Slot #1') - - fireEvent.press(screen.getByText('Slot #1')) - fireEvent.press(screen.getByText('Slot #2')) - fireEvent.press(screen.getByTestId('mock-linear-gradient')) - - expect(Alert.alert).toHaveBeenCalledWith( - 'Rebalancing...', - 'Please wait while we rebalance the selected slots.', - [{ text: 'OK' }] - ) - await waitFor(() => - expectProcedureCalled(fetchMock, 'admin.order.rebalanceSlots') - ) - expect(lastProcedureInput(fetchMock, 'admin.order.rebalanceSlots')).toEqual({ - slotIds: [1, 2], - }) - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith( - 'Rebalance Complete', - 'Slots have been rebalanced.' - ) - ) - // onSuccess refetches the slot list. - await waitFor(() => - expect(procCount(fetchMock, 'admin.slots.getAll')).toBeGreaterThan(1) - ) - }) - - it('toggles a slot back off when pressed twice', async () => { - const { fetchMock } = setupApiMocks({ - procedures: { - 'admin.slots.getAll': slotsResult([futureSlot()]), - 'admin.order.rebalanceSlots': { message: 'Rebalanced' }, - }, - }) - renderWithProviders() - await screen.findByText('Slot #1') - - fireEvent.press(screen.getByText('Slot #1')) - fireEvent.press(screen.getByText('Slot #1')) - fireEvent.press(screen.getByTestId('mock-linear-gradient')) - - expect(procCount(fetchMock, 'admin.order.rebalanceSlots')).toBe(0) - }) - - it('opens the full product list from the +N more link', async () => { - setupApiMocks({ - procedures: { 'admin.slots.getAll': slotsResult([futureSlot()]) }, - }) - renderWithProviders() - await screen.findByText('+1 more') - - fireEvent.press(screen.getByText('+1 more')) - - expect(await screen.findByText('All Products')).toBeVisible() - expect(screen.getByText('Fish')).toBeVisible() - }) -}) diff --git a/apps/admin-ui/tests/screens/send-notifications.test.tsx b/apps/admin-ui/tests/screens/send-notifications.test.tsx deleted file mode 100644 index 30a9a48..0000000 --- a/apps/admin-ui/tests/screens/send-notifications.test.tsx +++ /dev/null @@ -1,255 +0,0 @@ -/** - * Send notifications - * (app/(drawer)/dashboard/send-notifications/index.tsx) — eligible-user - * dropdown, the send-to-all confirmation and the sendNotification mutation. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert, TouchableOpacity } from 'react-native' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' -import MaterialIcons from '@expo/vector-icons/MaterialIcons' - -import SendNotifications from '@/app/(drawer)/dashboard/send-notifications/index' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { - expectProcedureCalled, - lastProcedureInput, - procCount, -} from '../mocks/procedures' -import { routerMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const usersResponse = { - users: [ - { id: 1, name: 'Alice', mobile: '9000000001', isEligibleForNotif: true }, - { id: 2, name: 'Bob', mobile: '9000000002', isEligibleForNotif: false }, - ], -} - -const pressLastAlertButton = (label: string) => { - const calls = (Alert.alert as jest.Mock).mock.calls - const call = calls[calls.length - 1] - const buttons = (call?.[2] ?? []) as { text: string; onPress?: () => void }[] - act(() => buttons.find((b) => b.text === label)?.onPress?.()) -} - -const fillMessage = (title = 'Hello', message = 'World') => { - fireEvent.changeText(screen.getByPlaceholderText('Enter notification title...'), title) - fireEvent.changeText(screen.getByPlaceholderText('Enter notification message...'), message) -} - -describe('Send notifications', () => { - beforeEach(async () => { - await resetStorage() - setupApiMocks() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('shows the loading state while users load', () => { - setupApiMocks({ - procedures: { 'admin.user.getUsersForNotification': () => new Promise(() => {}) }, - }) - renderWithProviders() - - expect(screen.getByText('Loading users...')).toBeVisible() - }) - - it('renders the form and loads eligible users only', async () => { - setupApiMocks({ - procedures: { 'admin.user.getUsersForNotification': usersResponse }, - }) - renderWithProviders() - - expect(await screen.findByText('Send Notifications')).toBeVisible() - expect(screen.getByPlaceholderText('Enter notification title...')).toBeVisible() - expect(screen.getByPlaceholderText('Enter notification message...')).toBeVisible() - expect(screen.getByText('All Users')).toBeVisible() - - fireEvent.press(screen.getByText('Select users')) - expect(await screen.findByText('9000000001 - Alice')).toBeVisible() - expect(screen.queryByText('9000000002 - Bob')).toBeNull() - }) - - it('keeps the send button disabled until both fields are filled', async () => { - setupApiMocks({ - procedures: { 'admin.user.getUsersForNotification': usersResponse }, - }) - const result = renderWithProviders() - - await screen.findByText('Send to All Users') - const sendDisabled = () => - result.UNSAFE_getAllByType(TouchableOpacity).at(-1)?.props.disabled - expect(sendDisabled()).toBe(true) - - fillMessage() - await waitFor(() => expect(sendDisabled()).toBe(false)) - }) - - it('confirms and sends to all users when none are selected', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.user.getUsersForNotification': usersResponse, - 'admin.user.sendNotification': { success: true, message: 'queued' }, - }, - }) - renderWithProviders() - - await screen.findByText('Send to All Users') - fillMessage(' Hello ', ' World ') - fireEvent.press(screen.getByText('Send to All Users')) - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith( - 'Send to All Users?', - expect.any(String), - expect.any(Array) - ) - ) - pressLastAlertButton('Send') - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'admin.user.sendNotification')) - expect(lastProcedureInput(api.fetchMock, 'admin.user.sendNotification')).toEqual({ - userIds: [], - title: 'Hello', - text: 'World', - }) - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith('Success', 'Notification sent successfully!') - ) - }) - - it('cancels the send-to-all confirmation without mutating', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.user.getUsersForNotification': usersResponse, - 'admin.user.sendNotification': { success: true, message: 'queued' }, - }, - }) - renderWithProviders() - - await screen.findByText('Send to All Users') - fillMessage() - fireEvent.press(screen.getByText('Send to All Users')) - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith( - 'Send to All Users?', - expect.any(String), - expect.any(Array) - ) - ) - pressLastAlertButton('Cancel') - - expect(procCount(api.fetchMock, 'admin.user.sendNotification')).toBe(0) - }) - - it('sends to the selected user without a confirmation', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.user.getUsersForNotification': usersResponse, - 'admin.user.sendNotification': { success: true, message: 'queued' }, - }, - }) - renderWithProviders() - - await screen.findByText('Send to All Users') - fireEvent.press(screen.getByText('Select users')) - fireEvent.press(await screen.findByText('9000000001 - Alice')) - fireEvent.press(screen.getByText('Done')) - - // Once a user is picked the button switches label. - await waitFor(() => expect(screen.getByText('Send Notification')).toBeVisible()) - fillMessage() - fireEvent.press(screen.getByText('Send Notification')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'admin.user.sendNotification')) - expect(lastProcedureInput(api.fetchMock, 'admin.user.sendNotification')).toEqual({ - userIds: [1], - title: 'Hello', - text: 'World', - }) - }) - - it('shows an error alert when the mutation fails', async () => { - setupApiMocks({ - procedures: { - 'admin.user.getUsersForNotification': usersResponse, - 'admin.user.sendNotification': () => { - throw new Error('nope') - }, - }, - }) - renderWithProviders() - - await screen.findByText('Send to All Users') - fireEvent.press(screen.getByText('Select users')) - fireEvent.press(await screen.findByText('9000000001 - Alice')) - fireEvent.press(screen.getByText('Done')) - await waitFor(() => expect(screen.getByText('Send Notification')).toBeVisible()) - - fillMessage() - fireEvent.press(screen.getByText('Send Notification')) - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith('Error', expect.any(String)) - ) - }) - - it('shows the sending label while the mutation is pending', async () => { - setupApiMocks({ - procedures: { - 'admin.user.getUsersForNotification': usersResponse, - 'admin.user.sendNotification': () => new Promise(() => {}), - }, - }) - renderWithProviders() - - await screen.findByText('Send to All Users') - fireEvent.press(screen.getByText('Select users')) - fireEvent.press(await screen.findByText('9000000001 - Alice')) - fireEvent.press(screen.getByText('Done')) - await waitFor(() => expect(screen.getByText('Send Notification')).toBeVisible()) - - fillMessage() - fireEvent.press(screen.getByText('Send Notification')) - - await waitFor(() => expect(screen.getByText('Sending...')).toBeVisible()) - }) - - it('refetches users with the debounced search query', async () => { - const api = setupApiMocks({ - procedures: { 'admin.user.getUsersForNotification': usersResponse }, - }) - renderWithProviders() - - await screen.findByText('Send to All Users') - fireEvent.press(screen.getByText('Select users')) - fireEvent.changeText(screen.getByTestId('undefined-search'), 'ali') - - act(() => { - jest.advanceTimersByTime(2000) - }) - - await waitFor(() => - expect(lastProcedureInput(api.fetchMock, 'admin.user.getUsersForNotification')).toEqual({ - search: 'ali', - }) - ) - }) - - it('goes back from the header', async () => { - setupApiMocks({ - procedures: { 'admin.user.getUsersForNotification': usersResponse }, - }) - const result = renderWithProviders() - - await screen.findByText('Send Notifications') - const backIcon = result.UNSAFE_getAllByType(MaterialIcons).find( - (node) => node.props.name === 'chevron-left' - )! - fireEvent.press(backIcon) - - expect(routerMock.back).toHaveBeenCalled() - }) -}) diff --git a/apps/admin-ui/tests/screens/slot-details.test.tsx b/apps/admin-ui/tests/screens/slot-details.test.tsx deleted file mode 100644 index ce10ff0..0000000 --- a/apps/admin-ui/tests/screens/slot-details.test.tsx +++ /dev/null @@ -1,154 +0,0 @@ -/** - * Slot details screen (app/(drawer)/dashboard/slots/slot-details.tsx) — - * loading/error states, snippet + product rendering, share and navigation. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert, Share } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import SlotDetails from '@/app/(drawer)/dashboard/slots/slot-details' -import { setupApiMocks, resetStorage } from '../mocks/api' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { expectProcedureCalled, lastProcedureInput } from '../mocks/procedures' -import { routerMock, searchParamsMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const slot = { - id: 7, - deliveryTime: '2026-10-01T10:00:00.000Z', - freezeTime: '2026-10-01T06:00:00.000Z', - isActive: true, - isCapacityFull: false, - groupIds: [2], - products: [ - { id: 11, name: 'Chicken' }, - { id: 12, name: 'Mutton' }, - { id: 13, name: 'Fish', shortDescription: 'Fresh catch' }, - ], - vendorSnippets: [ - { - id: 100, - snippetCode: 'SNIP-AAA', - slotId: 7, - skuIds: [11, 13], - isPermanent: false, - validTill: '2030-01-01T00:00:00.000Z', - createdAt: '2026-09-01T00:00:00.000Z', - accessUrl: 'https://app.freshyo.in/vendor-order-list?id=SNIP-AAA', - }, - ], -} - -const procedures = { - 'admin.slots.getSlotById': { slot }, -} - -describe('Slot details', () => { - beforeEach(async () => { - resetStaffAuthMock() - await resetStorage() - searchParamsMock.current = { slotId: '7' } - setupApiMocks({ procedures }) - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - jest.spyOn(Share, 'share').mockResolvedValue({ action: 'sharedAction' } as any) - routerMock.push.mockClear() - }) - - it('shows a loader while fetching', () => { - const { fetchMock } = setupApiMocks({ procedures }) - fetchMock.mockImplementation(() => new Promise(() => {})) - - renderWithProviders() - - expect(screen.getByText('Loading slot details...')).toBeVisible() - }) - - it('shows an error state when the slot is missing', async () => { - setupApiMocks({ procedures: { 'admin.slots.getSlotById': null } }) - - renderWithProviders() - - expect(await screen.findByText('Error loading slot details')).toBeVisible() - }) - - it('renders slot header, products and snippets', async () => { - const { fetchMock } = setupApiMocks({ procedures }) - - renderWithProviders() - - expect(await screen.findByText('Slot #7')).toBeVisible() - expect(lastProcedureInput(fetchMock, 'admin.slots.getSlotById')).toEqual({ id: 7 }) - - expect(screen.getByText('3 items')).toBeVisible() - expect(screen.getByText('Chicken')).toBeVisible() - expect(screen.getByText('Mutton')).toBeVisible() - expect(screen.getByText('Fish')).toBeVisible() - - expect(screen.getByText('1 snippets')).toBeVisible() - expect(screen.getByText('SNIP-AAA')).toBeVisible() - expect(screen.getByText('2 products')).toBeVisible() - expect(screen.getByText('Share')).toBeVisible() - }) - - it('renders empty states when there are no snippets or products', async () => { - setupApiMocks({ - procedures: { - 'admin.slots.getSlotById': { - slot: { ...slot, products: [], vendorSnippets: [] }, - }, - }, - }) - - renderWithProviders() - - expect(await screen.findByText('No vendor snippets for this slot')).toBeVisible() - expect(screen.getByText('No products in this slot')).toBeVisible() - }) - - it('opens the snippet products dialog with only the snippet skus', async () => { - setupApiMocks({ procedures }) - - renderWithProviders() - await screen.findByText('Slot #7') - - expect(screen.queryByText('Snippet Products')).toBeNull() - fireEvent.press(screen.getByText('2 products')) - - expect(await screen.findByText('Snippet Products')).toBeVisible() - expect(screen.getByText('Fresh catch')).toBeVisible() - expect(screen.getAllByText('Chicken').length).toBe(2) - expect(screen.getAllByText('Fish').length).toBe(2) - expect(screen.getAllByText('Mutton').length).toBe(1) - }) - - it('shares the snippet access url', async () => { - setupApiMocks({ procedures }) - - renderWithProviders() - await screen.findByText('Slot #7') - - fireEvent.press(screen.getByText('Share')) - - await waitFor(() => - expect(Share.share).toHaveBeenCalledWith({ - message: 'https://app.freshyo.in/vendor-order-list?id=SNIP-AAA', - }) - ) - }) - - it('navigates to the edit screen from the FAB', async () => { - setupApiMocks({ procedures }) - - renderWithProviders() - await screen.findByText('Slot #7') - - fireEvent.press(screen.getByTestId('edit-slot-fab')) - - expect(routerMock.push).toHaveBeenCalledWith( - '/(drawer)/dashboard/slots/edit/7' - ) - }) -}) diff --git a/apps/admin-ui/tests/screens/slots-add.test.tsx b/apps/admin-ui/tests/screens/slots-add.test.tsx deleted file mode 100644 index c2f488f..0000000 --- a/apps/admin-ui/tests/screens/slots-add.test.tsx +++ /dev/null @@ -1,127 +0,0 @@ -/** - * Add slot screen (app/(drawer)/dashboard/slots/add.tsx) — base-slot prefill, - * loading, and the create -> back integration. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -jest.mock('common-ui/src/components/date-time-picker', () => { - const React = require('react') - const { View, TouchableOpacity, Text } = require('react-native') - const FIXED = new Date('2026-10-01T10:00:00.000Z') - return { - __esModule: true, - default: ({ setValue, dateTestID, timeTestID }: any) => - React.createElement( - View, - null, - React.createElement( - TouchableOpacity, - { testID: dateTestID, onPress: () => setValue(FIXED) }, - React.createElement(Text, null, 'pick-date') - ), - React.createElement( - TouchableOpacity, - { testID: timeTestID, onPress: () => setValue(FIXED) }, - React.createElement(Text, null, 'pick-time') - ) - ), - } -}) - -import React from 'react' -import { Alert } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import AddSlot from '@/app/(drawer)/dashboard/slots/add' -import { setupApiMocks, resetStorage } from '../mocks/api' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { expectProcedureCalled, lastProcedureInput, procCount } from '../mocks/procedures' -import { routerMock, searchParamsMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const procedures = { - 'admin.slots.getAll': { slots: [], count: 0 }, - 'admin.slots.createSlot': { - slot: { id: 10 }, - createdSnippets: [], - message: 'Slot created successfully', - }, - 'admin.slots.getSlotById': { - slot: { - id: 5, - deliveryTime: '2026-09-30T10:00:00.000Z', - freezeTime: '2026-09-30T06:00:00.000Z', - isActive: true, - isCapacityFull: false, - products: [{ id: 11, name: 'Chicken' }], - groupIds: [3], - vendorSnippets: [], - }, - }, -} - -describe('Add slot', () => { - beforeEach(async () => { - resetStaffAuthMock() - await resetStorage() - searchParamsMock.current = {} - setupApiMocks({ procedures }) - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - routerMock.push.mockClear() - routerMock.back.mockClear() - }) - - it('renders an empty create form and does not load a base slot', async () => { - const { fetchMock } = setupApiMocks({ procedures }) - - renderWithProviders() - - expect(await screen.findByText('Create New Slot')).toBeVisible() - await waitFor(() => expectProcedureCalled(fetchMock, 'admin.slots.getAll')) - expect(procCount(fetchMock, 'admin.slots.getSlotById')).toBe(0) - }) - - it('shows a loader while the base slot is loading', () => { - searchParamsMock.current = { baseslot: '5' } - const { fetchMock } = setupApiMocks({ procedures }) - const original = fetchMock.getMockImplementation()! - fetchMock.mockImplementation((url: any, options: any) => - String(url).includes('admin.slots.getSlotById') - ? new Promise(() => {}) - : original(url, options) - ) - - renderWithProviders() - - expect(screen.getByText('Loading base slot...')).toBeVisible() - }) - - it('prefills from the base slot and goes back after creating', async () => { - searchParamsMock.current = { baseslot: '5' } - const { fetchMock } = setupApiMocks({ procedures }) - - renderWithProviders() - - expect(await screen.findByText('Create New Slot')).toBeVisible() - expectProcedureCalled(fetchMock, 'admin.slots.getSlotById') - expect(lastProcedureInput(fetchMock, 'admin.slots.getSlotById')).toEqual({ - id: 5, - }) - - fireEvent.press(screen.getByTestId('delivery-date-picker')) - fireEvent.press(screen.getByTestId('freeze-date-picker')) - fireEvent.press(screen.getByTestId('create-slot-button')) - - await waitFor(() => expectProcedureCalled(fetchMock, 'admin.slots.createSlot')) - - expect(lastProcedureInput(fetchMock, 'admin.slots.createSlot')).toMatchObject({ - skuIds: [11], - groupIds: [3], - }) - await waitFor(() => expect(routerMock.back).toHaveBeenCalled()) - await waitFor(() => - expect(procCount(fetchMock, 'admin.slots.getAll')).toBeGreaterThan(1) - ) - }) -}) diff --git a/apps/admin-ui/tests/screens/slots-edit.test.tsx b/apps/admin-ui/tests/screens/slots-edit.test.tsx deleted file mode 100644 index 5f852ba..0000000 --- a/apps/admin-ui/tests/screens/slots-edit.test.tsx +++ /dev/null @@ -1,110 +0,0 @@ -/** - * Edit slot screen (app/(drawer)/dashboard/slots/edit/[id].tsx) — prefill, - * not-found/loading states and the update -> back flow. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import EditSlot from '@/app/(drawer)/dashboard/slots/edit/[id]' -import { setupApiMocks, resetStorage } from '../mocks/api' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { expectProcedureCalled, lastProcedureInput } from '../mocks/procedures' -import { routerMock, searchParamsMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const slot = { - id: 7, - deliveryTime: '2026-10-01T10:00:00.000Z', - freezeTime: '2026-10-01T06:00:00.000Z', - isActive: true, - isCapacityFull: false, - products: [{ id: 11, name: 'Chicken' }], - groupIds: [2], - vendorSnippets: [], -} - -const procedures = { - 'admin.slots.getSlotById': { slot }, - 'admin.slots.updateSlot': { - slot: { id: 7 }, - createdSnippets: [], - message: 'Slot updated successfully', - }, -} - -describe('Edit slot', () => { - beforeEach(async () => { - resetStaffAuthMock() - await resetStorage() - searchParamsMock.current = { id: '7' } - setupApiMocks({ procedures }) - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - routerMock.back.mockClear() - }) - - it('shows a loader while the slot is loading', () => { - const { fetchMock } = setupApiMocks({ procedures }) - fetchMock.mockImplementation(() => new Promise(() => {})) - - renderWithProviders() - - expect(screen.getByText('Loading slot...')).toBeVisible() - }) - - it('shows not-found when the slot does not exist', async () => { - setupApiMocks({ procedures: { 'admin.slots.getSlotById': null } }) - - renderWithProviders() - - expect(await screen.findByText('Slot not found')).toBeVisible() - }) - - it('submits the update and navigates back on success', async () => { - const { fetchMock } = setupApiMocks({ procedures }) - - renderWithProviders() - - expect(await screen.findByText('Edit Slot')).toBeVisible() - - fireEvent.press(screen.getByTestId('create-slot-button')) - - await waitFor(() => - expectProcedureCalled(fetchMock, 'admin.slots.updateSlot') - ) - - expect(lastProcedureInput(fetchMock, 'admin.slots.updateSlot')).toEqual({ - id: 7, - deliveryTime: '2026-10-01T10:00:00.000Z', - freezeTime: '2026-10-01T06:00:00.000Z', - isActive: true, - groupIds: [2], - skuIds: [11], - vendorSnippets: [], - }) - await waitFor(() => expect(routerMock.back).toHaveBeenCalled()) - expect(Alert.alert).toHaveBeenCalledWith('Success', 'Slot updated successfully!') - }) - - it('surfaces an update error', async () => { - const { fetchMock } = setupApiMocks({ procedures }) - const original = fetchMock.getMockImplementation()! - fetchMock.mockImplementation((url: any, options: any) => - String(url).includes('admin.slots.updateSlot') - ? Promise.reject(new Error('Unable to Update Slot')) - : original(url, options) - ) - - renderWithProviders() - await screen.findByText('Edit Slot') - - fireEvent.press(screen.getByTestId('create-slot-button')) - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith('Error', 'Unable to Update Slot') - ) - }) -}) diff --git a/apps/admin-ui/tests/screens/slots-index.test.tsx b/apps/admin-ui/tests/screens/slots-index.test.tsx deleted file mode 100644 index f601f90..0000000 --- a/apps/admin-ui/tests/screens/slots-index.test.tsx +++ /dev/null @@ -1,153 +0,0 @@ -/** - * Slots list screen (app/(drawer)/dashboard/slots/index.tsx) — rendering, - * empty/loading/error states, capacity toggle mutation and navigation. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' -import { Entypo } from '@expo/vector-icons' - -import Slots from '@/app/(drawer)/dashboard/slots/index' -import { setupApiMocks, resetStorage } from '../mocks/api' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { - expectProcedureCalled, - lastProcedureInput, - procCount, -} from '../mocks/procedures' -import { routerMock, searchParamsMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const slot1 = { - id: 1, - deliveryTime: '2026-10-01T10:00:00.000Z', - freezeTime: '2026-10-01T06:00:00.000Z', - isActive: true, - isFlash: false, - isCapacityFull: false, - deliverySequence: [], - groupIds: [], - products: [ - { id: 11, name: 'Chicken' }, - { id: 12, name: 'Mutton' }, - { id: 13, name: 'Fish' }, - ], -} - -const slot2 = { - id: 2, - deliveryTime: '2026-10-02T10:00:00.000Z', - freezeTime: '2026-10-02T06:00:00.000Z', - isActive: false, - isFlash: false, - isCapacityFull: true, - deliverySequence: [], - groupIds: [], - products: [], -} - -const procedures = { - 'admin.slots.getAll': { slots: [slot1, slot2], count: 2 }, - 'admin.slots.updateSlotCapacity': { - success: true, - slot: slot1, - message: 'updated', - }, -} - -describe('Slots list', () => { - beforeEach(async () => { - resetStaffAuthMock() - await resetStorage() - searchParamsMock.current = {} - setupApiMocks({ procedures }) - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - routerMock.push.mockClear() - }) - - it('shows a loading state while the query is pending', () => { - const { fetchMock } = setupApiMocks({ procedures }) - fetchMock.mockImplementation(() => new Promise(() => {})) - - renderWithProviders() - - expect(screen.getByText('Loading slots...')).toBeVisible() - }) - - it('renders slot rows with products and status', async () => { - renderWithProviders() - - expect(await screen.findByText('Slot #1')).toBeVisible() - expect(screen.getByText('Slot #2')).toBeVisible() - - expect(screen.getByText('Active')).toBeVisible() - expect(screen.getByText('Inactive')).toBeVisible() - expect(screen.getByText('FULL')).toBeVisible() - - expect(screen.getByText('Chicken, Mutton')).toBeVisible() - expect(screen.getByText('+1 more')).toBeVisible() - }) - - it('renders nothing when there are no slots', async () => { - setupApiMocks({ procedures: { 'admin.slots.getAll': { slots: [], count: 0 } } }) - renderWithProviders() - - await waitFor(() => - expectProcedureCalled( - (global as any).fetch, - 'admin.slots.getAll' - ) - ) - expect(screen.queryByText(/Slot #/)).toBeNull() - }) - - it('navigates to add, edit and details', async () => { - renderWithProviders() - await screen.findByText('Slot #1') - - fireEvent.press(screen.getByTestId('add-slot-fab')) - expect(routerMock.push).toHaveBeenCalledWith('/(drawer)/dashboard/slots/add') - - fireEvent.press(screen.getAllByText('Edit')[0]) - expect(routerMock.push).toHaveBeenCalledWith('/(drawer)/dashboard/slots/edit/1') - - fireEvent.press(screen.getByText('Slot #1')) - expect(routerMock.push).toHaveBeenCalledWith( - '/(drawer)/dashboard/slots/slot-details?slotId=1' - ) - }) - - it('toggles capacity through the row action menu', async () => { - const { fetchMock } = setupApiMocks({ procedures }) - renderWithProviders() - await screen.findByText('Slot #1') - - const dots = screen.UNSAFE_getAllByType(Entypo) - expect(dots.length).toBeGreaterThan(0) - fireEvent.press(dots[0]) - - const checkbox = await screen.findByRole('checkbox') - fireEvent.press(checkbox) - - await waitFor(() => - expectProcedureCalled(fetchMock, 'admin.slots.updateSlotCapacity') - ) - - expect(lastProcedureInput(fetchMock, 'admin.slots.updateSlotCapacity')).toEqual({ - slotId: 1, - isCapacityFull: true, - }) - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith( - 'Success', - 'Slot marked as full capacity. It will be hidden from users.' - ) - ) - await waitFor(() => - expect(procCount(fetchMock, 'admin.slots.getAll')).toBeGreaterThan(1) - ) - }) -}) diff --git a/apps/admin-ui/tests/screens/stores-add.test.tsx b/apps/admin-ui/tests/screens/stores-add.test.tsx deleted file mode 100644 index 0deb023..0000000 --- a/apps/admin-ui/tests/screens/stores-add.test.tsx +++ /dev/null @@ -1,108 +0,0 @@ -/** - * Add store screen (app/(drawer)/dashboard/stores/add.tsx) — create mutation, - * owner selection, success navigation and the owner-0 validation gap. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import AddStore from '@/app/(drawer)/dashboard/stores/add' -import { setupApiMocks, resetStorage } from '../mocks/api' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { expectProcedureCalled, lastProcedureInput } from '../mocks/procedures' -import { routerMock, searchParamsMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const procedures = { - 'admin.staffUser.getStaff': { - staff: [{ id: 1, name: 'shafi', role: null, permissions: [] }], - }, - 'admin.product.getProducts': { products: [], count: 0 }, - 'common.product.getAllSkusSummary': { skus: [] }, - 'admin.store.createStore': { - store: { id: 9, name: 'Freshyo Test' }, - message: 'Store created successfully', - }, - 'admin.store.getStores': { stores: [], count: 0 }, -} - -describe('Add store', () => { - beforeEach(async () => { - resetStaffAuthMock() - await resetStorage() - searchParamsMock.current = {} - setupApiMocks({ procedures }) - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - routerMock.push.mockClear() - }) - - it('renders the create form', async () => { - const { fetchMock } = setupApiMocks({ procedures }) - - renderWithProviders() - - expect(screen.getByText('Add New Store')).toBeVisible() - expect(screen.getByPlaceholderText('Enter store name')).toBeVisible() - expect(screen.getByText('Create Store')).toBeVisible() - - await waitFor(() => expectProcedureCalled(fetchMock, 'admin.staffUser.getStaff')) - expectProcedureCalled(fetchMock, 'admin.product.getProducts') - }) - - it('creates a store with the selected owner and navigates back to the list', async () => { - const { fetchMock } = setupApiMocks({ procedures }) - - renderWithProviders() - - fireEvent.changeText( - screen.getByPlaceholderText('Enter store name'), - 'Freshyo Test' - ) - - fireEvent.press(screen.getByText('Select owner')) - fireEvent.press(await screen.findByText('shafi')) - - fireEvent.press(screen.getByText('Create Store')) - - await waitFor(() => - expectProcedureCalled(fetchMock, 'admin.store.createStore') - ) - expect(lastProcedureInput(fetchMock, 'admin.store.createStore')).toEqual({ - name: 'Freshyo Test', - description: '', - owner: 1, - products: [], - }) - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith('Success', 'Store created successfully') - ) - await waitFor(() => - expect(routerMock.push).toHaveBeenCalledWith('/(drawer)/dashboard/stores') - ) - await waitFor(() => - expectProcedureCalled(fetchMock, 'admin.store.getStores') - ) - }) - - it('BUG: submits owner=0 when no owner is selected', async () => { - const { fetchMock } = setupApiMocks({ procedures }) - - renderWithProviders() - - fireEvent.changeText( - screen.getByPlaceholderText('Enter store name'), - 'No Owner Store' - ) - fireEvent.press(screen.getByText('Create Store')) - - await waitFor(() => - expectProcedureCalled(fetchMock, 'admin.store.createStore') - ) - expect(lastProcedureInput(fetchMock, 'admin.store.createStore')).toMatchObject({ - owner: 0, - }) - }) -}) diff --git a/apps/admin-ui/tests/screens/stores-edit.test.tsx b/apps/admin-ui/tests/screens/stores-edit.test.tsx deleted file mode 100644 index 1070b30..0000000 --- a/apps/admin-ui/tests/screens/stores-edit.test.tsx +++ /dev/null @@ -1,172 +0,0 @@ -/** - * Edit store screen (app/(drawer)/dashboard/stores/edit.tsx) — prefill, - * not-found/loading states and the update -> list flow. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import EditStore from '@/app/(drawer)/dashboard/stores/edit' -import { setupApiMocks, resetStorage } from '../mocks/api' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { - expectProcedureCalled, - lastProcedureInput, - procCount, -} from '../mocks/procedures' -import { routerMock, searchParamsMock } from '../mocks/router' -import { createQueryClient, renderWithProviders } from '../helpers/render' - -const store = { - id: 3, - name: 'Freshyo Edit', - description: 'Editable outlet', - imageUrl: 'https://cdn.freshyo.in/store.png', - owner: { id: 1, name: 'shafi' }, - createdAt: '2026-03-01T00:00:00.000Z', -} - -const procedures = { - 'admin.store.getStoreById': { store }, - 'admin.staffUser.getStaff': { - staff: [{ id: 1, name: 'shafi', role: null, permissions: [] }], - }, - 'admin.product.getProducts': { - products: [{ id: 1, name: 'Chicken', storeId: null, skus: [] }], - count: 1, - }, - 'common.product.getAllSkusSummary': { skus: [] }, - 'admin.store.updateStore': { - store: { id: 3 }, - message: 'Store updated successfully', - }, - 'admin.store.getStores': { stores: [], count: 0 }, -} - -describe('Edit store', () => { - beforeEach(async () => { - resetStaffAuthMock() - await resetStorage() - searchParamsMock.current = { id: '3' } - setupApiMocks({ procedures }) - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - routerMock.push.mockClear() - }) - - it('shows a loader while the store is loading', () => { - const { fetchMock } = setupApiMocks({ procedures }) - fetchMock.mockImplementation(() => new Promise(() => {})) - - renderWithProviders() - - expect(screen.getByText('Loading store...')).toBeVisible() - }) - - it('shows not-found when the store does not exist', async () => { - setupApiMocks({ procedures: { 'admin.store.getStoreById': null } }) - - renderWithProviders() - - expect(await screen.findByText('Store not found')).toBeVisible() - }) - - it('prefills the form and submits the update', async () => { - const { fetchMock } = setupApiMocks({ procedures }) - - renderWithProviders() - - expect(await screen.findByText('Edit Store')).toBeVisible() - expect(screen.getByDisplayValue('Freshyo Edit')).toBeVisible() - expect(screen.getByDisplayValue('Editable outlet')).toBeVisible() - expect(lastProcedureInput(fetchMock, 'admin.store.getStoreById')).toEqual({ id: 3 }) - - await waitFor(() => - expectProcedureCalled(fetchMock, 'admin.product.getProducts') - ) - - fireEvent.press(screen.getByText('Update Store')) - - await waitFor(() => - expectProcedureCalled(fetchMock, 'admin.store.updateStore') - ) - expect(lastProcedureInput(fetchMock, 'admin.store.updateStore')).toEqual({ - id: 3, - name: 'Freshyo Edit', - description: 'Editable outlet', - owner: 1, - products: [], - }) - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith('Success', 'Store updated successfully') - ) - await waitFor(() => - expect(routerMock.push).toHaveBeenCalledWith('/(drawer)/dashboard/stores') - ) - }) - - it('surfaces an update error', async () => { - const { fetchMock } = setupApiMocks({ procedures }) - const original = fetchMock.getMockImplementation()! - fetchMock.mockImplementation((url: any, options: any) => - String(url).includes('admin.store.updateStore') - ? Promise.reject(new Error('Failed to update store')) - : original(url, options) - ) - - renderWithProviders() - await screen.findByText('Edit Store') - await waitFor(() => - expectProcedureCalled(fetchMock, 'admin.product.getProducts') - ) - - fireEvent.press(screen.getByText('Update Store')) - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith('Error', 'Failed to update store') - ) - }) - - it('refetches the mounted store and invalidates the stores list by array path after a successful update', async () => { - const { fetchMock } = setupApiMocks({ procedures }) - // The injected client is the one trpc.useUtils() acts on, so spying on it - // observes the real invalidation (spyOn keeps calling through). - const client = createQueryClient() - const invalidateSpy = jest.spyOn(client, 'invalidateQueries') - - renderWithProviders(, { queryClient: client }) - - expect(await screen.findByText('Edit Store')).toBeVisible() - await waitFor(() => - expectProcedureCalled(fetchMock, 'admin.product.getProducts') - ) - - // Baseline immediately before the interaction: the app shares one - // module-singleton httpBatchLink client, so counts can leak across cases - // in a full-file run — always assert a delta, never an absolute number. - const before = procCount(fetchMock, 'admin.store.getStoreById') - - fireEvent.press(screen.getByText('Update Store')) - - await waitFor(() => - expectProcedureCalled(fetchMock, 'admin.store.updateStore') - ) - - // (a) `refetch()` re-runs the getStoreById query this screen has mounted. - await waitFor(() => - expect(procCount(fetchMock, 'admin.store.getStoreById')).toBeGreaterThan( - before - ) - ) - - // (b) the list invalidation used the array query path, not the old dotted - // string: `queryClient.invalidateQueries({ queryKey: [['admin','store','getStores']] })`. - const paths = invalidateSpy.mock.calls.map((call) => { - const key = (call[0] as { queryKey?: unknown[] } | undefined)?.queryKey - return Array.isArray(key) ? key[0] : null - }) - expect(paths).toContainEqual(['admin', 'store', 'getStores']) - }) -}) diff --git a/apps/admin-ui/tests/screens/stores-index.test.tsx b/apps/admin-ui/tests/screens/stores-index.test.tsx deleted file mode 100644 index d305d4d..0000000 --- a/apps/admin-ui/tests/screens/stores-index.test.tsx +++ /dev/null @@ -1,188 +0,0 @@ -/** - * Stores list screen (app/(drawer)/dashboard/stores/index.tsx) — grid render, - * empty/loading/error states, edit-mode delete mutation and navigation. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' -import { MaterialIcons } from '@expo/vector-icons' - -import Stores from '@/app/(drawer)/dashboard/stores/index' -import { setupApiMocks, resetStorage } from '../mocks/api' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { expectProcedureCalled, lastProcedureInput, procCount } from '../mocks/procedures' -import { routerMock, searchParamsMock } from '../mocks/router' -import { refreshHooks, resetRefreshHooks } from '../mocks/refresh' -import { renderWithProviders } from '../helpers/render' - -const store1 = { - id: 1, - name: 'Freshyo Kukatpally', - description: 'Main outlet', - imageUrl: null, - owner: 1, - createdAt: '2026-01-15T00:00:00.000Z', -} -const store2 = { - id: 2, - name: 'Freshyo Gachibowli', - description: null, - imageUrl: 'https://cdn.freshyo.in/store.png', - owner: 2, - createdAt: '2026-02-20T00:00:00.000Z', -} - -const procedures = { - 'admin.store.getStores': { stores: [store1, store2], count: 2 }, - 'admin.store.deleteStore': { message: 'Store deleted successfully' }, -} - -const iconByName = (name: string) => - screen.UNSAFE_getAllByType(MaterialIcons).find((i) => i.props.name === name) - -describe('Stores list', () => { - beforeEach(async () => { - resetStaffAuthMock() - await resetStorage() - resetRefreshHooks() - searchParamsMock.current = {} - setupApiMocks({ procedures }) - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - routerMock.push.mockClear() - }) - - it('shows a loading state', () => { - const { fetchMock } = setupApiMocks({ procedures }) - fetchMock.mockImplementation(() => new Promise(() => {})) - - renderWithProviders() - - expect(screen.getByText('Loading stores...')).toBeVisible() - }) - - it('shows an error state and retries', async () => { - const { fetchMock } = setupApiMocks({ procedures }) - fetchMock.mockRejectedValue(new Error('network down')) - - renderWithProviders() - - expect(await screen.findByText('Oops!')).toBeVisible() - expect(screen.getByText('Retry')).toBeVisible() - - const callsBefore = procCount(fetchMock, 'admin.store.getStores') - fireEvent.press(screen.getByText('Retry')) - await waitFor(() => - expect(procCount(fetchMock, 'admin.store.getStores')).toBeGreaterThan( - callsBefore - ) - ) - }) - - it('renders the store grid', async () => { - const { fetchMock } = setupApiMocks({ procedures }) - - renderWithProviders() - - expect(await screen.findByText('Freshyo Kukatpally')).toBeVisible() - expect(screen.getByText('Freshyo Gachibowli')).toBeVisible() - expect(screen.getByText('2 Locations')).toBeVisible() - expect(screen.getByText('ID: #1')).toBeVisible() - expect(screen.getAllByText('View Details')).toHaveLength(2) - expectProcedureCalled(fetchMock, 'admin.store.getStores') - }) - - it('renders the empty state', async () => { - setupApiMocks({ - procedures: { 'admin.store.getStores': { stores: [], count: 0 } }, - }) - - renderWithProviders() - - expect(await screen.findByText('No stores found')).toBeVisible() - expect(screen.getByText('0 Locations')).toBeVisible() - }) - - it('navigates to edit when a card is pressed', async () => { - setupApiMocks({ procedures }) - - renderWithProviders() - await screen.findByText('Freshyo Kukatpally') - - fireEvent.press(screen.getByText('Freshyo Kukatpally')) - - expect(routerMock.push).toHaveBeenCalledWith({ - pathname: '/(drawer)/dashboard/stores/edit', - params: { id: 1 }, - }) - }) - - it('navigates to add from the FAB', async () => { - setupApiMocks({ procedures }) - - renderWithProviders() - await screen.findByText('Freshyo Kukatpally') - - const addIcon = iconByName('add') - expect(addIcon).toBeTruthy() - fireEvent.press(addIcon!) - - expect(routerMock.push).toHaveBeenCalledWith( - '/(drawer)/dashboard/stores/add' - ) - }) - - it('deletes a store in edit mode and refetches', async () => { - const { fetchMock } = setupApiMocks({ procedures }) - const alertSpy = jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - - renderWithProviders() - await screen.findByText('Freshyo Kukatpally') - - fireEvent.press(screen.getByText('Edit')) - expect(screen.getByText('Done')).toBeVisible() - - const deleteIcon = iconByName('delete') - expect(deleteIcon).toBeTruthy() - fireEvent.press(deleteIcon!) - - expect(Alert.alert).toHaveBeenCalled() - const buttons = alertSpy.mock.calls.find( - (call) => call[0] === 'Delete Store' - )?.[2] as { text: string; onPress?: () => void }[] - expect(buttons?.map((b) => b.text)).toEqual(['Cancel', 'Delete']) - - act(() => { - buttons.find((b) => b.text === 'Delete')?.onPress?.() - }) - - await waitFor(() => - expectProcedureCalled(fetchMock, 'admin.store.deleteStore') - ) - expect(lastProcedureInput(fetchMock, 'admin.store.deleteStore')).toEqual({ - storeId: 1, - }) - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith('Success', 'Store deleted successfully') - ) - await waitFor(() => - expect(procCount(fetchMock, 'admin.store.getStores')).toBeGreaterThan(1) - ) - }) - - it('refetches through the mark-data-fetchers callback', async () => { - const { fetchMock } = setupApiMocks({ procedures }) - - renderWithProviders() - await screen.findByText('Freshyo Kukatpally') - - expect(refreshHooks.markDataFetchers).toBeTruthy() - const before = procCount(fetchMock, 'admin.store.getStores') - refreshHooks.markDataFetchers?.() - await waitFor(() => - expect(procCount(fetchMock, 'admin.store.getStores')).toBeGreaterThan(before) - ) - }) -}) diff --git a/apps/admin-ui/tests/screens/user-management-detail.test.tsx b/apps/admin-ui/tests/screens/user-management-detail.test.tsx deleted file mode 100644 index cbc733c..0000000 --- a/apps/admin-ui/tests/screens/user-management-detail.test.tsx +++ /dev/null @@ -1,248 +0,0 @@ -/** - * User details (app/(drawer)/dashboard/user-management/[id].tsx) — detail - * rendering, suspension toggle, order history, navigation and error/retry. - * - * SCOPE NOTE: this screen has no notification UI or procedure (the only - * notification screen is app/(drawer)/dashboard/send-notifications, out of - * scope). "Incidents" is exercised through the embedded UserIncidentsView. - * - * HARNESS BUG WORKAROUND: tests/mocks/native.ts has a stray top-level `return` - * (line 89 → "'return' outside of function"). Re-mock the expo modules that - * `common-ui` eagerly imports locally. See report. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -jest.mock('expo-image', () => { - const React = require('react') - const { View } = require('react-native') - const Image = (props: Record) => - React.createElement(View, { testID: 'mock-image', ...props }) - return { __esModule: true, Image, default: Image } -}) - -jest.mock('expo-image-picker', () => { - const asset = { uri: 'file:///tmp/pick.jpg', fileName: 'pick.jpg', mimeType: 'image/jpeg' } - return { - __esModule: true, - MediaTypeOptions: { Images: 'Images', All: 'All', Videos: 'Videos' }, - launchImageLibraryAsync: jest.fn(async () => ({ canceled: false, assets: [asset] })), - launchCameraAsync: jest.fn(async () => ({ canceled: false, assets: [asset] })), - requestMediaLibraryPermissionsAsync: jest.fn(async () => ({ granted: true, status: 'granted' })), - requestCameraPermissionsAsync: jest.fn(async () => ({ granted: true, status: 'granted' })), - } -}) - -jest.mock('expo-document-picker', () => ({ - __esModule: true, - getDocumentAsync: jest.fn(async () => ({ - canceled: false, - assets: [{ uri: 'file:///tmp/doc.pdf', name: 'doc.pdf', mimeType: 'application/pdf' }], - })), -})) - -import React from 'react' -import { Alert, TouchableOpacity } from 'react-native' -import { Checkbox } from 'common-ui' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import UserDetails from '@/app/(drawer)/dashboard/user-management/[id]' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { expectProcedureCalled, lastProcedureInput, procCount } from '../mocks/procedures' -import { resetRouterMock, routerMock, searchParamsMock } from '../mocks/router' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { renderWithProviders } from '../helpers/render' - -const makeDetails = (overrides: Record = {}) => ({ - user: { - id: 3, - name: 'Alice', - mobile: '9999999999', - createdAt: '2026-01-01T10:00:00.000Z', - isSuspended: false, - }, - orders: [ - { - id: 11, - readableId: 11, - totalAmount: '500', - createdAt: '2026-02-01T10:00:00.000Z', - status: 'delivered', - isFlashDelivery: false, - itemCount: 2, - }, - { - id: 12, - readableId: 12, - totalAmount: '250', - createdAt: '2026-02-02T10:00:00.000Z', - status: 'pending', - isFlashDelivery: true, - itemCount: 1, - }, - ], - ...overrides, -}) - -const procedures = (overrides: Record = {}) => ({ - 'admin.user.getUserDetails': makeDetails(), - 'admin.user.updateUserSuspension': { success: true, message: 'ok' }, - 'admin.user.getUserIncidents': { incidents: [] }, - ...overrides, -}) - -const renderDetails = (overrides: Record = {}) => { - const { fetchMock } = setupApiMocks({ procedures: procedures(overrides) }) - renderWithProviders() - return { fetchMock } -} - -describe('User details', () => { - beforeEach(async () => { - resetStaffAuthMock() - await resetStorage() - resetRouterMock() - searchParamsMock.current = { id: '3' } - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('shows a loading state while the details are pending', () => { - setupApiMocks({ - procedures: { 'admin.user.getUserDetails': () => new Promise(() => {}) }, - }) - renderWithProviders() - - expect(screen.getByText('Loading user details...')).toBeVisible() - }) - - it('queries the user with the route id', async () => { - const { fetchMock } = renderDetails() - - await waitFor(() => expect(screen.getByText('User Details')).toBeVisible()) - expect(lastProcedureInput(fetchMock, 'admin.user.getUserDetails')).toEqual({ userId: 3 }) - }) - - it('renders the user info and order history', async () => { - renderDetails() - - await waitFor(() => expect(screen.getByText('User Details')).toBeVisible()) - expect(screen.getByText('9999999999')).toBeVisible() - expect(screen.getByText('Alice')).toBeVisible() - expect(screen.getByText('Order History')).toBeVisible() - expect(screen.getByText('2 orders')).toBeVisible() - expect(screen.getByText('#11')).toBeVisible() - expect(screen.getByText('#12')).toBeVisible() - expect(screen.getByText('₹500')).toBeVisible() - expect(screen.getByText('2 items')).toBeVisible() - expect(screen.getByText('1 item')).toBeVisible() - expect(screen.getByText('delivered')).toBeVisible() - expect(screen.getByText('pending')).toBeVisible() - expect(screen.getByText(/Registered/)).toBeVisible() - }) - - it('renders an empty order history', async () => { - renderDetails({ 'admin.user.getUserDetails': makeDetails({ orders: [] }) }) - - await waitFor(() => expect(screen.getByText('No orders yet')).toBeVisible()) - }) - - it('renders the suspended badge when the user is suspended', async () => { - renderDetails({ - 'admin.user.getUserDetails': makeDetails({ - user: { ...makeDetails().user, isSuspended: true }, - }), - }) - - await waitFor(() => expect(screen.getByText('Suspended')).toBeVisible()) - }) - - it('suspends the user through the checkbox and refetches', async () => { - const { fetchMock } = renderDetails() - - await waitFor(() => expect(screen.getByText('User Details')).toBeVisible()) - const before = procCount(fetchMock, 'admin.user.getUserDetails') - - fireEvent.press(screen.UNSAFE_getByType(Checkbox as never)) - - await waitFor(() => - expectProcedureCalled(fetchMock, 'admin.user.updateUserSuspension') - ) - expect(lastProcedureInput(fetchMock, 'admin.user.updateUserSuspension')).toEqual({ - userId: 3, - isSuspended: true, - }) - await waitFor(() => - expect(procCount(fetchMock, 'admin.user.getUserDetails')).toBeGreaterThan(before) - ) - }) - - it('unsuspends an already suspended user', async () => { - const { fetchMock } = renderDetails({ - 'admin.user.getUserDetails': makeDetails({ - user: { ...makeDetails().user, isSuspended: true }, - }), - }) - - await waitFor(() => expect(screen.getByText('Suspended')).toBeVisible()) - fireEvent.press(screen.UNSAFE_getByType(Checkbox as never)) - - await waitFor(() => - expect(lastProcedureInput(fetchMock, 'admin.user.updateUserSuspension')).toEqual({ - userId: 3, - isSuspended: false, - }) - ) - }) - - it('shows the error state when the query fails and refetches on Retry', async () => { - const { fetchMock } = renderDetails({ - 'admin.user.getUserDetails': () => { - throw new Error('boom') - }, - }) - - await waitFor(() => expect(screen.getByText('Error')).toBeVisible()) - expect(screen.getByText('boom')).toBeVisible() - - const before = procCount(fetchMock, 'admin.user.getUserDetails') - fireEvent.press(screen.getByText('Retry')) - - await waitFor(() => - expect(procCount(fetchMock, 'admin.user.getUserDetails')).toBeGreaterThan(before) - ) - }) - - it('shows the default error message when there is no data', async () => { - renderDetails({ 'admin.user.getUserDetails': null }) - - await waitFor(() => - expect(screen.getByText('Failed to load user details')).toBeVisible() - ) - }) - - it('navigates to an order and back', async () => { - renderDetails() - - await waitFor(() => expect(screen.getByText('#11')).toBeVisible()) - - fireEvent.press(screen.getByText('#11')) - expect(routerMock.push).toHaveBeenCalledWith( - '/(drawer)/dashboard/manage-orders/order-details/11' - ) - - const back = screen.UNSAFE_getAllByType(TouchableOpacity)[0] - fireEvent.press(back) - expect(routerMock.back).toHaveBeenCalled() - }) - - it('passes the route user id to the incidents view', async () => { - const { fetchMock } = renderDetails() - - await waitFor(() => - expectProcedureCalled(fetchMock, 'admin.user.getUserIncidents') - ) - expect(lastProcedureInput(fetchMock, 'admin.user.getUserIncidents')).toEqual({ - userId: 3, - }) - }) -}) diff --git a/apps/admin-ui/tests/screens/user-management-index.test.tsx b/apps/admin-ui/tests/screens/user-management-index.test.tsx deleted file mode 100644 index f4a7611..0000000 --- a/apps/admin-ui/tests/screens/user-management-index.test.tsx +++ /dev/null @@ -1,211 +0,0 @@ -/** - * User management list (app/(drawer)/dashboard/user-management/index.tsx) — - * infinite list, search, rows, empty/error/loading, pagination and navigation. - * - * HARNESS BUG WORKAROUND: tests/mocks/native.ts has a stray top-level `return` - * (line 89 → "'return' outside of function"). Re-mock the three expo modules - * that `common-ui` eagerly imports, without touching the harness. See report. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -jest.mock('expo-image', () => { - const React = require('react') - const { View } = require('react-native') - const Image = (props: Record) => - React.createElement(View, { testID: 'mock-image', ...props }) - return { __esModule: true, Image, default: Image } -}) - -jest.mock('expo-image-picker', () => { - const asset = { uri: 'file:///tmp/pick.jpg', fileName: 'pick.jpg', mimeType: 'image/jpeg' } - return { - __esModule: true, - MediaTypeOptions: { Images: 'Images', All: 'All', Videos: 'Videos' }, - launchImageLibraryAsync: jest.fn(async () => ({ canceled: false, assets: [asset] })), - launchCameraAsync: jest.fn(async () => ({ canceled: false, assets: [asset] })), - requestMediaLibraryPermissionsAsync: jest.fn(async () => ({ granted: true, status: 'granted' })), - requestCameraPermissionsAsync: jest.fn(async () => ({ granted: true, status: 'granted' })), - } -}) - -jest.mock('expo-document-picker', () => ({ - __esModule: true, - getDocumentAsync: jest.fn(async () => ({ - canceled: false, - assets: [{ uri: 'file:///tmp/doc.pdf', name: 'doc.pdf', mimeType: 'application/pdf' }], - })), -})) - -import React from 'react' -import { Alert, FlatList } from 'react-native' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' - -import UserManagement from '@/app/(drawer)/dashboard/user-management/index' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { lastProcedureInput, procCount } from '../mocks/procedures' -import { resetRouterMock, routerMock, searchParamsMock } from '../mocks/router' -import { resetRefreshHooks } from '../mocks/refresh' -import { resetStaffAuthMock } from '../mocks/staff-auth' -import { renderWithProviders } from '../helpers/render' - -const alice = { - id: 3, - name: 'Alice', - mobile: '9999999999', - createdAt: '2026-01-01T10:00:00.000Z', - totalOrders: 4, - lastOrderDate: '2026-02-01T10:00:00.000Z', - isSuspended: false, -} - -const bob = { - id: 4, - name: null, - mobile: '8888888888', - createdAt: '2026-01-15T10:00:00.000Z', - totalOrders: 0, - lastOrderDate: null, - isSuspended: true, -} - -const page = (users: unknown[], nextCursor?: number) => ({ - users, - nextCursor, - hasMore: nextCursor != null, -}) - -describe('User management list', () => { - beforeEach(async () => { - resetStaffAuthMock() - resetRefreshHooks() - await resetStorage() - resetRouterMock() - searchParamsMock.current = {} - setupApiMocks() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('shows a loading state while the list query is pending', () => { - setupApiMocks({ - procedures: { 'admin.user.getAllUsers': () => new Promise(() => {}) }, - }) - renderWithProviders() - - expect(screen.getByText('Loading users...')).toBeVisible() - }) - - it('renders rows with mobile, name, order stats and suspension badge', async () => { - setupApiMocks({ - procedures: { 'admin.user.getAllUsers': page([alice, bob]) }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('9999999999')).toBeVisible()) - expect(screen.getByText('8888888888')).toBeVisible() - expect(screen.getByText('Alice')).toBeVisible() - expect(screen.getByText('Unnamed User')).toBeVisible() - expect(screen.getByText('4 orders')).toBeVisible() - expect(screen.getByText('0 orders')).toBeVisible() - expect(screen.getByText('Suspended')).toBeVisible() - expect(screen.getByText('Showing 2 users')).toBeVisible() - }) - - it('shows the empty state when there are no users', async () => { - setupApiMocks({ procedures: { 'admin.user.getAllUsers': page([]) } }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('No users found')).toBeVisible()) - expect(screen.queryByText('Try adjusting your search')).toBeNull() - }) - - it('hints to adjust the search when the search has no matches', async () => { - setupApiMocks({ procedures: { 'admin.user.getAllUsers': page([]) } }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('No users found')).toBeVisible()) - - fireEvent.changeText( - screen.getByPlaceholderText('Search by mobile number...'), - '0000' - ) - - expect(await screen.findByText('Try adjusting your search')).toBeVisible() - }) - - it('shows the error state and refetches on Retry', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.user.getAllUsers': () => { - throw new Error('boom') - }, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Error')).toBeVisible()) - - const before = procCount(api.fetchMock, 'admin.user.getAllUsers') - fireEvent.press(screen.getByText('Retry')) - - await waitFor(() => - expect(procCount(api.fetchMock, 'admin.user.getAllUsers')).toBeGreaterThan(before) - ) - }) - - it('sends the search term to getAllUsers', async () => { - const api = setupApiMocks({ - procedures: { 'admin.user.getAllUsers': page([alice]) }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('9999999999')).toBeVisible()) - - fireEvent.changeText( - screen.getByPlaceholderText('Search by mobile number...'), - '8888' - ) - - await waitFor(() => - expect(lastProcedureInput(api.fetchMock, 'admin.user.getAllUsers')).toMatchObject({ - limit: 30, - search: '8888', - }) - ) - }) - - it('navigates to the user detail screen from a row', async () => { - setupApiMocks({ - procedures: { 'admin.user.getAllUsers': page([alice, bob]) }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('9999999999')).toBeVisible()) - - fireEvent.press(screen.getByText('9999999999')) - expect(routerMock.push).toHaveBeenCalledWith('/(drawer)/dashboard/user-management/3') - - fireEvent.press(screen.getByText('8888888888')) - expect(routerMock.push).toHaveBeenCalledWith('/(drawer)/dashboard/user-management/4') - }) - - it('fetches the next page when the list end is reached', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.user.getAllUsers': (input: { cursor?: number }) => - input?.cursor ? page([{ ...alice, id: 9, mobile: '7777777777' }]) : page([alice], 100), - }, - }) - renderWithProviders() - - await screen.findByText('9999999999') - const list = screen.UNSAFE_getByType(FlatList as never) - act(() => list.props.onEndReached()) - - expect(await screen.findByText('7777777777')).toBeVisible() - expect(lastProcedureInput(api.fetchMock, 'admin.user.getAllUsers')).toMatchObject({ - limit: 30, - cursor: 100, - }) - }) -}) diff --git a/apps/admin-ui/tests/screens/vendor-snippets-index.test.tsx b/apps/admin-ui/tests/screens/vendor-snippets-index.test.tsx deleted file mode 100644 index 5820905..0000000 --- a/apps/admin-ui/tests/screens/vendor-snippets-index.test.tsx +++ /dev/null @@ -1,251 +0,0 @@ -/** - * Vendor snippets list (app/(drawer)/dashboard/vendor-snippets/index.tsx) — - * list rows with expiry status, empty/loading/error states, share link, the - * per-row options menu (edit / delete / view orders) and FAB create flow. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert, Share, TouchableOpacity } from 'react-native' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' -import MaterialIcons from '@expo/vector-icons/MaterialIcons' - -import VendorSnippets from '@/app/(drawer)/dashboard/vendor-snippets/index' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { - expectProcedureCalled, - lastProcedureInput, - procCount, -} from '../mocks/procedures' -import { renderWithProviders } from '../helpers/render' - -const snippet = (overrides: Record = {}) => ({ - id: 1, - snippetCode: 'VS_1', - slotId: 2, - isPermanent: false, - skuIds: [10, 11], - products: [ - { id: 10, name: 'Chicken' }, - { id: 11, name: 'Mutton' }, - ], - validTill: '2027-01-01T00:00:00.000Z', - createdAt: '2026-01-01T00:00:00.000Z', - accessUrl: 'https://app.freshyo.in/vendor-order-list?id=VS_1', - slot: { - id: 2, - deliveryTime: '2026-12-31T10:00:00.000Z', - freezeTime: '2026-12-30T10:00:00.000Z', - isActive: true, - deliverySequence: 1, - }, - ...overrides, -}) - -const order = { - orderId: 'ORD1', - orderDate: '2026-01-02T09:00:00.000Z', - customerName: 'Alice', - totalAmount: 100, - slotInfo: { time: '2026-01-03T10:00:00.000Z', sequence: [] }, - snippetCode: 'VS_1', - matchedProducts: [10], - products: [ - { productId: 10, productName: 'Chicken', quantity: 2, price: 50, unit: 'kg', subtotal: 100 }, - ], -} - -const openFirstMenu = (result: ReturnType) => { - fireEvent.press(result.UNSAFE_getAllByType(TouchableOpacity)[0]) -} - -const pressLastAlertButton = (label: string) => { - const calls = (Alert.alert as jest.Mock).mock.calls - const call = calls[calls.length - 1] - const buttons = (call?.[2] ?? []) as { text: string; onPress?: () => void }[] - act(() => buttons.find((b) => b.text === label)?.onPress?.()) -} - -describe('Vendor snippets list', () => { - beforeEach(async () => { - await resetStorage() - setupApiMocks() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - jest.spyOn(Share, 'share').mockResolvedValue({ action: Share.sharedAction } as never) - }) - - it('shows the loading state while the query is pending', () => { - setupApiMocks({ - procedures: { 'admin.vendorSnippets.getAll': () => new Promise(() => {}) }, - }) - renderWithProviders() - - expect(screen.getByText('Loading vendor snippets...')).toBeVisible() - }) - - it('shows the error state when the query fails', async () => { - setupApiMocks({ - procedures: { - 'admin.vendorSnippets.getAll': () => { - throw new Error('boom') - }, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Error loading snippets')).toBeVisible()) - }) - - it('shows the empty state when there are no snippets', async () => { - setupApiMocks({ - procedures: { 'admin.vendorSnippets.getAll': [] }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('No Snippets Yet')).toBeVisible()) - }) - - it('renders snippet rows with status and item count', async () => { - setupApiMocks({ - procedures: { - 'admin.vendorSnippets.getAll': [ - snippet(), - snippet({ - id: 2, - snippetCode: 'VS_EXPIRED', - isPermanent: true, - validTill: '2020-01-01T00:00:00.000Z', - slot: null, - }), - ], - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('VS_1')).toBeVisible()) - expect(screen.getByText('VS_EXPIRED')).toBeVisible() - expect(screen.getByText('Active')).toBeVisible() - expect(screen.getByText('Expired')).toBeVisible() - expect(screen.getByText('Permanent')).toBeVisible() - expect(screen.getByText('Always Active')).toBeVisible() - expect(screen.getAllByText('2 Items')).toHaveLength(2) - }) - - it('shares the snippet access link', async () => { - setupApiMocks({ - procedures: { 'admin.vendorSnippets.getAll': [snippet()] }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('VS_1')).toBeVisible()) - fireEvent.press(screen.getByText('Share')) - - await waitFor(() => - expect(Share.share).toHaveBeenCalledWith({ - message: 'https://app.freshyo.in/vendor-order-list?id=VS_1', - }) - ) - }) - - it('warns instead of sharing when the link is missing', async () => { - setupApiMocks({ - procedures: { - 'admin.vendorSnippets.getAll': [snippet({ accessUrl: undefined })], - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('VS_1')).toBeVisible()) - fireEvent.press(screen.getByText('Share')) - - expect(Alert.alert).toHaveBeenCalledWith('Error', 'No link available') - expect(Share.share).not.toHaveBeenCalled() - }) - - it('opens the create form from the FAB', async () => { - setupApiMocks({ - procedures: { 'admin.vendorSnippets.getAll': [snippet()] }, - }) - const result = renderWithProviders() - - await waitFor(() => expect(screen.getByText('VS_1')).toBeVisible()) - const addIcon = result.UNSAFE_getAllByType(MaterialIcons).find( - (node) => node.props.name === 'add' - )! - fireEvent.press(addIcon) - - expect(await screen.findByText('Create Vendor Snippet')).toBeVisible() - }) - - it('deletes a snippet through the row menu', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.vendorSnippets.getAll': [snippet()], - 'admin.vendorSnippets.delete': { message: 'Vendor snippet deleted successfully' }, - }, - }) - const result = renderWithProviders() - - await waitFor(() => expect(screen.getByText('VS_1')).toBeVisible()) - openFirstMenu(result) - fireEvent.press(await screen.findByText('Delete')) - pressLastAlertButton('Delete') - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'admin.vendorSnippets.delete')) - expect(lastProcedureInput(api.fetchMock, 'admin.vendorSnippets.delete')).toEqual({ id: 1 }) - }) - - it('loads the matched orders through the row menu', async () => { - const api = setupApiMocks({ - procedures: { - 'admin.vendorSnippets.getAll': [snippet()], - 'admin.vendorSnippets.getOrdersBySnippet': { - success: true, - data: [order], - snippet: snippet(), - }, - }, - }) - const result = renderWithProviders() - - await waitFor(() => expect(screen.getByText('VS_1')).toBeVisible()) - openFirstMenu(result) - fireEvent.press(await screen.findByText('View Orders')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'admin.vendorSnippets.getOrdersBySnippet')) - expect(lastProcedureInput(api.fetchMock, 'admin.vendorSnippets.getOrdersBySnippet')).toEqual({ - snippetCode: 'VS_1', - }) - expect(await screen.findByText('Orders for "VS_1"')).toBeVisible() - expect(screen.getByText('ORD1')).toBeVisible() - }) - - it('opens the edit form from the row menu', async () => { - setupApiMocks({ - procedures: { 'admin.vendorSnippets.getAll': [snippet()] }, - }) - const result = renderWithProviders() - - await waitFor(() => expect(screen.getByText('VS_1')).toBeVisible()) - openFirstMenu(result) - fireEvent.press(await screen.findByText('Edit')) - - expect(await screen.findByText('Edit Vendor Snippet')).toBeVisible() - }) - - it('refetches through the mark-data-fetchers hook', async () => { - const api = setupApiMocks({ - procedures: { 'admin.vendorSnippets.getAll': [snippet()] }, - }) - renderWithProviders() - await waitFor(() => expect(screen.getByText('VS_1')).toBeVisible()) - - const before = procCount(api.fetchMock, 'admin.vendorSnippets.getAll') - const { refreshHooks } = require('../mocks/refresh') - refreshHooks.markDataFetchers?.() - await waitFor(() => - expect(procCount(api.fetchMock, 'admin.vendorSnippets.getAll')).toBeGreaterThan(before) - ) - }) -}) diff --git a/apps/admin-ui/tests/setup.ts b/apps/admin-ui/tests/setup.ts deleted file mode 100644 index 785876d..0000000 --- a/apps/admin-ui/tests/setup.ts +++ /dev/null @@ -1,122 +0,0 @@ -/** - * Shared Jest setup for apps/admin-ui. - * - * Only the native/context dependencies that cannot run under a plain Jest - * environment are stubbed here. Components, stores and hooks stay real. - * - * expo-router is NOT mocked globally — tests that need it add the mock - * themselves (see tests/mocks/router.ts), and router tests can use the real one. - */ - -jest.mock('common-ui/hooks/useMarkDataFetchers', () => ({ - __esModule: true, - useMarkDataFetchers: (cb: () => void) => { - require('./mocks/refresh').refreshHooks.markDataFetchers = cb - }, -})) - -jest.mock('common-ui/hooks/useManualRefresh', () => ({ - __esModule: true, - default: (cb: () => void) => { - require('./mocks/refresh').refreshHooks.manualRefresh = cb - }, -})) - -/** - * Native / third-party modules that cannot run under jest. Stubs live in - * tests/mocks/native.ts. - */ -jest.mock('react-native-draggable-flatlist', () => require('./mocks/native').draggableFlatListMock()) -jest.mock('react-native-tab-view', () => require('./mocks/native').tabViewMock()) -jest.mock('react-native-toast-message', () => require('./mocks/native').toastMock()) -jest.mock('expo-location', () => require('./mocks/native').locationMock()) -jest.mock('expo-image-picker', () => require('./mocks/native').imagePickerMock()) -jest.mock('expo-document-picker', () => require('./mocks/native').documentPickerMock()) -jest.mock('expo-device', () => require('./mocks/native').deviceMock()) -jest.mock('expo-haptics', () => require('./mocks/native').hapticsMock()) -jest.mock('expo-linear-gradient', () => require('./mocks/native').linearGradientMock()) -jest.mock('expo-blur', () => require('./mocks/native').blurMock()) -jest.mock('expo-image', () => require('./mocks/native').imageMock()) - -/** - * useFocusEffect throws without a NavigationContainer. Run the callback once on - * mount instead so focus-driven side effects are testable. - */ -jest.mock('@react-navigation/native', () => { - const actual = jest.requireActual('@react-navigation/native') - const React = require('react') - - return { - ...actual, - useFocusEffect: (callback: () => void | (() => void)) => { - const ran = React.useRef(false) - React.useEffect(() => { - if (ran.current) return - ran.current = true - return callback() - }, []) - }, - } -}) - -/** - * Staff auth is stubbed with a signed-in shape, overridable via - * tests/mocks/staff-auth.ts. Real-provider tests unmock this module. - */ -jest.mock('@/components/context/staff-auth-context', () => - require('./mocks/staff-auth').staffAuthContextMock() -) - -/** - * Secure + casual storage services are backed by expo-secure-store. Mock at the - * service module path with an in-memory map. - */ -jest.mock('common-ui/src/services/StorageService', () => { - const store = new Map() - - return { - StorageService: { - getItem: jest.fn(async (key: string) => store.get(key) ?? null), - setItem: jest.fn(async (key: string, value: string) => { - store.set(key, value) - return true - }), - removeItem: jest.fn(async (key: string) => { - store.delete(key) - return true - }), - clearAll: jest.fn(async (keys: string[]) => { - keys.forEach((key) => store.delete(key)) - return true - }), - }, - } -}) - -jest.mock('common-ui/src/services/StorageServiceCasual', () => { - const store = new Map() - - return { - StorageServiceCasual: { - getItem: jest.fn(async (key: string) => store.get(key) ?? null), - setItem: jest.fn(async (key: string, value: string) => { - store.set(key, value) - return true - }), - removeItem: jest.fn(async (key: string) => { - store.delete(key) - return true - }), - clearAll: jest.fn(async (keys: string[]) => { - keys.forEach((key) => store.delete(key)) - return true - }), - }, - } -}) - -/** - * Freeze the clock so date-sensitive screens (slots, orders, banners) are - * deterministic. Move it with jest.setSystemTime / advanceTimersByTime. - */ -jest.useFakeTimers({ now: Date.now() }) diff --git a/apps/backend/creds/demo.txt b/apps/backend/creds/demo.txt index 107ae7c..e69de29 100644 --- a/apps/backend/creds/demo.txt +++ b/apps/backend/creds/demo.txt @@ -1,35 +0,0 @@ -Review and fix the top 3 React Doctor findings in user-ui. Leave the rest for a follow-up. - -1. WARN Maintainability: React function has high control-flow complexity (×15) - `Login` has cyclomatic complexity 30, cognitive complexity 30, and maximum nesting depth 3, so its React logic is hard to understand and change. Extract independent branches into components or hooks. - Curl with no cache & follow the canonical fix and false positive check recipe before fixing: https://react.doctor/docs/rules/react-doctor/no-high-complexity-react-function - - app/(auth)/login.tsx:15 - - app/(drawer)/(tabs)/me/my-orders/[id].tsx:14 - - app/(drawer)/(tabs)/me/my-orders/index.tsx:74 - - +11 more files -2. WARN Maintainability: Large component is hard to read and change (×11) - Component "Login" is over 300 lines long, which is hard to read & change. Split it into a few smaller components. - Curl with no cache & follow the canonical fix and false positive check recipe before fixing: https://react.doctor/docs/rules/react-doctor/no-giant-component - - app/(auth)/login.tsx:15 - - app/(drawer)/(tabs)/me/my-orders/[id].tsx:14 - - components/PaymentAndOrderComponent.tsx:32 - - +8 more files -3. WARN Performance: State only used in handlers (×10) - Each update to "passwordBackTo" redraws your component for nothing because this useState is set but never shown on screen. - Curl with no cache & follow the canonical fix and false positive check recipe before fixing: https://react.doctor/docs/rules/react-doctor/rerender-state-only-in-handlers - - app/(auth)/login.tsx:19 - - app/(drawer)/(tabs)/me/my-orders/index.tsx:373 - - components/ProductCard.tsx:55 - - +3 more files - -Full results for all 121 issues (diagnostics.json + a .txt per rule): /var/folders/6t/3blzq7_j6p95xzry6t7c14hw0000gn/T/react-doctor-d12050a6-1365-4f35-8c90-23fa748a45bd - -Read each file and fix the root cause — don't suppress or silence the rule. - -Findings that share a `fixGroupId` (in diagnostics.json) are one root cause — a single fix clears all of them, so treat each `fixGroupId` as ONE task, not one per site. - -Verify against the real thing, don't assume: confirm each change matches the canonical fix recipe you fetched for that rule, then re-run `npx react-doctor@latest --verbose` and check the issue is actually gone against the real tool before moving on. - -Teach me as you go: for every issue you touch, explain it in plain language (no jargon) — what the problem is, why it's a problem, and how serious it is in human terms. Describe the real-world impact and severity concretely (e.g. "this crashes the page for users on Safari" vs. "this is a minor cleanup with no user impact") so I understand why it matters, not just what changed. - -Stop after this pass. Summarize the remaining findings for a follow-up. \ No newline at end of file diff --git a/apps/backend/tests/.env b/apps/backend/tests/.env deleted file mode 100644 index e61a194..0000000 --- a/apps/backend/tests/.env +++ /dev/null @@ -1,10 +0,0 @@ -# Backend API tests — fill these in before running `bun run test:api`. -# This file is git-ignored. - -API_BASE_URL=http://localhost:8787 - -ADMIN_NAME=shafi -ADMIN_PASSWORD=shafI123 - -USER_IDENTIFIER=9676651496 -USER_PASSWORD=meatfarmer@123 diff --git a/apps/backend/tests/.env.example b/apps/backend/tests/.env.example deleted file mode 100644 index eb1a86f..0000000 --- a/apps/backend/tests/.env.example +++ /dev/null @@ -1,14 +0,0 @@ -# Backend API tests — copy this file to `tests/.env` and fill in the values. -# `tests/.env` is git-ignored. - -# Backend base URL. `bun run dev` serves wrangler dev on :8787. -API_BASE_URL=http://localhost:8787 - -# Staff (admin-ui) credentials — used for admin.* procedures. -ADMIN_NAME= -ADMIN_PASSWORD= - -# User (app) credentials — used for user.* procedures. -# USER_IDENTIFIER is the email or the 10-digit mobile number. -USER_IDENTIFIER= -USER_PASSWORD= diff --git a/apps/backend/tests/BUGS.md b/apps/backend/tests/BUGS.md deleted file mode 100644 index 44e0f11..0000000 --- a/apps/backend/tests/BUGS.md +++ /dev/null @@ -1,545 +0,0 @@ -# Known bugs — apps/backend - -Found while writing the API integration suites under `tests/api/`. Each entry -gives the source location, the actual behaviour, the expected behaviour and the -test that pins it. Severity is my judgement of impact. - ---- - -## High — security / data integrity - -### 1. A user token can perform admin writes (missing staff guard) - -`src/trpc/trpc-index.ts` — `protectedProcedure` only requires *some* identity -(`ctx.user` OR `ctx.staffUser`). Many `admin.*` procedures never re-check -`ctx.staffUser`, so a plain user token can call them. - -Confirmed reachable with a user token: - -- `admin.order.cancelOrder` — cancel any order -- `admin.user.updateUserSuspension` — suspend any user -- `admin.user.sendNotification` — broadcast notifications -- `admin.product.toggleOutOfStock` (and the other `admin.product.*` writes) -- `admin.staffUser.createStaffUser` — **create a usable staff account (privilege escalation)**; the new account can log in - -Procedures that *do* guard correctly: `admin.slots.*`, `admin.coupon.create`, -`admin.coupon.createReservedCoupon` (they check `ctx.staffUser?.id`). - -**Fix:** add a `staffProcedure` (or a `ctx.staffUser` check) to every `admin.*` -write. - -**Pinned by:** `tests/api/authorization-matrix.test.ts`. - -> **Fixed (FC-01/SEC-01), route removed:** the merged staff `admin.const.*` route is -> gone. It had no production caller (the admin apps use `admin.region.*`, the -> superadmin UI uses `superadmin.const.*`) and was the last place that could rebuild -> every region's cache files on a region-key change, hand a staff token a merged read -> of global constants, and accept bound-scope keys while silently dropping them. -> Writes now go to the scope-specific routes, all of which are `staffProcedure` / -> `superadminProcedure` and scope-checked (`assertConstantKeysInScope`). -> `apps/backend/tests/helpers/consts.ts` reads/writes bound + region constants through -> those routes; legacy constants have no staff-readable endpoint by design, so the api -> tests no longer cover them. The remaining entries above are still open. - -### 2. Public `admin.vendorSnippets` endpoints - -`src/trpc/apis/admin-apis/apis/vendor-snippets.ts` - -- `getUpcomingSlots:176? / 259` — `publicProcedure` -- `getOrdersBySnippet:176` — `publicProcedure`, returns order/customer data for a snippet code -- `getOrdersBySnippetAndSlot:275` — `publicProcedure` -- `updateOrderItemPackaging:362` — `publicProcedure` with the staff check **commented out** (lines 355-360), so anyone can flip packaging state - -**Fix:** require staff on all four. - -**Pinned by:** `tests/api/authorization-matrix.test.ts`. - -### 3. `user.auth.updateProfile` always throws - -`src/trpc/apis/user-apis/apis/auth.ts:342` - -```ts -const authHeader = ctx.req.header('authorization'); -``` - -`ctx.req` is a fetch `Request` (see `src/app.ts` context: `{ req, c, ... }`), -which has `.headers.get(...)`, not `.header(...)`. The call throws -`TypeError: ctx.req.header is not a function`. - -Worse, the profile update (`updateUserProfileInDb`) and the profile image URL -resolving both run *before* line 342, so the write is committed and the client -still receives an error — a silent partial success. - -**Fix:** `ctx.req.headers.get('authorization')` (or use `ctx.c`). - -**Pinned by:** `tests/api/misc-procedures.test.ts` — "pins: updateProfile -crashes after writing the change". - -> **Fixed (FC-15/AU-07):** `Context.req` is now typed as the fetch `Request` the -> adapter actually passes, and `updateProfile` reads -> `ctx.req.headers.get('authorization')`. The optional email was also relaxed: -> an empty email means "no change" (the client only requires it when registering). - -### 4. `user.auth.updatePassword` silently does nothing - -`packages/db_helper_sqlite/src/user-apis/auth.ts:177` (`upsertUserPassword`) - -```ts -try { - await db.insert(userCreds).values({ userId, userPassword: hashedPassword }) - return -} catch (error) { - if (error.code === '23505') { /* postgres unique violation -> UPDATE */ } - throw error -} -``` - -`user_creds` has **no UNIQUE constraint on `user_id`** (schema: `id, user_id, -user_password, created_at`), and `23505` is the *Postgres* unique-violation code -— on D1 the insert simply succeeds. Result: a second credentials row is created, -`getUserAuthCreds` keeps returning the original row, and the account's password -never changes. - -Verified: after "updating" the password, the **old password still logs in** and -the new one is rejected; the user now has duplicate rows in `user_creds`. - -**Fix:** add a UNIQUE index on `user_creds.user_id` and handle the SQLite -constraint code, or do an explicit select-then-insert/update. - -**Pinned by:** `tests/api/misc-procedures.test.ts` — "pins: updatePassword -reports success but the old password still works". - -> **Fixed (FC-16/AU-08):** `upsertUserPassword` now does an explicit -> select-then-update-or-insert (updating every row for the user, which also -> repairs existing duplicates), and a `uniqueIndex` on `user_creds.user_id` was -> added to the schema. Existing duplicate rows must be deduped before the index -> migration can be applied (the local DB has duplicates for users 379, 908, 1311). - ---- - -## High — money - -### 5. A ≥100% coupon produces a negative order total - -`packages/db_helper_sqlite/src/user-apis/order.ts` (`applyDiscountToOrder`) - -The percentage branch caps the discount at `maxValue * proportion` or `Infinity` -and **never at `orderTotal`** (the flat branch does cap at the order total). A -coupon with `discountPercent >= 100` and no `maxValue` therefore drives -`orders.totalAmount` to zero or negative. `admin.coupon.create` accepts any -`discountPercent` (no upper bound). - -**Pinned by:** `tests/api/coupon-math.test.ts` — "pins: a 150% coupon produces a -negative total". - -### 6. The discount is applied to the delivery-inclusive base - -`src/trpc/apis/user-apis/apis/order.ts:156` - -```ts -const orderTotalAmount = isFirstOrder ? subOrderTotalWithDelivery : subOrderTotal; -``` - -`isFirstOrder` is true for the **first sub-order of every placeOrder call**, so -that sub-order's discount is computed on `goods + deliveryCharge`. A percentage -coupon therefore discounts the delivery fee as well. - -**Pinned by:** `tests/api/coupon-math.test.ts` — "pins: a percentage coupon -discounts the delivery fee too". - -> **Fixed (FC-08):** `placeOrderUtil` now computes the coupon discount on the -> whole cart **subtotal** and decides delivery on the **post-discount** total -> (`finalTotal < freeDeliveryThreshold`), mirroring the customer app. A -> percentage coupon no longer touches the delivery fee. (FC-07 is fixed too: the -> threshold key is now `freeDeliveryThreshold`, not `minRegularOrderValue`.) - -### 7. Money is never rounded - -Nothing rounds `totalAmount`; it is written with `.toString()` on a raw float, so -percentage discounts leave float noise (e.g. `999 - 15%`). - -**Pinned by:** `tests/api/coupon-math.test.ts` — "pins: amounts are stored -unrounded". - -> **Fixed (coupon stacking):** coupon discounts are now rounded to the nearest -> rupee in the shared `computeCartPricing` / `computeCouponStack` -> (`packages/shared/cart-pricing.ts`) and multiple coupons stack **sequentially in -> the order the customer applied them**. `orders.totalAmount` no longer carries -> float noise. - ---- - -## Medium — coupon rules - -### 8. Coupon scoping is not enforced at placeOrder - -`validateAndGetCoupon` checks invalidated / expiry / per-user limit / minOrder / -first-order-only, but **not** `isUserBased`, `applicableUsers`, `skuIds` or -`exclusiveApply`. Only the display endpoints (`getEligible` / `getMyCoupons`) -filter by applicability, so user B can spend a coupon issued to user A by -passing its id to `placeOrder`. - -**Pinned by:** `tests/api/coupon-ux.test.ts` — "rejects user B applying a coupon -issued to user A". - -> **FIXED 2026-10-11:** `validateAndGetCoupons` now enforces, per coupon: user-based -> applicability, `skuIds`/`coupon_applicable_products` product targeting (the coupon must -> match at least one cart line, and `minOrder` compares against the targeted subtotal), -> region (`coupons.regionId` null = global, else the order's region), and `exclusiveApply` -> (an exclusive coupon cannot be combined with any other). The customer coupon list -> (`getEligible`/`getMyCoupons`) is region-filtered too. - -### 9. Cancelling an order does not release its coupon usage - -`recordUserCouponUsage` runs at placement; `cancelOrderTransaction` never touches -`coupon_usage`. A cancelled order permanently consumes a `maxLimitForUser` slot. - -**Pinned by:** `tests/api/order-lifecycle-gaps.test.ts` — "pins: cancelling an -order does not release its coupon usage". - -> **FIXED 2026-10-11:** both cancel paths now delete the group's `coupon_usage` -> row(s) once **every** sibling order sharing the `orderGroupId` is cancelled -> (`releaseCouponUsageIfGroupFullyCancelled`, called from `cancelOrderTransaction` -> and admin `cancelOrder`). A lone order counts as "all" and releases on cancel. -> The lifecycle tests now assert the release. - -### 10. A cancelled first order poisons an `isFirstOrderOnly` coupon - -`getOrderCount` counts every order including cancelled ones, and -`isUserBased`/first-order checks run off it — so placing and cancelling a first -order permanently blocks a first-order-only coupon for that user. - -**Pinned by:** `tests/api/order-lifecycle-gaps.test.ts` — "pins: a cancelled -first order poisons an isFirstOrderOnly coupon". - -> **FIXED 2026-10-11:** first-order eligibility now uses `countEffectiveOrders` -> — distinct, non-cancelled order groups (a split placement counts once, a -> cancelled order not at all). `getOrderCount` keeps its row-count meaning for -> pagination. The lifecycle test now asserts the coupon still applies. - -### 11. Reserved-coupon expiry is not checked at redemption — **FIXED 2026-10-10** - -`redeemReservedCoupon` checked "already redeemed" and first-order-only, but not -`validTill`, so an expired reserved code still redeemed (it only failed later at -`placeOrder`) and the secret was burned for a dead coupon. - -**Fix:** the redeem route now rejects `validTill < now` with "This coupon has -expired" (policy: one deadline for both claiming the secret and spending the -coupon), and `redeemReservedCoupon` claims the secret with a conditional update -(`WHERE is_redeemed = 0`) before creating the coupon, so two customers racing the -same code can no longer both receive one. - -**Covered by:** `tests/api/coupon-ux.test.ts` — "rejects an expired reserved -code" and "lets only one of two simultaneous claims win". - -### 12. `exclusiveApply` is stored but never enforced - -Coupons carry `exclusiveApply`, and `placeOrder` accepts a single `couponId`, so -the flag has no effect anywhere. (Observation from reading the code; no runtime -test.) - -> **FIXED 2026-10-11:** orders now accept `couponIds: number[]` and -> `validateAndGetCoupons` rejects any combination where one coupon is exclusive -> (it must be the only coupon on the order). - ---- - -## Medium — placeOrder guards - -### 13. Out-of-stock products are still orderable - -`placeOrderUtil` checks `isFlashAvailable` for flash orders but never -`isOutOfStock`. - -**Pinned by:** `tests/api/place-order-edge-cases.test.ts`. - -> **Fixed (FC-03/SEC-05):** `placeOrderUtil` now rejects a product that is -> `isDeleted`, `isOutOfStock` or `isSuspended` (400 "… is unavailable"). The -> cross-region-SKU case (FC-02/SEC-04) is rejected too: the SKU's product -> `regionId` must equal the order region (409). - -### 14. An empty `selectedItems` list fails with a raw DB error - -There is no `.min(1)` on `selectedItems`, so an empty list reaches Drizzle, which -throws `values() must be called with at least one value` instead of returning a -400. - -**Pinned by:** `tests/api/place-order-edge-cases.test.ts`. - -### 15. No quantity cap - -`quantity` is `z.number().int().positive()` with no upper bound; `1_000_000` -units are accepted. - -**Pinned by:** `tests/api/place-order-edge-cases.test.ts`. - -### 16. No slot validity checks - -`placeOrder` only checks slot *capacity*. An inactive slot, a slot whose delivery -time has already passed, and a slot that does not carry the ordered SKU are all -accepted. - -**Pinned by:** `tests/api/place-order-edge-cases.test.ts`. - -> **Fixed (FC-03/SEC-05, FC-13/SL-04):** `placeOrderUtil` now requires a -> non-null `slotId` for scheduled orders and validates the slot: it must exist, -> belong to the order region (409), be `isActive`, have `freezeTime > now` and -> `deliveryTime > now`, and carry every ordered `skuId` in `slot.skuIds` (400 -> otherwise). - -### 17. No idempotency - -Two identical `placeOrder` calls create two orders (`orderGroupId` is -`Date.now()-userId`, with no uniqueness check). - -**Pinned by:** `tests/api/place-order-edge-cases.test.ts`. - -> **Mitigated client-side (FC-17/OR-12):** the Place Order button is disabled while a -> submit is in flight and `handlePlaceOrder` early-returns via a synchronous `useRef` -> guard, so an accidental double-tap cannot submit twice. **Server-side idempotency is -> still absent** — a direct API replay or network retry can create duplicates. A -> client-generated idempotency key remains the proper fix if/when wanted. - ---- - -## Low — error handling / lifecycle - -### 18. `cancelOrder` swallows every error into one generic message - -`src/trpc/apis/user-apis/apis/order.ts:554-599` wraps the whole handler in a -`try/catch` that rethrows `new ApiError("failed to cancel order")`, discarding -the specific 404/400 messages it constructs ("Order not found", "Order is already -cancelled", "Cannot cancel delivered order"). `updateUserNotes`, by contrast, has -no catch and propagates its real messages. - -**Pinned by:** `tests/api/order-lifecycle-gaps.test.ts` and -`tests/api/authorization-matrix.test.ts`. - -### 19. No order status transition guards - -`admin.order.updateDelivered` / `updatePackaged` accept any state: a cancelled -order can be marked delivered, and delivered is reversible. - -**Pinned by:** `tests/api/order-lifecycle-gaps.test.ts`. - -### 20. `getUserDetails` breaks past ~110 orders - -`admin.user.getUserDetails` builds an unchunked `IN (...)` over the user's order -ids and fails once the history is large. Documented in -`tests/api/admin-users.test.ts` (that suite uses a throwaway user to avoid it). - ---- - -### 21. Bound pricing followed a client-supplied `boundId` — **FIXED 2026-10-10** - -`placeOrderUtil` resolved the delivery charge and free-delivery threshold from -`params.boundId ?? getEffectiveBoundId(regionId)`. `boundId` is a plain optional -mutation input, and `getRegionSettingsForBound` only checked that the bound -belongs to the **region** — never to the order's **address**. So an order against -an address in bound 2 (₹200 / free above ₹800) could be placed with `boundId: 1` -(₹20 / free above ₹300) and be charged ₹20. The address's own `boundId` was never -read on this path. - -**Fix (policy):** the delivery address's bound is authoritative — -`address.boundId ?? params.boundId ?? getEffectiveBoundId(regionId)`. This mirrors -the customer app, which already prices the selected address's bound -(`apps/user-ui/src/hooks/prominent-api-hooks.ts` → `useGetEssentialConsts`), and -keeps the bound-less-address fallback intact. Verified live: address 879 (bound 2) -+ `boundId: 1` now charges ₹200 (was ₹20); a bound-less address still honours the -client bound (₹20 for bound 1, ₹200 for bound 2). - -**No regression test yet:** the suite has no bound fixtures and no superadmin -session helper, so it cannot create a second bound to compare against. - ---- - -### 22. Explicit rebalance dropped the delivery charge — **FIXED 2026-10-10** - -`rebalanceSlots` repriced an order as `total = items(latest prices) − discount`, -never adding `deliveryCharge` back — so every rebalanced order lost its fee from -the payable (while the `delivery_charge` column kept the old value). It also -re-derived the discount from the coupon's **current** state and looked it up per -order, so invalidating/expiring a coupon silently raised a historical total, and -multi-slot sub-orders (which own no `coupon_usage` row) lost their prorated -discount entirely. Delivered and cancelled orders were repriced too. - -**Fix (policy): freeze the historic discount and delivery fee; rebalance only -product prices.** The charged discount is recovered from the stored row itself -(`items + fee − total`), which is immune to later coupon changes and preserves a -sub-order's prorated share; the fee is added back; delivered/cancelled orders are -skipped; a SKU with no price for the region keeps its stored price instead of -dropping to 0. Verified live: a no-op rebalance now leaves the payable untouched, -an invalidated coupon no longer changes it, and repricing keeps -`items − frozen discount + fee`. - -**Known residue:** the customer/admin order **detail display** still recomputes -the discount from the coupon, so after a reprice it can show a discount that -differs from the frozen one (the payable is correct). Same family as the A23 -display decision; `db.transaction` is still the no-op stub, so the write loop is -not atomic; money is still written unrounded (see #7). Orders rebalanced by the -old code carry a phantom discount equal to the dropped fee and were not -auto-repaired. - ---- - -### 23. `updateProduct` stored unvalidated image keys — **FIXED 2026-10-10** - -`createProduct` validated every referenced image -(`skus.flatMap((s) => s.images)` → `assertUploadUrlsClaimable` → `claimUploadUrls`), but -`updateProduct` validated only the declared `newImageUrls` and then wrote -`skus[].images` straight through (`extractKeyFromPresignedUrl` → `updateProductInDb`) -with no check and no claim. A fabricated key therefore produced a permanently -broken image, and another product's already-claimed key could be silently reused -(`createProduct` rejects that as "already used"). - -**Fix:** validate the *delta* — the keys the product does not already own (via a -new `getProductImageKeys(regionId, productId)` helper) plus `newImageUrls` — -before the write, and claim them after it. The product's own images may be -re-sent by the edit form untouched. Verified live: fabricated key → rejected with -nothing written; another product's claimed image → rejected; own image re-sent → -200; genuine pending upload → 200 and claimed. - -Banners, stores and global stores also convert URLs to keys without this guard, -but the upload endpoint only issues the contexts -`review | product_info | notification | complaint | profile | tags`, so those -images are never registered in `upload_url_status` — guarding them would reject -legitimate images. - ---- - -### 24. Editing an address cleared its default flag — **FIXED 2026-10-10** - -`user.address.updateAddress` forwarded `isDefault: isDefault || false` while the -input schema declares `isDefault` **optional**. An edit that omitted the field — -the natural partial update — therefore unset the address's default and left the -user with **zero** default addresses. (`createAddress` computes -`makeDefault = isDefault || no-other-addresses`, so it never had the bug; the -AddressForm and checkout selector already send the current value, so the UI did -not expose it.) - -**Fix:** `isDefault: isDefault ?? existingAddress.isDefault` — omitted keeps the -current value, explicit `true` sets it and clears the other addresses' defaults, -explicit `false` still clears it. - -**Related, still open:** explicitly sending `isDefault: false` (or deleting the -only default address, see AD-08) can still leave a user with no default. - ---- - -### 25. Address phone/pincode were unvalidated — **FIXED 2026-10-10** - -`user.address.createAddress` / `updateAddress` accepted any non-empty string for -`phone` and `pincode` (only `min(1)`), so `phone: "123"` and `pincode: "12"` were -persisted. The app's form validated both client-side, so only a non-app client -could store garbage — which is what the run did. - -**Fix (rule):** phone = exactly 10 digits starting **6/7/8/9**; pincode = exactly -6 digits, enforced in both procedures, with the UI's phone regex aligned. Verified -live: `123` / `1234567890` / `5678901234` / 9-digit / 11-digit phones and 5-digit / -7-digit / non-numeric pincodes all return **400**; a valid pair is accepted; the -update path rejects too. - -**Note:** zod-level input validation already surfaces as HTTP 400 — only -`ApiError` throws are flattened to 500 (see #… / A19). - ---- - -### 26. A user could delete their only address — **FIXED 2026-10-10** - -`user.address.deleteAddress` guarded against an address attached to an ongoing -order and against the **default** address, but nothing stopped the user deleting -their **only** address — leaving an account with nowhere to deliver to (the same -zero-address state that editing could reach, see #24). The refusals were also -plain `Error`s, so they surfaced as HTTP 500. - -**Fix (rule):** deleting the user's only address is refused with -“This is your only address. Add another address before deleting this one.”, and -the app shows it in a **BottomDialog** (checked before the “are you sure?” step -and again from the mutation's `onError`). The other refusals now throw `ApiError` -(409 / 404) so they reach the customer as 4xx. - -**Still open:** explicitly sending `isDefault: false` for the last default can -still leave an account with no default address. - ---- - -### 27. `updateProductPrices` addressed SKUs as `productId` — **FIXED 2026-10-10** - -`admin.product.updateProductPrices` took `updates[].productId`, but the helper -validated it against `productSkus.id` and wrote `product_market_stats.skuId`. A -product id therefore landed on whatever SKU carried the same number (product ids -and SKU ids are separate, overlapping sequences), and the response still said -“Updated prices for N **product(s)**”. An entry with no price field wrote nothing -yet was counted as updated and reported as a success. - -**Fix:** the input field is **`skuId`** (no alias), the messages say SKU, an entry -with no price field is rejected up front -(`No price fields to update for SKU(s): …`), and `updatedCount` counts rows actually written. The admin-ui and admin-web price screens were updated, along with -three test payloads — `cache-invalidation.test.ts` had been passing a *product* id -and only passed while the two ids happened to coincide. - -**Residual (accepted):** id *values* still overlap, so a caller that passes a -product id for `skuId` still hits the same-numbered SKU. That is now an explicit -caller error rather than an API trap; mapping a product id to its SKUs is -deliberately not done because that ambiguity is what caused the bug. - ---- - -### 28. Business errors left tRPC as HTTP 500 — **FIXED 2026-10-10** - -`errorLoggerMiddleware` translated our `ApiError` to a `TRPCError` inside a -`try/catch` around `next()`. In tRPC 11 that catch is **unreachable for resolver -errors**: `callRecursive` catches them and returns the middleware a -`{ ok: false, error }` result, and `getTRPCErrorFromUnknown` has already wrapped a -non-`TRPCError` as `INTERNAL_SERVER_ERROR` (keeping the original on `cause`) — -which is why every business rejection arrived as HTTP 500 with the correct -message. - -**Fix:** the middleware now inspects the result and re-throws -`translateResultError(result.error)`, which maps `result.error.cause` **only** when -it is an `ApiError`, so zod `BAD_REQUEST`s, `UNAUTHORIZED`s and genuine 500s keep -the code tRPC gave them. Verified live: 400 (expired reserved coupon, duplicate -product name, bogus upload URL on product + tag, wrong-scope const writes on both -admin and superadmin), 403 (capacity-full slot), 409 (only address, default -address, address on an open order); controls unchanged (400 zod, 404 unknown -procedure, 401 no token). - -**Residual:** business rejections thrown as **plain `Error` inside the db-helper -packages** still return 500 — `validateAndGetCoupon` (`not applicable`, `Coupon has -expired`, invalidated, usage-limit, min-order, first-order-only) is the main one. -Those need a status attached at the throw site (or a package-level ApiError). - ---- - -### 29. Global products were visible but unusable — **FIXED 2026-10-10** - -A product with `regionId = null` is **global**: every catalogue read path serves it in -every region (`or(eq(productInfo.regionId, regionId), isNull(productInfo.regionId))` in -`user-apis/stores.ts`, `admin-apis/product.ts`), so customers saw global products with a -regional price. The write guards disagreed: - -- `placeOrderUtil` (SEC-04) required `product.regionId === regionId` and its comment read - *“a product with no region is treated as not available anywhere”* → ordering a global SKU - failed with **409 `Product N is not available in this region`** (verified live with SKU 102). -- `assertSkuIdsInRegion` in `slots.ts` / `banner.ts` / `coupon.ts` rejected a global SKU as - *“belongs to a different region”* → a global product could not be attached to a region slot, - and a scheduled order needs its SKU in the slot. - -**Fix (rule):** a SKU is acceptable when its product's region is **`null` (global) or the target -region**. `placeOrderUtil` now allows globals, and the three `assertSkuIdsInRegion` copies accept -them. `admin-apis/product.ts` already allowed a global SKU inside a regional product. - -**Verified live:** global SKU 102 attached to region-1 slot 2036 → 200; a scheduled order for it -→ 200 (Basa Fish Fillets ₹498, free delivery above the threshold); a genuine region-2 SKU is still -rejected when attached to a region-1 slot and at order time (409). The scheduled slot-SKU -verification is unchanged. - -**Not changed:** `admin-apis/vendor-snippets.ts` has the same assert but vendor snippets are -deprecated/out of scope. - ---- - -## Out of scope (per request) - -OTP (`sendOtp`/`verifyOtp`) and `deleteAccount` are deliberately untested and not -listed here. Online payments were removed from the product (COD-only). diff --git a/apps/backend/tests/api/admin-banners.test.ts b/apps/backend/tests/api/admin-banners.test.ts deleted file mode 100644 index caf488b..0000000 --- a/apps/backend/tests/api/admin-banners.test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Admin banner CRUD. `imageUrl` must be a URL; the backend extracts an object key - * from it, so a plausible bucket URL is enough (nothing is uploaded here). - */ - -import { apiClient } from '../helpers/api' -import { staffSession } from '../helpers/sessions' - -const IMAGE_URL = 'https://assets2.freshyo.in/banner-images/api-test.png' - -describe('admin banner CRUD', () => { - let admin: ReturnType - let bannerId = 0 - - beforeAll(async () => { - const staff = await staffSession() - admin = apiClient(staff.token) - }) - - it('getBanners returns a banners array', async () => { - const res = await admin.admin.banner.getBanners.query() - expect(Array.isArray(res.banners)).toBe(true) - }) - - it('createBanner creates a banner that getBanner returns', async () => { - const name = `API Test Banner ${Date.now()}` - - const created = await admin.admin.banner.createBanner.mutate({ - name, - imageUrl: IMAGE_URL, - description: 'Created by API tests', - }) - bannerId = (created as { id: number }).id - - expect(bannerId).toBeGreaterThan(0) - - const fetched = await admin.admin.banner.getBanner.query({ id: bannerId }) - expect(fetched?.name).toBe(name) - }) - - it('updateBanner renames the banner', async () => { - const name = `API Test Banner renamed ${Date.now()}` - - await admin.admin.banner.updateBanner.mutate({ id: bannerId, name }) - - const fetched = await admin.admin.banner.getBanner.query({ id: bannerId }) - expect(fetched?.name).toBe(name) - }) - - it('deleteBanner removes it', async () => { - const res = await admin.admin.banner.deleteBanner.mutate({ id: bannerId }) - expect(res.success).toBe(true) - - const fetched = await admin.admin.banner.getBanner.query({ id: bannerId }) - expect(fetched).toBeNull() - }) -}) diff --git a/apps/backend/tests/api/admin-catalog.test.ts b/apps/backend/tests/api/admin-catalog.test.ts deleted file mode 100644 index f97cac8..0000000 --- a/apps/backend/tests/api/admin-catalog.test.ts +++ /dev/null @@ -1,114 +0,0 @@ -/** - * Admin read/update surface: store, product, groups, coupons, vendor snippets - * and complaints — all with the staff token. - */ - -import { apiClient } from '../helpers/api' -import { createStoreWithSku, type StoreWithSku } from '../helpers/fixtures' -import { staffSession } from '../helpers/sessions' - -describe('admin catalog surface', () => { - let admin: ReturnType - let store: StoreWithSku - let staffId = 0 - - beforeAll(async () => { - const staff = await staffSession() - staffId = staff.staffId - admin = apiClient(staff.token) - store = await createStoreWithSku() - }) - - it('getStoreById returns the created store', async () => { - const res = await admin.admin.store.getStoreById.query({ id: store.storeId }) - expect(res.store?.id).toBe(store.storeId) - }) - - it('updateStore renames the store', async () => { - const name = `${store.storeName} (renamed)` - - await admin.admin.store.updateStore.mutate({ - id: store.storeId, - name, - owner: staffId, - description: 'Renamed by API tests', - }) - - const after = await admin.admin.store.getStoreById.query({ id: store.storeId }) - expect(after.store.name).toBe(name) - }) - - it('getProductById returns the product with its SKU', async () => { - const res = (await admin.admin.product.getProductById.query({ - id: store.productId, - })) as { - product?: { id: number; skus?: { id: number }[] } - id?: number - skus?: { id: number }[] - } - const product = res.product ?? res - - expect(product.id).toBe(store.productId) - expect(product.skus!.some((s) => s.id === store.skuId)).toBe(true) - }) - - it('updateProduct renames the product', async () => { - const name = `${store.productName} (renamed)` - - await admin.admin.product.updateProduct.mutate({ - id: store.productId, - name, - storeId: store.storeId, - productType: 'item', - skus: [ - { - id: store.skuId, - price: 199, - // The backend requires a feature literally named "quantity". - features: [{ featureName: 'quantity', featureValue: '1pc' }], - }, - ], - }) - - // Read back through the list — a known shape. - const list = await admin.admin.product.getProducts.query() - const product = list.products.find((p) => p.id === store.productId) - expect(product?.name).toBe(name) - }) - - it('getGroups lists product groups', async () => { - const res = await admin.admin.product.getGroups.query() - expect(Array.isArray(res.groups)).toBe(true) - }) - - it('createGroup adds a group that getGroups returns', async () => { - const groupName = `API Test Group ${Date.now()}` - - await admin.admin.product.createGroup.mutate({ - group_name: groupName, - description: 'Created by API tests', - product_ids: [store.skuId], - }) - - const res = await admin.admin.product.getGroups.query() - const names = res.groups.map( - (g: { groupName?: string; group_name?: string }) => g.groupName ?? g.group_name - ) - expect(names).toContain(groupName) - }) - - it('coupon.getAll returns a coupons array', async () => { - const res = await admin.admin.coupon.getAll.query({ limit: 5 }) - expect(Array.isArray(res.coupons)).toBe(true) - }) - - it('vendorSnippets.getAll returns an array', async () => { - const res = await admin.admin.vendorSnippets.getAll.query() - expect(Array.isArray(res)).toBe(true) - }) - - it('complaint.getAll returns a complaints array', async () => { - const res = await admin.admin.complaint.getAll.query({ limit: 10 }) - expect(Array.isArray(res.complaints)).toBe(true) - }) -}) diff --git a/apps/backend/tests/api/admin-ops.test.ts b/apps/backend/tests/api/admin-ops.test.ts deleted file mode 100644 index 6528167..0000000 --- a/apps/backend/tests/api/admin-ops.test.ts +++ /dev/null @@ -1,136 +0,0 @@ -/** - * Admin ops: config round-trip, group/product/store lifecycle, and two orders - * placed concurrently. - */ - -import { apiClient, captureError, uniqueSuffix } from '../helpers/api' -import { getRegionConstants, setRegionConst } from '../helpers/consts' -import { createFutureSlot, createStoreWithSku, ensureUserAddress } from '../helpers/fixtures' -import { staffSession, userSession } from '../helpers/sessions' - -describe('admin ops', () => { - let admin: ReturnType - let user: ReturnType - let staffId = 0 - let skuId = 0 - - beforeAll(async () => { - const staff = await staffSession() - staffId = staff.staffId - admin = apiClient(staff.token) - - const session = await userSession() - user = apiClient(session.token) - - // A suspended user is rejected by placeOrder — make sure the shared test user - // is active regardless of what other suites left behind. - await admin.admin.user.updateUserSuspension.mutate({ - userId: session.userId, - isSuspended: false, - }) - - const store = await createStoreWithSku() - skuId = store.skuId - }) - - it('round-trips a region constant through updateRegionConstants', async () => { - const before = await getRegionConstants() - const original = before.welcomeMessage - const next = `API welcome ${uniqueSuffix()}` - - await setRegionConst('welcomeMessage', next) - expect((await getRegionConstants()).welcomeMessage).toBe(next) - - // Restore whatever the region had (a string, or no row at all). - await setRegionConst('welcomeMessage', typeof original === 'string' ? original : null) - }) - - it('updates and deletes a product group', async () => { - const base = `API Group ${uniqueSuffix()}` - const renamed = `${base} renamed` - - const created = (await admin.admin.product.createGroup.mutate({ - group_name: base, - product_ids: [skuId], - })) as { group?: { id: number }; id?: number } - const groupId = created.group?.id ?? created.id - expect(groupId).toBeGreaterThan(0) - - await admin.admin.product.updateGroup.mutate({ id: groupId!, group_name: renamed }) - - const groups = await admin.admin.product.getGroups.query() - const name = (g: { groupName?: string; group_name?: string }) => - g.groupName ?? g.group_name - expect(groups.groups.some((g) => name(g) === renamed)).toBe(true) - - await admin.admin.product.deleteGroup.mutate({ id: groupId! }) - - const after = await admin.admin.product.getGroups.query() - expect(after.groups.some((g: { id: number }) => g.id === groupId)).toBe(false) - }) - - it('deleteProduct rejects for a product that still has SKUs', async () => { - // The delete is a hard `delete from product_info`, which fails on the FK from - // the product's SKUs/market stats — so a product cannot be deleted this way. - const target = await createStoreWithSku() - - const error = await captureError(() => - admin.admin.product.deleteProduct.mutate({ id: target.productId }) - ) - - expect(error).toBeInstanceOf(Error) - }) - - it('deletes a store', async () => { - const created = (await admin.admin.store.createStore.mutate({ - name: `API Store to delete ${uniqueSuffix()}`, - owner: staffId, - })) as { store?: { id: number } } - const storeId = created.store!.id - - // NOTE: the input field is `storeId`, not `id`. - const res = await admin.admin.store.deleteStore.mutate({ storeId }) - expect(res).toBeTruthy() - - const error = await captureError(() => - admin.admin.store.getStoreById.query({ id: storeId }) - ) - expect(error).toBeInstanceOf(Error) - }) - - it('rejects deleting a store that still has products', async () => { - const target = await createStoreWithSku() - - const error = await captureError(() => - admin.admin.store.deleteStore.mutate({ storeId: target.storeId }) - ) - expect(error.message).toMatch(/still has products/i) - - // The store (and its products) are untouched. - const still = await admin.admin.store.getStoreById.query({ id: target.storeId }) - expect(still).toBeTruthy() - }) - - it('places two concurrent orders for different slots', async () => { - const slotA = await createFutureSlot([skuId], { deliveryInHours: 4, freezeInHours: 3 }) - const slotB = await createFutureSlot([skuId], { deliveryInHours: 8, freezeInHours: 7 }) - const address = await ensureUserAddress() - - const [a, b] = await Promise.all([ - user.user.order.placeOrder.mutate({ - selectedItems: [{ skuId, quantity: 1, slotId: slotA.slotId }], - addressId: address.addressId, - regionId: 1, - }), - user.user.order.placeOrder.mutate({ - selectedItems: [{ skuId, quantity: 1, slotId: slotB.slotId }], - addressId: address.addressId, - regionId: 1, - }), - ]) - - expect(a.data[0].id).toBeGreaterThan(0) - expect(b.data[0].id).toBeGreaterThan(0) - expect(a.data[0].id).not.toBe(b.data[0].id) - }) -}) diff --git a/apps/backend/tests/api/admin-orders.test.ts b/apps/backend/tests/api/admin-orders.test.ts deleted file mode 100644 index 913c488..0000000 --- a/apps/backend/tests/api/admin-orders.test.ts +++ /dev/null @@ -1,137 +0,0 @@ -/** - * Admin order operations and their user-visible effect. - * - * `admin.order.*` uses a mix of numeric and string ids: - * getOrderDetails / updateNotes / removeDeliveryCharge / cancelOrder -> orderId: number - * updatePackaged / updateDelivered / getSlotOrders -> orderId/slotId: string - */ - -import { apiClient } from '../helpers/api' -import { createFutureSlot, createStoreWithSku, ensureUserAddress } from '../helpers/fixtures' -import { staffSession, userSession } from '../helpers/sessions' - -describe('admin order operations', () => { - let admin: ReturnType - let user: ReturnType - let orderId = 0 - let skuId = 0 - let slotId = 0 - let addressId = 0 - - beforeAll(async () => { - const staff = await staffSession() - admin = apiClient(staff.token) - - const store = await createStoreWithSku() - const slot = await createFutureSlot([store.skuId]) - const address = await ensureUserAddress() - const session = await userSession() - user = apiClient(session.token) - - skuId = store.skuId - slotId = slot.slotId - addressId = address.addressId - - const placed = await user.user.order.placeOrder.mutate({ - selectedItems: [{ skuId, quantity: 1, slotId }], - addressId, - }) - orderId = placed.data[0].id - }) - - it('getAll returns recent orders', async () => { - const res = await admin.admin.order.getAll.query({ limit: 5 }) - expect(Array.isArray(res?.orders)).toBe(true) - }) - - it('getOrderDetails returns the order', async () => { - const details = (await admin.admin.order.getOrderDetails.query({ orderId })) as { - id?: number - } - - expect(details).toBeTruthy() - if (details.id != null) expect(details.id).toBe(orderId) - }) - - it('getSlotOrders lists the orders for a slot (string slotId)', async () => { - const res = await admin.admin.order.getSlotOrders.query({ slotId: String(slotId) }) - expect(res).toBeTruthy() - }) - - it('updateNotes stores admin notes on the order', async () => { - const notes = `Admin note ${Date.now()}` - - await admin.admin.order.updateNotes.mutate({ orderId, adminNotes: notes }) - - const details = (await admin.admin.order.getOrderDetails.query({ orderId })) as { - adminNotes?: string - } - if (details.adminNotes != null) expect(details.adminNotes).toBe(notes) - }) - - it('marks the order packaged', async () => { - const res = await admin.admin.order.updatePackaged.mutate({ - orderId: String(orderId), - isPackaged: true, - }) - expect(res.success).toBe(true) - }) - - it('marks the order delivered and the user sees deliveryStatus "success"', async () => { - const res = await admin.admin.order.updateDelivered.mutate({ - orderId: String(orderId), - isDelivered: true, - }) - expect(res.success).toBe(true) - - const detail = await user.user.order.getOrderById.query({ orderId: String(orderId) }) - expect(String(detail.deliveryStatus).toLowerCase()).toBe('success') - }) - - it('removes the delivery charge', async () => { - await admin.admin.order.removeDeliveryCharge.mutate({ orderId }) - - const detail = await user.user.order.getOrderById.query({ orderId: String(orderId) }) - expect(Number(detail.deliveryCharge)).toBe(0) - }) - - it('updates the address coordinates', async () => { - const res = await admin.admin.order.updateAddressCoords.mutate({ - addressId, - latitude: 16.7488, - longitude: 77.9852, - }) - expect(res).toBeTruthy() - - // NOTE: the coordinates set here are not exposed by the user-facing - // `address.getUserAddresses` read (latitude comes back null/0), so the - // contract under test is the mutation succeeding + the address surviving. - const addresses = await user.user.address.getUserAddresses.query() - expect(addresses.data.some((a) => a.id === addressId)).toBe(true) - }) - - it('cancels a fresh order as staff and the user sees it cancelled', async () => { - // The main order above is already delivered, which admin cancel refuses — - // so place a new one to cancel. - const placed = await user.user.order.placeOrder.mutate({ - selectedItems: [{ skuId, quantity: 1, slotId }], - addressId, - }) - const freshOrderId = placed.data[0].id - - await admin.admin.order.cancelOrder.mutate({ - orderId: freshOrderId, - reason: `Cancelled by API test ${Date.now()}`, - }) - - const detail = await user.user.order.getOrderById.query({ - orderId: String(freshOrderId), - }) - expect(String(detail.orderStatus).toLowerCase()).toMatch(/cancel/) - }) - - it('rebalances the orders for a slot', async () => { - const res = await admin.admin.order.rebalanceSlots.mutate({ slotIds: [slotId] }) - expect(res).toBeTruthy() - }) -}) diff --git a/apps/backend/tests/api/admin-tags.test.ts b/apps/backend/tests/api/admin-tags.test.ts deleted file mode 100644 index 47de2b8..0000000 --- a/apps/backend/tests/api/admin-tags.test.ts +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Admin product-tag CRUD. - */ - -import { apiClient, uniqueSuffix } from '../helpers/api' -import { createStoreWithSku } from '../helpers/fixtures' -import { staffSession } from '../helpers/sessions' - -describe('admin product tag CRUD', () => { - let admin: ReturnType - let tagId = 0 - let tagName = '' - let skuId = 0 - - beforeAll(async () => { - const staff = await staffSession() - admin = apiClient(staff.token) - - const store = await createStoreWithSku() - skuId = store.skuId - }) - - it('creates a tag that getProductTags returns', async () => { - tagName = `API Tag ${uniqueSuffix()}` - - const created = await admin.admin.product.createProductTag.mutate({ - tagName, - tagDescription: 'Created by API tests', - isDashboardTag: true, - }) - tagId = (created as { tag: { id: number } }).tag.id - expect(tagId).toBeGreaterThan(0) - - const list = await admin.admin.product.getProductTags.query() - const tags = Array.isArray(list) - ? list - : ((list as { tags?: { id: number }[] }).tags ?? []) - expect(tags.some((t) => t.id === tagId)).toBe(true) - }) - - it('getProductTagById returns the tag', async () => { - const tag = (await admin.admin.product.getProductTagById.query({ - id: tagId, - })) as unknown as { tag?: { tagName: string }; tagName?: string } - const resolved = tag.tag ?? tag - expect(resolved.tagName).toBe(tagName) - }) - - it('updateProductTag renames the tag', async () => { - const renamed = `${tagName} renamed` - - await admin.admin.product.updateProductTag.mutate({ id: tagId, tagName: renamed }) - - const tag = (await admin.admin.product.getProductTagById.query({ - id: tagId, - })) as unknown as { tag?: { tagName: string }; tagName?: string } - const resolved = tag.tag ?? tag - expect(resolved.tagName).toBe(renamed) - }) - - it('deleteProductTag removes it', async () => { - const res = await admin.admin.product.deleteProductTag.mutate({ id: tagId }) - expect((res as { message?: string }).message ?? '').toMatch(/deleted/i) - - const list = await admin.admin.product.getProductTags.query() - const tags = Array.isArray(list) - ? list - : ((list as { tags?: { id: number }[] }).tags ?? []) - expect(tags.some((t) => t.id === tagId)).toBe(false) - }) - - it('deleteProductTag removes a tag that has products', async () => { - const created = await admin.admin.product.createProductTag.mutate({ - tagName: `API Tag w/ product ${uniqueSuffix()}`, - isDashboardTag: true, - productIds: [skuId], - }) - const id = (created as { tag: { id: number } }).tag.id - - const res = await admin.admin.product.deleteProductTag.mutate({ id }) - expect((res as { message?: string }).message ?? '').toMatch(/deleted/i) - }) -}) diff --git a/apps/backend/tests/api/admin-users.test.ts b/apps/backend/tests/api/admin-users.test.ts deleted file mode 100644 index 008572d..0000000 --- a/apps/backend/tests/api/admin-users.test.ts +++ /dev/null @@ -1,109 +0,0 @@ -/** - * Admin user management: listing, details, incidents, notification audience, - * suspension and the staff list. - * - * Per-user endpoints are exercised against a freshly registered user rather than - * the shared test account: `getUserDetails` builds an unchunked `IN (...)` over - * the user's order ids and fails once that history is large (~110 orders), which - * the shared account has accumulated from repeated runs. (Documented finding.) - * - * sendNotification targets a user with no push token, so nothing is delivered. - */ - -import { apiClient, uniqueSuffix } from '../helpers/api' -import { registerThrowawayUser } from '../helpers/fixtures' -import { staffSession } from '../helpers/sessions' - -describe('admin user management', () => { - let admin: ReturnType - let staffId = 0 - let subjectUserId = 0 - - beforeAll(async () => { - const staff = await staffSession() - staffId = staff.staffId - admin = apiClient(staff.token) - - const subject = await registerThrowawayUser() - subjectUserId = subject.userId - }) - - it('getEssentials returns the dashboard counters', async () => { - const res = await admin.admin.user.getEssentials.query() - expect(typeof res.unresolvedComplaints).toBe('number') - }) - - it('getAllUsers returns users', async () => { - const res = await admin.admin.user.getAllUsers.query({ limit: 5 }) - expect(Array.isArray(res.users)).toBe(true) - }) - - it('getUserDetails returns the user', async () => { - const res = await admin.admin.user.getUserDetails.query({ userId: subjectUserId }) - const user = (res as { user?: { id: number }; id?: number }).user ?? res - expect((user as { id: number }).id).toBe(subjectUserId) - }) - - it('getStaff lists the staff (including the logged-in one)', async () => { - const res = (await admin.admin.staffUser.getStaff.query()) as - | { id: number }[] - | { staff?: { id: number }[] } - const list = Array.isArray(res) ? res : (res.staff ?? []) - - expect(list.some((s) => s.id === staffId)).toBe(true) - }) - - it('adds a user incident that getUserIncidents returns', async () => { - const comment = `API test incident ${uniqueSuffix()}` - - await admin.admin.user.addUserIncident.mutate({ - userId: subjectUserId, - adminComment: comment, - }) - - const res = await admin.admin.user.getUserIncidents.query({ userId: subjectUserId }) - expect(Array.isArray(res.incidents)).toBe(true) - expect( - res.incidents.some((i: { adminComment: string | null }) => i.adminComment === comment) - ).toBe(true) - }) - - it('getUsersForNotification returns a users array', async () => { - const res = await admin.admin.user.getUsersForNotification.query({ search: '' }) - expect(Array.isArray(res.users)).toBe(true) - }) - - it('suspends and unsuspends the user', async () => { - const suspendedFlag = async () => { - const res = (await admin.admin.user.getUserDetails.query({ - userId: subjectUserId, - })) as { isSuspended?: boolean; user?: { isSuspended?: boolean } } - return res.isSuspended ?? res.user?.isSuspended - } - - await admin.admin.user.updateUserSuspension.mutate({ - userId: subjectUserId, - isSuspended: true, - }) - - try { - expect(await suspendedFlag()).toBe(true) - } finally { - await admin.admin.user.updateUserSuspension.mutate({ - userId: subjectUserId, - isSuspended: false, - }) - } - - expect(await suspendedFlag()).toBe(false) - }) - - it('sendNotification tolerates a recipient with no push token', async () => { - const res = await admin.admin.user.sendNotification.mutate({ - userIds: [subjectUserId], - title: 'API test', - text: 'No-op recipient', - }) - expect(res).toBeTruthy() - }) -}) diff --git a/apps/backend/tests/api/admin-vendor-snippets.test.ts b/apps/backend/tests/api/admin-vendor-snippets.test.ts deleted file mode 100644 index 7a6b2d7..0000000 --- a/apps/backend/tests/api/admin-vendor-snippets.test.ts +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Admin vendor-snippet CRUD (+ the orders-per-snippet report). - */ - -import { apiClient } from '../helpers/api' -import { createFutureSlot, createStoreWithSku } from '../helpers/fixtures' -import { staffSession } from '../helpers/sessions' - -describe('admin vendor snippet CRUD', () => { - let admin: ReturnType - let snippetId = 0 - let snippetCode = '' - let skuId = 0 - let slotId = 0 - - beforeAll(async () => { - const staff = await staffSession() - admin = apiClient(staff.token) - - const store = await createStoreWithSku() - const slot = await createFutureSlot([store.skuId]) - skuId = store.skuId - slotId = slot.slotId - }) - - it('creates a snippet that getAll returns', async () => { - const code = `APISNIP${Date.now().toString(36)}`.toUpperCase() - - // getOrdersBySnippet resolves orders through the snippet's slot, so link one. - const created = (await admin.admin.vendorSnippets.create.mutate({ - snippetCode: code, - slotId, - skuIds: [skuId], - isPermanent: true, - })) as { id: number; snippetCode: string } - - snippetId = created.id - snippetCode = created.snippetCode - expect(snippetId).toBeGreaterThan(0) - expect(snippetCode).toBeTruthy() - - const all = await admin.admin.vendorSnippets.getAll.query() - expect(all.some((s) => s.id === snippetId)).toBe(true) - }) - - it('updates the snippet', async () => { - await admin.admin.vendorSnippets.update.mutate({ - id: snippetId, - updates: { validTill: new Date(Date.now() + 24 * 3600_000).toISOString() }, - }) - - const all = await admin.admin.vendorSnippets.getAll.query() - expect(all.some((s) => s.id === snippetId)).toBe(true) - }) - - it('returns the orders for the snippet code', async () => { - const res = await admin.admin.vendorSnippets.getOrdersBySnippet.query({ - snippetCode, - }) - expect(res).toBeTruthy() - }) - - it('deletes the snippet', async () => { - const res = await admin.admin.vendorSnippets.delete.mutate({ id: snippetId }) - expect((res as { message?: string }).message ?? '').toMatch(/deleted/i) - - const all = await admin.admin.vendorSnippets.getAll.query() - expect(all.some((s) => s.id === snippetId)).toBe(false) - }) -}) diff --git a/apps/backend/tests/api/admin.test.ts b/apps/backend/tests/api/admin.test.ts deleted file mode 100644 index 355472b..0000000 --- a/apps/backend/tests/api/admin.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Admin (staff) surface: the created fixtures are visible to the admin APIs. - */ - -import { apiClient } from '../helpers/api' -import { - createFutureSlot, - createStoreWithSku, - type CreatedSlot, - type StoreWithSku, -} from '../helpers/fixtures' -import { staffSession } from '../helpers/sessions' - -describe('admin API surface', () => { - let store: StoreWithSku - let slot: CreatedSlot - - beforeAll(async () => { - store = await createStoreWithSku() - slot = await createFutureSlot([store.skuId]) - }) - - it('admin.product.getProducts includes the created SKU', async () => { - const staff = await staffSession() - const { products } = await apiClient(staff.token).admin.product.getProducts.query() - - const product = products.find((p) => p.id === store.productId) - expect(product).toBeDefined() - expect(product!.skus.some((sku) => sku.id === store.skuId)).toBe(true) - }) - - it('admin.slots.getAll returns slots (capped at 20) and the public list has ours', async () => { - const staff = await staffSession() - const result = await apiClient(staff.token).admin.slots.getAll.query() - - const list = Array.isArray(result) - ? result - : ((result as { slots?: { id: number }[] })?.slots ?? []) - - expect(list.length).toBeGreaterThan(0) - // getAll only returns the first 20 slots, and this suite leaves data behind, - // so membership is asserted against the unbounded public list instead. - expect(list.length).toBeLessThanOrEqual(20) - - const publicSlots = await apiClient().user.slots.getSlots.query({ regionId: 1 }) - expect(publicSlots.slots.some((s) => s.id === slot.slotId)).toBe(true) - }) -}) diff --git a/apps/backend/tests/api/auth.test.ts b/apps/backend/tests/api/auth.test.ts deleted file mode 100644 index d0f1340..0000000 --- a/apps/backend/tests/api/auth.test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Auth: log in with the credentials from tests/.env and use the issued tokens. - */ - -import { apiClient } from '../helpers/api' -import { staffSession, userSession } from '../helpers/sessions' - -describe('auth tokens', () => { - it('staff login returns a token and staff id', async () => { - const staff = await staffSession() - - expect(typeof staff.token).toBe('string') - expect(staff.token.length).toBeGreaterThan(10) - expect(staff.staffId).toBeGreaterThan(0) - }) - - it('user login returns a token and user id', async () => { - const user = await userSession() - - expect(typeof user.token).toBe('string') - expect(user.token.length).toBeGreaterThan(10) - expect(user.userId).toBeGreaterThan(0) - }) - - it('each token authenticates its own protected procedures', async () => { - const [staff, user] = await Promise.all([staffSession(), userSession()]) - - const products = await apiClient(staff.token).admin.product.getProducts.query() - expect(Array.isArray(products.products)).toBe(true) - - const addresses = await apiClient(user.token).user.address.getUserAddresses.query() - expect(Array.isArray(addresses.data)).toBe(true) - }) -}) diff --git a/apps/backend/tests/api/authorization-matrix.test.ts b/apps/backend/tests/api/authorization-matrix.test.ts deleted file mode 100644 index 2ae4090..0000000 --- a/apps/backend/tests/api/authorization-matrix.test.ts +++ /dev/null @@ -1,258 +0,0 @@ -/** - * Authorization boundaries across the two token kinds. - * - * `protectedProcedure` only requires *some* identity (ctx.user OR ctx.staffUser), - * so every admin procedure that does not additionally check `ctx.staffUser` is - * reachable with a plain user token. The "pins: a user token CAN ..." tests - * document that gap; the staff-guarded ones assert the rejection. - * - * See tests/BUGS.md. - */ - -import { apiClient, captureError, uniqueSuffix } from '../helpers/api' -import { - createFutureSlot, - createStoreWithSku, - registerThrowawayUser, - registerUserWithAddress, -} from '../helpers/fixtures' -import { staffSession } from '../helpers/sessions' - -describe('authorization matrix', () => { - let admin: ReturnType - let userToken = '' - let otherToken = '' - let addressId = 0 - let skuId = 0 - let slotId = 0 - let orderId = 0 - - beforeAll(async () => { - const staff = await staffSession() - admin = apiClient(staff.token) - - const store = await createStoreWithSku() - const slot = await createFutureSlot([store.skuId]) - const owner = await registerUserWithAddress() - const other = await registerUserWithAddress() - - userToken = owner.token - otherToken = other.token - addressId = owner.addressId - skuId = store.skuId - slotId = slot.slotId - - const placed = await apiClient(userToken).user.order.placeOrder.mutate({ - selectedItems: [{ skuId, quantity: 1, slotId }], - addressId, - }) - orderId = placed.data[0].id - }) - - describe('admin procedures guarded only by protectedProcedure', () => { - it('pins: a user token CAN cancel an order via admin.order.cancelOrder', async () => { - const res = await apiClient(userToken).admin.order.cancelOrder.mutate({ - orderId, - reason: 'authorization matrix pin', - }) - - expect(res.success).toBe(true) - - const detail = await apiClient(userToken).user.order.getOrderById.query({ - orderId: String(orderId), - }) - expect(String(detail.orderStatus).toLowerCase()).toMatch(/cancel/) - }) - - it('pins: a user token CAN suspend a user via admin.user.updateUserSuspension', async () => { - const victim = await registerThrowawayUser() - - try { - const res = await apiClient(userToken).admin.user.updateUserSuspension.mutate({ - userId: victim.userId, - isSuspended: true, - }) - expect(res.success).toBe(true) - } finally { - await admin.admin.user.updateUserSuspension.mutate({ - userId: victim.userId, - isSuspended: false, - }) - } - }) - - it('pins: a user token CAN send a notification via admin.user.sendNotification', async () => { - const target = await registerThrowawayUser() - - const res = await apiClient(userToken).admin.user.sendNotification.mutate({ - userIds: [target.userId], - title: 'API test', - text: 'authorization matrix pin', - }) - expect(res).toBeTruthy() - }) - - it('pins: a user token CAN toggle stock via admin.product.toggleOutOfStock', async () => { - const target = await createStoreWithSku() - - try { - const res = await apiClient(userToken).admin.product.toggleOutOfStock.mutate({ - id: target.productId, - }) - expect(res.isOutOfStock).toBe(true) - } finally { - await admin.admin.product.toggleOutOfStock.mutate({ id: target.productId }) - } - }) - - it('pins: a user token CAN create a staff account (admin.staffUser.createStaffUser)', async () => { - const roles = await apiClient(userToken).admin.staffUser.getRoles.query() - const roleId = roles.roles[0]?.id - expect(roleId).toBeGreaterThan(0) - - const name = `matrix-staff-${uniqueSuffix()}` - - const res = await apiClient(userToken).admin.staffUser.createStaffUser.mutate({ - name, - password: 'Passw0rd!', - roleId, - }) - expect(res).toBeTruthy() - - // It really is a usable staff account. - const login = await apiClient().admin.staffUser.login.mutate({ - name, - password: 'Passw0rd!', - }) - expect(login.token).toBeTruthy() - }) - }) - - describe('staff-guarded admin procedures', () => { - it('rejects a user token on admin.slots.createSlot', async () => { - const error = await captureError(() => - apiClient(userToken).admin.slots.createSlot.mutate({ - deliveryTime: new Date(Date.now() + 3 * 3600_000).toISOString(), - freezeTime: new Date(Date.now() + 2 * 3600_000).toISOString(), - isActive: true, - skuIds: [], - }) - ) - expect(error.message).toMatch(/UNAUTHORIZED|Access denied/i) - }) - - it('rejects a user token on admin.coupon.create', async () => { - const error = await captureError(() => - apiClient(userToken).admin.coupon.create.mutate({ - couponCode: `AUTH${uniqueSuffix()}`.toUpperCase(), - flatDiscount: 5, - isApplyForAll: true, - }) - ) - expect(error.message).toMatch(/UNAUTHORIZED|unauthorized/i) - }) - - it('rejects a user token on admin.region.updateRegionConstants', async () => { - const error = await captureError(() => - apiClient(userToken).admin.region.updateRegionConstants.mutate({ - constants: [{ key: 'welcomeMessage', value: 'nope' }], - }) - ) - expect(error.message).toMatch(/UNAUTHORIZED|unauthorized/i) - }) - - it('rejects a staff token writing a global constant via admin.region.updateRegionConstants', async () => { - const staff = await staffSession() - const error = await captureError(() => - apiClient(staff.token).admin.region.updateRegionConstants.mutate({ - constants: [{ key: 'versionNum', value: '9.9.9' }], - }) - ) - expect(error.message).toMatch(/global constant/i) - }) - }) - - describe('public admin.vendorSnippets procedures', () => { - it('serves getUpcomingSlots to anonymous callers', async () => { - const res = await apiClient().admin.vendorSnippets.getUpcomingSlots.query() - expect(res.success).toBe(true) - expect(Array.isArray(res.data)).toBe(true) - }) - - it('reaches updateOrderItemPackaging anonymously (domain error, not auth)', async () => { - const error = await captureError(() => - apiClient().admin.vendorSnippets.updateOrderItemPackaging.mutate({ - orderItemId: 99_999_999, - is_packaged: true, - }) - ) - expect(error.message).not.toMatch(/UNAUTHORIZED|Access denied/i) - }) - - it('reaches getOrdersBySnippet anonymously (domain error, not auth)', async () => { - const error = await captureError(() => - apiClient().admin.vendorSnippets.getOrdersBySnippet.query({ - snippetCode: `NO-SUCH-${uniqueSuffix()}`, - }) - ) - expect(error.message).not.toMatch(/UNAUTHORIZED|Access denied/i) - }) - }) - - describe('staff token on user endpoints', () => { - it('cannot placeOrder', async () => { - const staff = await staffSession() - const error = await captureError(() => - apiClient(staff.token).user.order.placeOrder.mutate({ - selectedItems: [{ skuId, quantity: 1, slotId }], - addressId, - }) - ) - expect(error).toBeInstanceOf(Error) - }) - - it('cannot read user coupons', async () => { - const staff = await staffSession() - const error = await captureError(() => - apiClient(staff.token).user.coupon.getEligible.query() - ) - expect(error).toBeInstanceOf(Error) - }) - }) - - describe('cross-user order access', () => { - it('user B cannot read user A order (getOrderById)', async () => { - const error = await captureError(() => - apiClient(otherToken).user.order.getOrderById.query({ orderId: String(orderId) }) - ) - expect(error.message).toMatch(/order not found/i) - }) - - it('user B cannot add notes to user A order', async () => { - const error = await captureError(() => - apiClient(otherToken).user.order.updateUserNotes.mutate({ - id: orderId, - userNotes: 'nope', - }) - ) - expect(error.message).toMatch(/order not found/i) - }) - - it('pins: user B cancelling user A order is swallowed into a generic message', async () => { - const fresh = await registerUserWithAddress() - const placed = await apiClient(fresh.token).user.order.placeOrder.mutate({ - selectedItems: [{ skuId, quantity: 1, slotId }], - addressId: fresh.addressId, - }) - - const error = await captureError(() => - apiClient(otherToken).user.order.cancelOrder.mutate({ - id: placed.data[0].id, - reason: 'not mine', - }) - ) - // The specific 404 is masked by the try/catch in cancelOrder. - expect(error.message).toMatch(/failed to cancel order/i) - }) - }) -}) diff --git a/apps/backend/tests/api/authorization.test.ts b/apps/backend/tests/api/authorization.test.ts deleted file mode 100644 index d4f59b7..0000000 --- a/apps/backend/tests/api/authorization.test.ts +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Authorization boundaries across the two token kinds, plus cross-user isolation. - * - * tRPC `protectedProcedure` only requires *some* identity (`ctx.user` OR - * `ctx.staffUser`), so procedures that don't additionally check `ctx.staffUser` - * are reachable with a user token. Case 4 documents that gap. - */ - -import { apiClient, captureError } from '../helpers/api' -import { - createFutureSlot, - createStoreWithSku, - ensureUserAddress, - registerThrowawayUser, -} from '../helpers/fixtures' -import { staffSession, userSession } from '../helpers/sessions' - -describe('authorization boundaries', () => { - let ownerToken = '' - let ownerAddressId = 0 - - beforeAll(async () => { - const store = await createStoreWithSku() - await createFutureSlot([store.skuId]) - const address = await ensureUserAddress() - const user = await userSession() - - ownerToken = user.token - ownerAddressId = address.addressId - }) - - it('rejects anonymous requests', async () => { - const error = await captureError(() => - apiClient().user.order.getOrders.query({ page: 1, pageSize: 5 }) - ) - - expect(error.message).toMatch(/UNAUTHORIZED|unauthorized/i) - }) - - it('a staff token cannot act as a user (no ctx.user)', async () => { - const staff = await staffSession() - - const error = await captureError(() => - apiClient(staff.token).user.order.getOrders.query({ page: 1, pageSize: 5 }) - ) - - expect(error).toBeInstanceOf(Error) - }) - - it('a user token cannot use staff-guarded admin writes', async () => { - const deliveryTime = new Date(Date.now() + 3 * 3600_000).toISOString() - const freezeTime = new Date(Date.now() + 2 * 3600_000).toISOString() - - const error = await captureError(() => - apiClient(ownerToken).admin.slots.createSlot.mutate({ - deliveryTime, - freezeTime, - isActive: true, - skuIds: [], - }) - ) - - expect(error.message).toMatch(/UNAUTHORIZED|Access denied|unauthorized/i) - }) - - it('DOCUMENTS: a user token CAN read admin.product.getProducts (no staff guard)', async () => { - // admin.product.getProducts is a bare protectedProcedure — no ctx.staffUser - // check — so any authenticated user can read the full admin product list. - const products = await apiClient(ownerToken).admin.product.getProducts.query() - - expect(Array.isArray(products.products)).toBe(true) - }) - - it("one user cannot see another user's addresses", async () => { - const other = await registerThrowawayUser() - - const addresses = await apiClient(other.token).user.address.getUserAddresses.query() - - expect(addresses.data.some((a) => a.id === ownerAddressId)).toBe(false) - }) -}) diff --git a/apps/backend/tests/api/cache-availability.test.ts b/apps/backend/tests/api/cache-availability.test.ts deleted file mode 100644 index 36a8bb6..0000000 --- a/apps/backend/tests/api/cache-availability.test.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * availability.json — regenerated SYNCHRONOUSLY by - * admin.product.toggleOutOfStock (it calls createAvailabilityCacheFile()), - * so the file can be read immediately after the mutation. - */ - -import { apiClient } from '../helpers/api' -import { - availabilityCacheUrl, - essentialConsts, - fetchCacheJson, -} from '../helpers/cache' -import { createStoreWithSku, type StoreWithSku } from '../helpers/fixtures' -import { staffSession } from '../helpers/sessions' - -interface AvailabilityCache { - availability: { id: number; isOutOfStock: boolean }[] - count: number -} - -describe('availability.json cache', () => { - let store: StoreWithSku - - beforeAll(async () => { - store = await createStoreWithSku() - }) - - it('reflects an out-of-stock toggle for the new SKU', async () => { - const staff = await staffSession() - const admin = apiClient(staff.token) - - const before = await essentialConsts() - const toggled = await admin.admin.product.toggleOutOfStock.mutate({ - id: store.productId, - }) - expect(toggled.isOutOfStock).toBe(true) - - const after = await essentialConsts() - expect(after.availabilityVersionNum).toBeGreaterThan(before.availabilityVersionNum) - - const cache = await fetchCacheJson( - availabilityCacheUrl(after, after.availabilityVersionNum) - ) - - // availability.json is keyed by SKU id (not product id). - const entry = cache.availability.find((a) => a.id === store.skuId) - expect(entry).toBeDefined() - expect(entry!.isOutOfStock).toBe(true) - }) - - it('has a count matching the number of entries', async () => { - const current = await essentialConsts() - const cache = await fetchCacheJson( - availabilityCacheUrl(current, current.availabilityVersionNum) - ) - - expect(cache.count).toBe(cache.availability.length) - }) -}) diff --git a/apps/backend/tests/api/cache-consistency.test.ts b/apps/backend/tests/api/cache-consistency.test.ts deleted file mode 100644 index a63931a..0000000 --- a/apps/backend/tests/api/cache-consistency.test.ts +++ /dev/null @@ -1,141 +0,0 @@ -/** - * Cross-file cache invariants — the relationships the app relies on when it - * merges these files at runtime. - * - * Two of these can legitimately lag: `slots.json` is rewritten synchronously on - * a slot mutation while `products.json` only rebuilds ~30s later (CACHE_CREATOR), - * and `essential-consts.json` embeds the versions that were current when it was - * written. So the version-sensitive checks re-read the current versions and poll. - */ - -import { - availabilityCacheUrl, - essentialConsts, - essentialConstsCacheUrl, - fetchCacheJson, - pollUntil, - productsCacheUrl, - slotsCacheUrl, - storesCacheUrl, - storeDetailCacheUrl, -} from '../helpers/cache' - -interface ProductsCache { - products: { id: number }[] - count: number -} - -interface AvailabilityCache { - availability: { id: number }[] - count: number -} - -interface SlotsCache { - slots: { id: number; products: { id: number }[] }[] -} - -interface StoresCache { - stores: { id: number; productCount: number }[] -} - -interface StoreDetailCache { - store: { id: number } - products: unknown[] -} - -interface EssentialConstsCache { - cacheVersion: number - slotsVersionNum: number - availabilityVersionNum: number -} - -describe('cache consistency', () => { - it('every availability entry maps to a product in products.json', async () => { - // availability.json is bumped synchronously by stock toggles, so it can lead - // products.json (which waits for the rebuild) — poll for them to converge. - await pollUntil( - 'every availability id to appear in products.json', - async () => { - const consts = await essentialConsts() - const [products, availability] = await Promise.all([ - fetchCacheJson(productsCacheUrl(consts, consts.cacheVersion)), - fetchCacheJson( - availabilityCacheUrl(consts, consts.availabilityVersionNum) - ), - ]) - - const productIds = new Set(products.products.map((p) => p.id)) - const orphans = availability.availability - .map((a) => a.id) - .filter((id) => !productIds.has(id)) - - return orphans.length === 0 ? [] : null - }, - { timeoutMs: 120_000, intervalMs: 5_000 } - ) - }) - - it('availability count matches the number of entries', async () => { - const consts = await essentialConsts() - - const availability = await fetchCacheJson( - availabilityCacheUrl(consts, consts.availabilityVersionNum) - ) - - expect(availability.count).toBe(availability.availability.length) - }) - - it('every product referenced by slots.json exists in products.json', async () => { - // slots.json is synchronous; products.json catches up via the rebuild, so poll. - await pollUntil( - 'every product id referenced by slots.json to appear in products.json', - async () => { - const consts = await essentialConsts() - const [products, slots] = await Promise.all([ - fetchCacheJson(productsCacheUrl(consts, consts.cacheVersion)), - fetchCacheJson(slotsCacheUrl(consts, consts.slotsVersionNum)), - ]) - - const productIds = new Set(products.products.map((p) => p.id)) - const referenced = new Set() - slots.slots.forEach((slot) => slot.products.forEach((p) => referenced.add(p.id))) - - const orphans = [...referenced].filter((id) => !productIds.has(id)) - return orphans.length === 0 ? [] : null - }, - { timeoutMs: 120_000, intervalMs: 5_000 } - ) - }) - - it('essential-consts.json is self-consistent with the version in its path', async () => { - const consts = await essentialConsts() - - const cache = await fetchCacheJson( - essentialConstsCacheUrl(consts, consts.cacheVersion) - ) - - // The file lives at v-, so it must report that same version. - expect(cache.cacheVersion).toBe(consts.cacheVersion) - // The embedded slots/availability versions are a snapshot at write time and - // may lag the live ones (slots are bumped independently) — assert shape only. - expect(typeof cache.slotsVersionNum).toBe('number') - expect(typeof cache.availabilityVersionNum).toBe('number') - }) - - it('stores.json productCount matches each store detail file', async () => { - const consts = await essentialConsts() - - const stores = await fetchCacheJson( - storesCacheUrl(consts, consts.cacheVersion) - ) - expect(stores.stores.length).toBeGreaterThan(0) - - const store = stores.stores[0] - const detail = await fetchCacheJson( - storeDetailCacheUrl(consts, consts.cacheVersion, store.id) - ) - - expect(detail.store.id).toBe(store.id) - expect(detail.products).toHaveLength(store.productCount) - }) -}) diff --git a/apps/backend/tests/api/cache-invalidation.test.ts b/apps/backend/tests/api/cache-invalidation.test.ts deleted file mode 100644 index fe5c54a..0000000 --- a/apps/backend/tests/api/cache-invalidation.test.ts +++ /dev/null @@ -1,109 +0,0 @@ -/** - * Cache regeneration for the writes the existing cache suites do not cover: - * price updates (availability, synchronous), slot updates (slots.json, - * synchronous) and banner creation (products.json, eventual via CACHE_CREATOR). - * - * The write paths differ: toggleOutOfStock/updateProductPrices/slot mutations - * rewrite their cache file inline, while product/store/banner/tag changes go - * through scheduleStoreInitialization (a Durable Object that rebuilds ~30s - * later). See apps/backend/src/lib/cloud_cache.ts. - */ - -import { apiClient } from '../helpers/api' -import { - availabilityCacheUrl, - essentialConsts, - fetchCacheJson, - pollUntil, - slotsCacheUrl, - type EssentialConsts, -} from '../helpers/cache' -import { createFutureSlot, createStoreWithSku } from '../helpers/fixtures' -import { staffSession } from '../helpers/sessions' - -interface AvailabilityCache { - availability: { id: number; price: number }[] - count: number -} - -interface SlotsCache { - slots: { id: number; deliveryTime: string; freezeTime: string }[] -} - -describe('cache invalidation', () => { - let admin: ReturnType - - beforeAll(async () => { - const staff = await staffSession() - admin = apiClient(staff.token) - }) - - it('refreshes availability.json synchronously on updateProductPrices', async () => { - const store = await createStoreWithSku({ price: 199 }) - - const before = await essentialConsts() - await admin.admin.product.updateProductPrices.mutate({ - updates: [{ skuId: store.skuId, price: 250 }], - }) - const after = await essentialConsts() - - expect(after.availabilityVersionNum).toBeGreaterThan(before.availabilityVersionNum) - - const cache = await fetchCacheJson( - availabilityCacheUrl(after, after.availabilityVersionNum) - ) - // availability.json is keyed by SKU id. - const entry = cache.availability.find((a) => a.id === store.skuId) - expect(entry).toBeDefined() - expect(entry!.price).toBe(250) - }) - - it('refreshes slots.json synchronously on updateSlot', async () => { - const store = await createStoreWithSku() - const slot = await createFutureSlot([store.skuId]) - - const newDelivery = new Date(Date.now() + 9 * 3600_000).toISOString() - const newFreeze = new Date(Date.now() + 8 * 3600_000).toISOString() - - const before = await essentialConsts() - await admin.admin.slots.updateSlot.mutate({ - id: slot.slotId, - deliveryTime: newDelivery, - freezeTime: newFreeze, - isActive: true, - skuIds: [store.skuId], - }) - const after = await essentialConsts() - - expect(after.slotsVersionNum).toBeGreaterThan(before.slotsVersionNum) - - const cache = await fetchCacheJson( - slotsCacheUrl(after, after.slotsVersionNum) - ) - const found = cache.slots.find((s) => s.id === slot.slotId) - expect(found).toBeDefined() - expect(new Date(found!.deliveryTime).toISOString()).toBe(newDelivery) - }) - - it('rebuilds the versioned cache eventually after creating a banner', async () => { - const before = await essentialConsts() - - await admin.admin.banner.createBanner.mutate({ - name: `API banner ${Date.now()}`, - imageUrl: 'https://assets.freshyo.in/api-cache/test-banner.png', - }) - - const advanced = await pollUntil( - `cacheVersion to advance past ${before.cacheVersion} after a banner create`, - async () => { - const now = await essentialConsts() - return now.cacheVersion > before.cacheVersion ? now : null - }, - // The CACHE_CREATOR Durable Object rebuilds ~30s after the write, but can - // lag when the suite has queued many writes — mirror cache-products' 180s. - { timeoutMs: 180_000, intervalMs: 5_000 } - ) - - expect(advanced.cacheVersion).toBeGreaterThan(before.cacheVersion) - }, 210_000) -}) diff --git a/apps/backend/tests/api/cache-products.test.ts b/apps/backend/tests/api/cache-products.test.ts deleted file mode 100644 index 36ddada..0000000 --- a/apps/backend/tests/api/cache-products.test.ts +++ /dev/null @@ -1,88 +0,0 @@ -/** - * products.json + stores/.json — EVENTUAL cache. - * - * Product/store/banner changes go through the CACHE_CREATOR Durable Object, - * whose alarm fires ~30s later and then rebuilds the cache fire-and-forget. - * So these tests poll for the cacheVersion to advance before reading. - */ - -import { - essentialConsts, - fetchCacheJson, - pollUntil, - productsCacheUrl, - storeDetailCacheUrl, - type EssentialConsts, -} from '../helpers/cache' -import { createStoreWithSku, type StoreWithSku } from '../helpers/fixtures' - -interface ProductsCache { - products: { id: number; skus?: { id: number }[] }[] - count: number -} - -interface StoreDetailCache { - store: { id: number } - products: unknown[] -} - -describe('products.json + stores/.json cache (eventual)', () => { - let store: StoreWithSku - let consts: EssentialConsts - - beforeAll(async () => { - const before = await essentialConsts() - store = await createStoreWithSku() - - consts = await pollUntil( - `cacheVersion to advance past ${before.cacheVersion} after creating a product`, - async () => { - const now = await essentialConsts() - return now.cacheVersion > before.cacheVersion ? now : null - }, - { timeoutMs: 180_000, intervalMs: 5_000 } - ) - }, 200_000) - - it('lists the new product in products.json', async () => { - // The rebuild PUTs the files in parallel, so poll for this one to land. - const cache = await pollUntil( - `products.json at v-${consts.cacheVersion} to include product ${store.productId}`, - async () => { - try { - const body = await fetchCacheJson( - productsCacheUrl(consts, consts.cacheVersion) - ) - return body.products.some((p) => p.id === store.productId) ? body : null - } catch { - return null - } - }, - { timeoutMs: 60_000, intervalMs: 3_000 } - ) - - expect(cache.products.some((p) => p.id === store.productId)).toBe(true) - }) - - it('writes stores/.json for the new store', async () => { - // The version keeps advancing with every admin write, and the parallel rebuild - // may land the per-store file in a *later* version than the one captured in - // beforeAll — so resolve the current version on each attempt instead of pinning it. - const cache = await pollUntil( - `stores/${store.storeId}.json to appear`, - async () => { - try { - const now = await essentialConsts() - return await fetchCacheJson( - storeDetailCacheUrl(now, now.cacheVersion, store.storeId) - ) - } catch { - return null - } - }, - { timeoutMs: 120_000, intervalMs: 5_000 } - ) - - expect(cache.store?.id).toBe(store.storeId) - }) -}) diff --git a/apps/backend/tests/api/cache-slots.test.ts b/apps/backend/tests/api/cache-slots.test.ts deleted file mode 100644 index 33f4930..0000000 --- a/apps/backend/tests/api/cache-slots.test.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * slots.json — regenerated SYNCHRONOUSLY inside admin.slots.createSlot - * (it awaits createSlotsCacheFile()), so the file can be read immediately. - */ - -import { - essentialConsts, - fetchCacheJson, - slotsCacheUrl, - type EssentialConsts, -} from '../helpers/cache' -import { createFutureSlot, createStoreWithSku } from '../helpers/fixtures' - -interface SlotsCache { - slots: { id: number; deliveryTime: string; freezeTime: string }[] - count: number -} - -describe('slots.json cache', () => { - let skuId = 0 - let consts: EssentialConsts - - beforeAll(async () => { - const store = await createStoreWithSku() - skuId = store.skuId - consts = await essentialConsts() - }) - - it('exposes a numeric slotsVersionNum', () => { - expect(typeof consts.slotsVersionNum).toBe('number') - expect(consts.slotsVersionNum).toBeGreaterThan(0) - }) - - it('contains a newly created slot', async () => { - const slot = await createFutureSlot([skuId]) - const current = await essentialConsts() - - const cache = await fetchCacheJson( - slotsCacheUrl(current, current.slotsVersionNum) - ) - - const found = cache.slots.find((s) => s.id === slot.slotId) - expect(found).toBeDefined() - expect(new Date(found!.deliveryTime).toISOString()).toBe(slot.deliveryTime) - }) - - it('bumps the version and rewrites the file for a second slot', async () => { - const before = await essentialConsts() - const slot = await createFutureSlot([skuId], { deliveryInHours: 5, freezeInHours: 4 }) - const after = await essentialConsts() - - expect(after.slotsVersionNum).toBeGreaterThan(before.slotsVersionNum) - - const cache = await fetchCacheJson( - slotsCacheUrl(after, after.slotsVersionNum) - ) - expect(cache.slots.some((s) => s.id === slot.slotId)).toBe(true) - }) -}) diff --git a/apps/backend/tests/api/coupon-math.test.ts b/apps/backend/tests/api/coupon-math.test.ts deleted file mode 100644 index 5265ad7..0000000 --- a/apps/backend/tests/api/coupon-math.test.ts +++ /dev/null @@ -1,263 +0,0 @@ -/** - * Coupon discount maths at placeOrder time. - * - * The discount is computed server-side in placeOrderUtil - * (apps/backend/src/trpc/apis/user-apis/apis/order.ts) and persisted to - * orders.totalAmount. These tests read the order row returned by placeOrder - * (totalAmount is the stored string). - * - * The backend mirrors the customer app's model: coupons discount the goods - * subtotal and delivery is decided on the post-discount total. Multiple coupons - * stack sequentially in the order they are applied, each rounded to the nearest - * rupee. Remaining KNOWN BUGS are pinned here (negative totals for >=100% - * coupons). See tests/BUGS.md. - */ - -import { apiClient, captureError, uniqueSuffix } from '../helpers/api' -import { asNumber, getConstants } from '../helpers/consts' -import { - createFutureSlot, - createStoreWithSku, - registerUserWithAddress, -} from '../helpers/fixtures' -import { staffSession } from '../helpers/sessions' - -type OrderRow = { id: number; totalAmount: string; slotId: number | null } -type Placed = { success: boolean; data: OrderRow[] } - -const couponCode = () => - `CM${uniqueSuffix()}`.toUpperCase().replace(/[^A-Z0-9]/g, '').slice(0, 20) - -/** price 5 is used so quantities map straight onto the totals below. */ -const UNIT_PRICE = 5 - -describe('coupon discount maths', () => { - let admin: ReturnType - let userToken = '' - let addressId = 0 - let skuId = 0 - let slotId = 0 - let secondSlotId = 0 - let roundingSkuId = 0 - let roundingSlotId = 0 - let deliveryCharge = 0 - let freeDeliveryThreshold = 0 - - beforeAll(async () => { - const staff = await staffSession() - admin = apiClient(staff.token) - - const store = await createStoreWithSku({ price: UNIT_PRICE }) - const slot = await createFutureSlot([store.skuId]) - const second = await createFutureSlot([store.skuId], { - deliveryInHours: 6, - freezeInHours: 5, - }) - - // A second store at 333 so 3 units = 999 exercises float maths. - const rounding = await createStoreWithSku({ price: 333 }) - const roundingSlot = await createFutureSlot([rounding.skuId]) - - const buyer = await registerUserWithAddress() - const consts = await getConstants() - - userToken = buyer.token - addressId = buyer.addressId - skuId = store.skuId - slotId = slot.slotId - secondSlotId = second.slotId - roundingSkuId = rounding.skuId - roundingSlotId = roundingSlot.slotId - deliveryCharge = asNumber(consts.deliveryCharge) - freeDeliveryThreshold = asNumber(consts.freeDeliveryThreshold) - - // The totals below assume these thresholds. - expect(freeDeliveryThreshold).toBeGreaterThan(UNIT_PRICE) - expect(freeDeliveryThreshold).toBeLessThan(500) - }) - - const createCoupon = async (over: Record = {}) => { - const created = await admin.admin.coupon.create.mutate({ - couponCode: couponCode(), - minOrder: 1, - isApplyForAll: true, - validTill: new Date(Date.now() + 24 * 3600_000).toISOString(), - ...over, - }) - return created[0] - } - - const place = ( - items: { skuId: number; quantity: number; slotId: number | null }[], - couponId?: number | number[] - ): Promise => - apiClient(userToken).user.order.placeOrder.mutate({ - selectedItems: items, - addressId, - regionId: 1, - ...(couponId != null - ? { couponIds: Array.isArray(couponId) ? couponId : [couponId] } - : {}), - }) as unknown as Promise - - const total = (res: Placed) => parseFloat(res.data[0].totalAmount) - - it('applies an uncapped percentage discount', async () => { - const coupon = await createCoupon({ discountPercent: 10 }) - - const res = await place([{ skuId, quantity: 100, slotId }], coupon.id) - - // 500 >= freeDeliveryThreshold -> free delivery; 10% of 500 = 50. - expect(total(res)).toBe(450) - }) - - it('caps a percentage discount at maxValue', async () => { - const coupon = await createCoupon({ discountPercent: 50, maxValue: 100 }) - - const res = await place([{ skuId, quantity: 100, slotId }], coupon.id) - - // min(50% of 500 = 250, maxValue 100) = 100. - expect(total(res)).toBe(400) - }) - - it('caps a flat discount at maxValue', async () => { - const coupon = await createCoupon({ flatDiscount: 200, maxValue: 30 }) - - const res = await place([{ skuId, quantity: 100, slotId }], coupon.id) - - // min(flat 200, maxValue 30) = 30. - expect(total(res)).toBe(470) - }) - - /** - * KNOWN BUG: the percentage branch caps at `maxValue * proportion` or - * Infinity and never at orderTotal, so a >=100% coupon drives totalAmount to - * zero or negative. The flat branch does cap at the order total. - */ - it('pins: a 150% coupon produces a negative total', async () => { - const coupon = await createCoupon({ discountPercent: 150 }) - - const res = await place([{ skuId, quantity: 100, slotId }], coupon.id) - - // 500 - 150% (750) = -250. - expect(total(res)).toBeLessThan(0) - }) - - it('a 100% coupon zeroes the goods but delivery still applies', async () => { - const coupon = await createCoupon({ discountPercent: 100 }) - - const res = await place([{ skuId, quantity: 100, slotId }], coupon.id) - - // Goods 500 - 100% = 0; 0 is below the free-delivery threshold, so the - // delivery charge is added on top (matching the customer app). - expect(total(res)).toBe(deliveryCharge) - }) - - it('accepts a cart exactly at the coupon minOrder and rejects below it', async () => { - const coupon = await createCoupon({ flatDiscount: 10, minOrder: 500 }) - - // 100 * 5 = 500 == minOrder -> the guard is `minOrder > total`, so it passes. - const ok = await place([{ skuId, quantity: 100, slotId }], coupon.id) - expect(ok.success).toBe(true) - expect(total(ok)).toBe(490) - - // 99 * 5 = 495 < 500 -> rejected. - const error = await captureError(() => - place([{ skuId, quantity: 99, slotId }], coupon.id) - ) - expect(error.message).toMatch(/minimum requirement/i) - }) - - it('applies a percentage coupon to the goods subtotal only', async () => { - const coupon = await createCoupon({ discountPercent: 10 }) - - // 1 * 5 = 5; 10% off the goods = 4.5. Delivery is decided on 4.5, which is - // below the free-delivery threshold, so the charge is added on top. - const res = await place([{ skuId, quantity: 1, slotId }], coupon.id) - - expect(total(res)).toBeCloseTo(UNIT_PRICE * 0.9 + deliveryCharge, 6) - }) - - it('splits a flat discount across slots by orderGroupProportion', async () => { - const coupon = await createCoupon({ flatDiscount: 20 }) - - const res = await place( - [ - { skuId, quantity: 40, slotId }, // 200 - { skuId, quantity: 60, slotId: secondSlotId }, // 300 - ], - coupon.id - ) - - // 500 >= freeDeliveryThreshold -> no delivery, so both sub-orders are the plain - // subtotal. Proportions 0.4 / 0.6 -> discounts 8 / 12. - const totals = res.data - .map((order) => parseFloat(order.totalAmount)) - .sort((a, b) => a - b) - - expect(totals).toEqual([192, 288]) - expect(totals[0] + totals[1]).toBe(480) - }) - - it('rounds the discount to the nearest rupee', async () => { - const coupon = await createCoupon({ discountPercent: 15 }) - - const res = await place( - [{ skuId: roundingSkuId, quantity: 3, slotId: roundingSlotId }], - coupon.id - ) - - // 999 - round(15% of 999 = 149.85) = 999 - 150 = 849. - expect(total(res)).toBe(849) - }) - - it('stacks multiple coupons sequentially in the order applied', async () => { - const tenPct = await createCoupon({ discountPercent: 10 }) - const flat100 = await createCoupon({ flatDiscount: 100 }) - - // 200 * 5 = 1000. Above the free-delivery threshold, so delivery is free. - // 10% first: -100 -> 900; then flat 100 -> 800. - const pctThenFlat = await place( - [{ skuId, quantity: 200, slotId }], - [tenPct.id, flat100.id] - ) - expect(total(pctThenFlat)).toBe(800) - - // Same two coupons, reversed: flat 100 first -> 900; then 10% of 900 = 90 -> 810. - const flatThenPct = await place( - [{ skuId, quantity: 200, slotId }], - [flat100.id, tenPct.id] - ) - expect(total(flatThenPct)).toBe(810) - }) - - it('enforces maxLimitForUser', async () => { - const coupon = await createCoupon({ flatDiscount: 5, maxLimitForUser: 1 }) - - await place([{ skuId, quantity: 100, slotId }], coupon.id) - - const error = await captureError(() => - place([{ skuId, quantity: 100, slotId }], coupon.id) - ) - expect(error.message).toMatch(/usage limit/i) - }) - - it('rejects an expired coupon at order time', async () => { - const coupon = await createCoupon({ - flatDiscount: 5, - validTill: new Date(Date.now() - 3600_000).toISOString(), - }) - - const error = await captureError(() => - place([{ skuId, quantity: 100, slotId }], coupon.id) - ) - expect(error.message).toMatch(/expired/i) - }) - - it('rejects an unknown coupon id', async () => { - const error = await captureError(() => - place([{ skuId, quantity: 100, slotId }], 99_999_999) - ) - expect(error.message).toMatch(/invalid coupon/i) - }) -}) diff --git a/apps/backend/tests/api/coupon-ux.test.ts b/apps/backend/tests/api/coupon-ux.test.ts deleted file mode 100644 index 494fd8a..0000000 --- a/apps/backend/tests/api/coupon-ux.test.ts +++ /dev/null @@ -1,253 +0,0 @@ -/** - * Coupon UX surfaces: reserved-code redemption, getMyCoupons, the admin create - * guards and the user-scoping guard at placeOrder. - * - * See tests/BUGS.md. - */ - -import { apiClient, captureError, uniqueSuffix } from '../helpers/api' -import { - createFutureSlot, - createStoreWithSku, - registerUserWithAddress, -} from '../helpers/fixtures' -import { staffSession } from '../helpers/sessions' - -const code = (prefix = 'UX') => - `${prefix}${uniqueSuffix()}`.toUpperCase().replace(/[^A-Z0-9]/g, '').slice(0, 20) - -const future = () => new Date(Date.now() + 24 * 3600_000).toISOString() - -describe('coupon UX', () => { - let admin: ReturnType - let userA: { token: string; userId: number; addressId: number } - let userB: { token: string; userId: number; addressId: number } - let skuId = 0 - let slotId = 0 - - beforeAll(async () => { - const staff = await staffSession() - admin = apiClient(staff.token) - - const store = await createStoreWithSku({ price: 100 }) - const slot = await createFutureSlot([store.skuId]) - userA = await registerUserWithAddress() - userB = await registerUserWithAddress() - skuId = store.skuId - slotId = slot.slotId - }) - - const createCoupon = async (over: Record = {}) => { - const created = await admin.admin.coupon.create.mutate({ - couponCode: code(), - minOrder: 1, - isApplyForAll: true, - validTill: future(), - ...over, - }) - return created[0] - } - - const createReserved = async (over: Record = {}) => { - const reservedCode = code('RSV') - const created = await admin.admin.coupon.createReservedCoupon.mutate({ - couponCode: reservedCode, - flatDiscount: 5, - minOrder: 1, - validTill: future(), - ...over, - }) - return { secretCode: reservedCode, coupon: created[0] } - } - - const redeem = (token: string, secretCode: string) => - apiClient(token).user.coupon.redeemReservedCoupon.mutate({ secretCode }) - - const place = ( - user: { token: string; addressId: number }, - couponId?: number, - quantity = 1 - ) => - apiClient(user.token).user.order.placeOrder.mutate({ - selectedItems: [{ skuId, quantity, slotId }], - addressId: user.addressId, - regionId: 1, - ...(couponId ? { couponIds: [couponId] } : {}), - }) - - describe('redeemReservedCoupon', () => { - it('redeems a reserved code for the user', async () => { - const { secretCode } = await createReserved() - - const res = await redeem(userA.token, secretCode) - - expect(res.success).toBe(true) - expect(res.coupon).toBeTruthy() - }) - - it('rejects a second redemption by the same user', async () => { - const { secretCode } = await createReserved() - await redeem(userA.token, secretCode) - - const error = await captureError(() => redeem(userA.token, secretCode)) - expect(error.message).toMatch(/already redeemed/i) - }) - - it('rejects redeeming an unknown code', async () => { - const error = await captureError(() => redeem(userA.token, code('NOPE'))) - expect(error.message).toMatch(/invalid|redeemed/i) - }) - - it('rejects an expired reserved code', async () => { - const { secretCode } = await createReserved({ - validTill: new Date(Date.now() - 3600_000).toISOString(), - }) - - const error = await captureError(() => redeem(userA.token, secretCode)) - expect(error.message).toMatch(/expired/i) - }) - - it('lets only one of two simultaneous claims win', async () => { - const { secretCode } = await createReserved() - - const results = await Promise.allSettled([ - redeem(userA.token, secretCode), - redeem(userB.token, secretCode), - ]) - - expect(results.filter((r) => r.status === 'fulfilled')).toHaveLength(1) - }) - - it('rejects an isFirstOrderOnly reserved code for a user with orders', async () => { - await place(userB) // give B an order - - const { secretCode } = await createReserved({ isFirstOrderOnly: true }) - - const error = await captureError(() => redeem(userB.token, secretCode)) - expect(error.message).toMatch(/first order only/i) - }) - }) - - describe('getMyCoupons', () => { - it('categorises a user coupon as personal and an apply-for-all as general', async () => { - await createCoupon({ - isUserBased: true, - isApplyForAll: false, - applicableUsers: [userA.userId], - flatDiscount: 5, - }) - await createCoupon({ isApplyForAll: true, flatDiscount: 5 }) - - const res = await apiClient(userA.token).user.coupon.getMyCoupons.query() - - expect(Array.isArray(res.data.personal)).toBe(true) - expect(Array.isArray(res.data.general)).toBe(true) - expect(res.data.personal.length).toBeGreaterThan(0) - expect(res.data.general.length).toBeGreaterThan(0) - }) - - it('marks a coupon isUsedUp once maxLimitForUser is reached', async () => { - const coupon = await createCoupon({ - isUserBased: true, - isApplyForAll: false, - applicableUsers: [userA.userId], - flatDiscount: 5, - maxLimitForUser: 1, - }) - - await place(userA, coupon.id) - - const res = await apiClient(userA.token).user.coupon.getMyCoupons.query() - const found = res.data.personal.find((c: { id: number }) => c.id === coupon.id) - - expect(found).toBeDefined() - expect(found!.isUsedUp).toBe(true) - expect(found!.usageCount).toBe(1) - }) - }) - - describe('admin coupon create guards', () => { - it('rejects both discount types', async () => { - const error = await captureError(() => - admin.admin.coupon.create.mutate({ - couponCode: code(), - discountPercent: 10, - flatDiscount: 5, - isApplyForAll: true, - }) - ) - expect(error.message).toMatch(/discountPercent or flatDiscount/i) - }) - - it('rejects a user-based coupon without applicableUsers', async () => { - const error = await captureError(() => - admin.admin.coupon.create.mutate({ - couponCode: code(), - flatDiscount: 5, - isUserBased: true, - }) - ) - expect(error.message).toMatch(/applicableUsers is required/i) - }) - - it('rejects a coupon that is both user-based and apply-for-all', async () => { - const error = await captureError(() => - admin.admin.coupon.create.mutate({ - couponCode: code(), - flatDiscount: 5, - isUserBased: true, - isApplyForAll: true, - applicableUsers: [userA.userId], - }) - ) - expect(error.message).toMatch(/both user-based and apply for all/i) - }) - - it('rejects a duplicate coupon code', async () => { - const duplicate = code() - await admin.admin.coupon.create.mutate({ - couponCode: duplicate, - flatDiscount: 5, - isApplyForAll: true, - }) - - const error = await captureError(() => - admin.admin.coupon.create.mutate({ - couponCode: duplicate, - flatDiscount: 5, - isApplyForAll: true, - }) - ) - expect(error.message).toMatch(/already exists/i) - }) - - it('rejects unknown applicableUsers', async () => { - const error = await captureError(() => - admin.admin.coupon.create.mutate({ - couponCode: code(), - flatDiscount: 5, - isUserBased: true, - applicableUsers: [99_999_999], - }) - ) - expect(error.message).toMatch(/not found/i) - }) - }) - - it('rejects user B applying a coupon issued to user A', async () => { - const coupon = await createCoupon({ - isUserBased: true, - isApplyForAll: false, - applicableUsers: [userA.userId], - flatDiscount: 5, - }) - - // 3 * 100 = 300 >= threshold -> no delivery, isolating the scope check. - const error = await captureError(() => place(userB, coupon.id, 3)) - expect(error.message).toMatch(/not applicable/i) - - // The intended user can still spend it. - const ok = await place(userA, coupon.id, 3) - expect(ok.success).toBe(true) - }) -}) diff --git a/apps/backend/tests/api/coupons.test.ts b/apps/backend/tests/api/coupons.test.ts deleted file mode 100644 index f4cebd0..0000000 --- a/apps/backend/tests/api/coupons.test.ts +++ /dev/null @@ -1,126 +0,0 @@ -/** - * Coupon CRUD as staff, then the user end: the coupon must show up as eligible - * and actually reduce an order's amount when passed to placeOrder. - * - * Flow (ordered within the file): - * create -> getById -> update -> eligible for the user -> apply to an order - * -> delete invalidates it (no longer eligible). - */ - -import { apiClient, captureError, uniqueSuffix } from '../helpers/api' -import { createFutureSlot, createStoreWithSku, ensureUserAddress } from '../helpers/fixtures' -import { staffSession, userSession } from '../helpers/sessions' - -const FLAT_DISCOUNT = 2 - -describe('coupon CRUD + apply', () => { - let admin: ReturnType - let user: ReturnType - let code = '' - let couponId = 0 - let skuId = 0 - let slotId = 0 - let addressId = 0 - - beforeAll(async () => { - const staff = await staffSession() - admin = apiClient(staff.token) - - const store = await createStoreWithSku() - const slot = await createFutureSlot([store.skuId]) - const address = await ensureUserAddress() - const session = await userSession() - user = apiClient(session.token) - - skuId = store.skuId - slotId = slot.slotId - addressId = address.addressId - - code = `APITEST${uniqueSuffix()}`.toUpperCase().replace(/[^A-Z0-9]/g, '').slice(0, 20) - - const created = await admin.admin.coupon.create.mutate({ - couponCode: code, - flatDiscount: FLAT_DISCOUNT, - minOrder: 1, - maxLimitForUser: 3, - isApplyForAll: true, - validTill: new Date(Date.now() + 24 * 3600_000).toISOString(), - }) - - couponId = created[0].id - }) - - it('creates the coupon and getById returns it', async () => { - expect(couponId).toBeGreaterThan(0) - - const coupon = await admin.admin.coupon.getById.query({ id: couponId }) - expect(coupon.couponCode).toBe(code) - expect(Number(coupon.flatDiscount)).toBe(FLAT_DISCOUNT) - }) - - it('updates the coupon', async () => { - await admin.admin.coupon.update.mutate({ - id: couponId, - updates: { maxLimitForUser: 7 }, - }) - - const coupon = await admin.admin.coupon.getById.query({ id: couponId }) - expect(Number(coupon.maxLimitForUser)).toBe(7) - }) - - it('is eligible for the user', async () => { - const eligible = await user.user.coupon.getEligible.query() - - const match = eligible.data.find((c) => c.id === couponId) - expect(match).toBeDefined() - expect(match!.couponCode).toBe(code) - }) - - it('reduces the order amount when the user applies it', async () => { - const placed = await user.user.order.placeOrder.mutate({ - selectedItems: [{ skuId, quantity: 1, slotId }], - addressId, - regionId: 1, - couponIds: [couponId], - }) - - const orderId = placed.data[0].id - const detail = await user.user.order.getOrderById.query({ orderId: String(orderId) }) - - expect(detail.couponCode).toBe(code) - expect(Number(detail.discountAmount)).toBe(FLAT_DISCOUNT) - }) - - it('deleting the coupon invalidates it for the user', async () => { - await admin.admin.coupon.delete.mutate({ id: couponId }) - - const eligible = await user.user.coupon.getEligible.query() - expect(eligible.data.some((c) => c.id === couponId)).toBe(false) - }) - - it('rejects applying the invalidated coupon to an order', async () => { - const error = await captureError(() => - user.user.order.placeOrder.mutate({ - selectedItems: [{ skuId, quantity: 1, slotId }], - addressId, - regionId: 1, - couponIds: [couponId], - }) - ) - - expect(error.message).toMatch(/invalid|expired|no longer valid/i) - }) - - it('rejects a coupon with both discount types', async () => { - const error = await captureError(() => - admin.admin.coupon.create.mutate({ - couponCode: `BOTH${uniqueSuffix()}`.toUpperCase(), - discountPercent: 10, - flatDiscount: 5, - isApplyForAll: true, - }) - ) - - expect(error.message).toMatch(/discountPercent or flatDiscount/i) - }) -}) diff --git a/apps/backend/tests/api/health.test.ts b/apps/backend/tests/api/health.test.ts deleted file mode 100644 index fa30ea9..0000000 --- a/apps/backend/tests/api/health.test.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Connectivity + config. No auth required. - */ - -import { apiClient, assertServerUp, health } from '../helpers/api' - -describe('health & config', () => { - beforeAll(async () => { - await assertServerUp() - }) - - it('GET /api/health responds 200', async () => { - const res = await health() - expect(res.status).toBe(200) - expect(res.ok).toBe(true) - }) - - it('common.healthCheck resolves over tRPC', async () => { - const result = await apiClient().common.healthCheck.query() - expect(result).toBeTruthy() - }) - - it('common.essentialConsts returns the runtime config', async () => { - const consts = await apiClient().common.essentialConsts.query() - - expect(typeof consts.freeDeliveryThreshold).toBe('number') - expect(typeof consts.assetsDomain).toBe('string') - expect(typeof consts.apiCacheKey).toBe('string') - expect(typeof consts.cacheVersion).toBe('number') - expect(typeof consts.slotsVersionNum).toBe('number') - }) -}) diff --git a/apps/backend/tests/api/misc-procedures.test.ts b/apps/backend/tests/api/misc-procedures.test.ts deleted file mode 100644 index d6f591c..0000000 --- a/apps/backend/tests/api/misc-procedures.test.ts +++ /dev/null @@ -1,303 +0,0 @@ -/** - * Remaining uncovered procedures: address update/delete rules, staff-user - * management, review responses, auth profile/password, upload-URL validation, - * the delivery polygon and getCartSlots. - */ - -import { apiClient, captureError, uniqueSuffix } from '../helpers/api' -import { - createFutureSlot, - createStoreWithSku, - registerThrowawayUser, - registerUserWithAddress, -} from '../helpers/fixtures' -import { staffSession } from '../helpers/sessions' - -const addressBody = (over: Record = {}) => ({ - regionId: 1, - name: 'API Address', - phone: '9999999999', - addressLine1: '1 API Street', - city: 'Mahabubnagar', - state: 'Telangana', - isDefault: false, - ...over, -}) - -describe('misc procedures', () => { - let admin: ReturnType - - beforeAll(async () => { - const staff = await staffSession() - admin = apiClient(staff.token) - }) - - describe('address rules', () => { - it('rejects updating another user address', async () => { - const owner = await registerUserWithAddress() - const other = await registerUserWithAddress() - - const error = await captureError(() => - apiClient(other.token).user.address.updateAddress.mutate({ - id: owner.addressId, - ...addressBody({ name: 'hijack' }), - }) - ) - expect(error.message).toMatch(/address not found/i) - }) - - it('refuses to delete the default address', async () => { - const user = await registerUserWithAddress() - - const error = await captureError(() => - apiClient(user.token).user.address.deleteAddress.mutate({ id: user.addressId }) - ) - expect(error.message).toMatch(/cannot delete default address/i) - }) - - it('refuses to delete an address attached to an ongoing order', async () => { - const store = await createStoreWithSku({ price: 100 }) - const slot = await createFutureSlot([store.skuId]) - const user = await registerUserWithAddress() - - const extra = await apiClient(user.token).user.address.createAddress.mutate( - addressBody({ name: 'Order address' }) - ) - const orderAddressId = extra.data!.id - - await apiClient(user.token).user.order.placeOrder.mutate({ - selectedItems: [{ skuId: store.skuId, quantity: 1, slotId: slot.slotId }], - addressId: orderAddressId, - regionId: 1, - }) - - const error = await captureError(() => - apiClient(user.token).user.address.deleteAddress.mutate({ id: orderAddressId }) - ) - expect(error.message).toMatch(/ongoing order/i) - }) - - it('deletes an unused non-default address', async () => { - const user = await registerUserWithAddress() - - const extra = await apiClient(user.token).user.address.createAddress.mutate( - addressBody({ name: 'Unused' }) - ) - - const res = await apiClient(user.token).user.address.deleteAddress.mutate({ - id: extra.data!.id, - }) - expect(res.success).toBe(true) - }) - - it('returns the default address', async () => { - const user = await registerUserWithAddress() - - const res = await apiClient(user.token).user.address.getDefaultAddress.query() - expect(res.data?.id).toBe(user.addressId) - }) - }) - - describe('staff user management', () => { - it('lists roles', async () => { - const res = await admin.admin.staffUser.getRoles.query() - expect(Array.isArray(res.roles)).toBe(true) - expect(res.roles.length).toBeGreaterThan(0) - }) - - it('creates a staff user, lists it and rejects a duplicate name', async () => { - const roles = await admin.admin.staffUser.getRoles.query() - const name = `misc-staff-${uniqueSuffix()}` - - const created = await admin.admin.staffUser.createStaffUser.mutate({ - name, - password: 'Passw0rd!', - roleId: roles.roles[0].id, - }) - expect(created).toBeTruthy() - - const staff = (await admin.admin.staffUser.getStaff.query()) as - | { id: number; name: string }[] - | { staff?: { id: number; name: string }[] } - const list = Array.isArray(staff) ? staff : (staff.staff ?? []) - expect(list.some((s) => s.name === name)).toBe(true) - - const error = await captureError(() => - admin.admin.staffUser.createStaffUser.mutate({ - name, - password: 'Passw0rd!', - roleId: roles.roles[0].id, - }) - ) - expect(error.message).toMatch(/already exists/i) - }) - }) - - describe('product reviews', () => { - it('responds to a review and returns the response', async () => { - const store = await createStoreWithSku() - const buyer = await registerUserWithAddress() - const body = `Review ${uniqueSuffix()}` - - await apiClient(buyer.token).user.product.createReview.mutate({ - productId: store.productId, - reviewBody: body, - ratings: 4, - }) - - const listed = await admin.admin.product.getProductReviews.query({ - productId: store.productId, - limit: 50, - offset: 0, - }) - const review = listed.reviews.find( - (r: { reviewBody: string }) => r.reviewBody === body - ) - expect(review).toBeDefined() - - const res = await admin.admin.product.respondToReview.mutate({ - reviewId: review!.id, - adminResponse: 'Thanks for the feedback', - }) - expect(res.success).toBe(true) - - const after = await admin.admin.product.getProductReviews.query({ - productId: store.productId, - limit: 50, - offset: 0, - }) - const updated = after.reviews.find((r: { id: number }) => r.id === review!.id) - expect(updated!.adminResponse).toBe('Thanks for the feedback') - }) - }) - - describe('user auth', () => { - it('updates the profile and returns the new name', async () => { - const user = await registerUserWithAddress() - const newName = `Renamed ${uniqueSuffix()}` - - const res = await apiClient(user.token).user.auth.updateProfile.mutate({ - name: newName, - bio: 'hello bio', - }) - expect(res.success).toBe(true) - - const self = await apiClient(user.token).user.user.getSelfData.query() - expect(self.data.user.name).toBe(newName) - }) - - it('rejects a too-short password', async () => { - const user = await registerUserWithAddress() - - const error = await captureError(() => - apiClient(user.token).user.auth.updatePassword.mutate({ password: '123' }) - ) - expect(error).toBeInstanceOf(Error) - }) - - it('updatePassword: the new password works and the old one fails', async () => { - const suffix = uniqueSuffix() - const mobile = `9${String(Math.floor(Math.random() * 1e9)).padStart(9, '0')}` - - const reg = await apiClient().user.auth.register.mutate({ - name: `PW ${suffix}`, - email: `pw-${suffix}@example.com`, - mobile, - password: 'OldPass123', - }) - - const res = await apiClient(reg.data.token).user.auth.updatePassword.mutate({ - password: 'NewPass456', - }) - expect(res.success).toBe(true) - - // The new password authenticates... - const newLogin = await apiClient().user.auth.login.mutate({ - identifier: mobile, - password: 'NewPass456', - }) - expect(newLogin.data.token).toBeTruthy() - - // ...and the old one no longer does. - const error = await captureError(() => - apiClient().user.auth.login.mutate({ identifier: mobile, password: 'OldPass123' }) - ) - expect(error.message).toMatch(/invalid credentials/i) - }) - }) - - describe('upload urls', () => { - it('rejects an unknown context', async () => { - const user = await registerThrowawayUser() - const error = await captureError(() => - apiClient(user.token).common.generateUploadUrls.mutate({ - contextString: 'nope' as never, - mimeTypes: ['image/jpeg'], - }) - ) - expect(error).toBeInstanceOf(Error) - }) - - it('still returns a URL for an unrecognised mime type', async () => { - const user = await registerThrowawayUser() - const res = await apiClient(user.token).common.generateUploadUrls.mutate({ - contextString: 'complaint', - mimeTypes: ['application/octet-stream'], - }) - expect(res.uploadUrls).toHaveLength(1) - }) - }) - - describe('delivery polygon', () => { - it('accepts a point inside the delivery area', async () => { - const res = await apiClient().common.checkLocationInPolygon.query({ - lat: 16.747227, - lng: 78.009737, - }) - expect(res).toEqual({ isInside: true }) - }) - - it('rejects a point outside the delivery area', async () => { - const res = await apiClient().common.checkLocationInPolygon.query({ - lat: 17.747227, - lng: 79.009737, - }) - expect(res).toEqual({ isInside: false }) - }) - - it('rejects out-of-range coordinates', async () => { - const error = await captureError(() => - apiClient().common.checkLocationInPolygon.query({ lat: 999, lng: 0 }) - ) - expect(error).toBeInstanceOf(Error) - }) - }) - - describe('cart slots', () => { - it('returns an empty object for no products', async () => { - const res = await apiClient().user.cart.getCartSlots.query({ regionId: 1, productIds: [] }) - expect(res).toEqual({}) - }) - - it('returns a slot map keyed by product id', async () => { - const store = await createStoreWithSku() - await createFutureSlot([store.skuId]) - - const res = (await apiClient().user.cart.getCartSlots.query({ - regionId: 1, - productIds: [store.skuId], - })) as Record - - expect(Object.keys(res)).toContain(String(store.skuId)) - }) - }) - - describe('constants', () => { - it('exposes internalAppVersion to the user app via essentialConsts', async () => { - const consts = (await apiClient().common.essentialConsts.query({ boundId: 1 })) as { - internalAppVersion?: number - } - expect(typeof consts.internalAppVersion).toBe('number') - }) - }) -}) diff --git a/apps/backend/tests/api/order-edge-cases.test.ts b/apps/backend/tests/api/order-edge-cases.test.ts deleted file mode 100644 index 724ddc6..0000000 --- a/apps/backend/tests/api/order-edge-cases.test.ts +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Guards around placeOrder. Documents the backend's actual behaviour, including - * the known gap that a non-existent slot only fails via the FK. - */ - -import { apiClient } from '../helpers/api' -import { createFutureSlot, createStoreWithSku, ensureUserAddress } from '../helpers/fixtures' -import { userSession } from '../helpers/sessions' - -/** Run a call that must reject and hand back the error. */ -async function captureError(fn: () => Promise): Promise { - let error: Error | null = null - try { - await fn() - } catch (caught) { - error = caught as Error - } - if (!error) { - throw new Error('[api-tests] expected the call to reject, but it resolved') - } - return error -} - -describe('placeOrder guards', () => { - let userToken = '' - let skuId = 0 - let slotId = 0 - let addressId = 0 - - beforeAll(async () => { - const store = await createStoreWithSku() - const slot = await createFutureSlot([store.skuId]) - const address = await ensureUserAddress() - const user = await userSession() - - userToken = user.token - skuId = store.skuId - slotId = slot.slotId - addressId = address.addressId - }) - - it('rejects an unauthenticated request', async () => { - const error = await captureError(() => - apiClient().user.order.placeOrder.mutate({ - selectedItems: [{ skuId, quantity: 1, slotId }], - addressId, - }) - ) - - expect(error.message).toMatch(/UNAUTHORIZED|unauthorized|Authentication/i) - }) - - it('rejects an address that is not the user\'s', async () => { - const error = await captureError(() => - apiClient(userToken).user.order.placeOrder.mutate({ - selectedItems: [{ skuId, quantity: 1, slotId }], - addressId: 99_999_999, - }) - ) - - expect(error.message).toMatch(/Invalid address/i) - }) - - it('rejects an unknown skuId', async () => { - const error = await captureError(() => - apiClient(userToken).user.order.placeOrder.mutate({ - selectedItems: [{ skuId: 99_999_999, quantity: 1, slotId }], - addressId, - }) - ) - - expect(error.message).toMatch(/not found/i) - }) - - it('accepts a non-existent slotId (known gap: no slot validity check)', async () => { - // placeOrder only checks slot *capacity*; there is no FK/validity check on - // the slot, so a bogus id is stored verbatim. This test documents that - // behaviour — if the backend adds validation, update this case. - const bogusSlotId = 99_999_999 - - const res = await apiClient(userToken).user.order.placeOrder.mutate({ - selectedItems: [{ skuId, quantity: 1, slotId: bogusSlotId }], - addressId, - }) - - expect(res.success).toBe(true) - expect(res.data[0].slotId).toBe(bogusSlotId) - }) -}) diff --git a/apps/backend/tests/api/order-flow.test.ts b/apps/backend/tests/api/order-flow.test.ts deleted file mode 100644 index efc6c96..0000000 --- a/apps/backend/tests/api/order-flow.test.ts +++ /dev/null @@ -1,80 +0,0 @@ -/** - * The requested flow: create an order, then read it back. - * - * Fixtures (store/SKU/slot/address) are created through the API because there is - * no seed for them. Orders are left behind. - */ - -import { apiClient } from '../helpers/api' -import { createFutureSlot, createStoreWithSku, ensureUserAddress } from '../helpers/fixtures' -import { userSession } from '../helpers/sessions' - -describe('order flow: create an order, then read it back', () => { - let userToken = '' - let skuId = 0 - let slotId = 0 - let addressId = 0 - let placedOrderId = 0 - - beforeAll(async () => { - const store = await createStoreWithSku() - const slot = await createFutureSlot([store.skuId]) - const address = await ensureUserAddress() - const user = await userSession() - - userToken = user.token - skuId = store.skuId - slotId = slot.slotId - addressId = address.addressId - }) - - it('lists the created slot via user.slots.getSlots', async () => { - const slots = await apiClient().user.slots.getSlots.query({ regionId: 1 }) - - expect(slots.slots.some((s) => s.id === slotId)).toBe(true) - }) - - it('places a COD order and echoes the total', async () => { - const res = await apiClient(userToken).user.order.placeOrder.mutate({ - selectedItems: [{ skuId, quantity: 1, slotId }], - addressId, - }) - - expect(res.success).toBe(true) - expect(Array.isArray(res.data)).toBe(true) - expect(res.data.length).toBeGreaterThan(0) - - const order = res.data[0] - expect(order.id).toBeGreaterThan(0) - expect(Number(order.totalAmount)).toBeGreaterThan(0) - - placedOrderId = order.id - }) - - it('returns the new order from user.order.getOrders', async () => { - expect(placedOrderId).toBeGreaterThan(0) - - const res = await apiClient(userToken).user.order.getOrders.query({ - page: 1, - pageSize: 10, - }) - - const order = res.data.find((o) => o.id === placedOrderId) - expect(order).toBeDefined() - expect(order!.deliveryStatus).toBe('pending') - expect(order!.items.length).toBe(1) - expect(res.pagination.totalCount).toBeGreaterThan(0) - }) - - it('returns the same order from user.order.getOrderById', async () => { - const detail = await apiClient(userToken).user.order.getOrderById.query({ - orderId: String(placedOrderId), - }) - - expect(detail.id).toBe(placedOrderId) - expect(detail.orderAmount).toBeGreaterThan(0) - expect(detail.items.length).toBe(1) - expect(detail.items[0].amount).toBeGreaterThan(0) - }) - -}) diff --git a/apps/backend/tests/api/order-lifecycle-gaps.test.ts b/apps/backend/tests/api/order-lifecycle-gaps.test.ts deleted file mode 100644 index d3a4d93..0000000 --- a/apps/backend/tests/api/order-lifecycle-gaps.test.ts +++ /dev/null @@ -1,212 +0,0 @@ -/** - * Order lifecycle gaps: coupon-usage rollback, first-order-only poisoning, - * cancel error swallowing and the (missing) status transition guards. - * - * Known bugs are pinned — see tests/BUGS.md. - */ - -import { apiClient, captureError, uniqueSuffix } from '../helpers/api' -import { - createFutureSlot, - createStoreWithSku, - registerUserWithAddress, -} from '../helpers/fixtures' -import { staffSession } from '../helpers/sessions' - -const couponCode = () => - `LC${uniqueSuffix()}`.toUpperCase().replace(/[^A-Z0-9]/g, '').slice(0, 20) - -describe('order lifecycle gaps', () => { - let admin: ReturnType - let userToken = '' - let addressId = 0 - let skuId = 0 - let slotId = 0 - - beforeAll(async () => { - const staff = await staffSession() - admin = apiClient(staff.token) - - const store = await createStoreWithSku({ price: 100 }) - const slot = await createFutureSlot([store.skuId]) - const buyer = await registerUserWithAddress() - - userToken = buyer.token - addressId = buyer.addressId - skuId = store.skuId - slotId = slot.slotId - }) - - const place = (couponId?: number) => - apiClient(userToken).user.order.placeOrder.mutate({ - selectedItems: [{ skuId, quantity: 1, slotId }], - addressId, - regionId: 1, - ...(couponId ? { couponIds: [couponId] } : {}), - }) - - const cancel = (id: number, reason = 'lifecycle test') => - apiClient(userToken).user.order.cancelOrder.mutate({ id, reason }) - - const createCoupon = async (over: Record = {}) => { - const created = await admin.admin.coupon.create.mutate({ - couponCode: couponCode(), - minOrder: 1, - isApplyForAll: true, - validTill: new Date(Date.now() + 24 * 3600_000).toISOString(), - ...over, - }) - return created[0] - } - - it('releases the coupon usage when the (only) order is cancelled', async () => { - const coupon = await createCoupon({ flatDiscount: 5, maxLimitForUser: 1 }) - - const placed = await place(coupon.id) - await cancel(placed.data[0].id) - - // The usage row is deleted once every sibling order is cancelled, so the - // (now unused) coupon is spendable again. - const again = await place(coupon.id) - expect(again.success).toBe(true) - }) - - it('does not poison an isFirstOrderOnly coupon when the first order is cancelled', async () => { - const buyer = await registerUserWithAddress() - const coupon = await createCoupon({ flatDiscount: 5, isFirstOrderOnly: true }) - - // First order, then immediately cancelled. - const first = await apiClient(buyer.token).user.order.placeOrder.mutate({ - selectedItems: [{ skuId, quantity: 1, slotId }], - addressId: buyer.addressId, - regionId: 1, - }) - await apiClient(buyer.token).user.order.cancelOrder.mutate({ - id: first.data[0].id, - reason: 'changed mind', - }) - - // countEffectiveOrders ignores cancelled orders, so the user is still a - // first-order customer and the coupon applies. - const res = await apiClient(buyer.token).user.order.placeOrder.mutate({ - selectedItems: [{ skuId, quantity: 1, slotId }], - addressId: buyer.addressId, - regionId: 1, - couponIds: [coupon.id], - }) - expect(res.success).toBe(true) - }) - - it('keeps the coupon while a sibling order survives, releasing only when all are cancelled', async () => { - const buyer = await registerUserWithAddress() - const secondSlot = await createFutureSlot([skuId]) - const coupon = await createCoupon({ flatDiscount: 5, maxLimitForUser: 1 }) - - const placed = await apiClient(buyer.token).user.order.placeOrder.mutate({ - selectedItems: [ - { skuId, quantity: 1, slotId }, - { skuId, quantity: 1, slotId: secondSlot.slotId }, - ], - addressId: buyer.addressId, - regionId: 1, - couponIds: [coupon.id], - }) - expect(placed.data).toHaveLength(2) - - const placeAgain = () => - apiClient(buyer.token).user.order.placeOrder.mutate({ - selectedItems: [{ skuId, quantity: 1, slotId }], - addressId: buyer.addressId, - regionId: 1, - couponIds: [coupon.id], - }) - - // Cancel one sibling: the coupon stays attached to the surviving order. - await apiClient(buyer.token).user.order.cancelOrder.mutate({ - id: placed.data[0].id, - reason: 'partial', - }) - const stillUsed = await captureError(() => placeAgain()) - expect(stillUsed.message).toMatch(/usage limit/i) - - // Cancel the last sibling: now the coupon is released. - await apiClient(buyer.token).user.order.cancelOrder.mutate({ - id: placed.data[1].id, - reason: 'rest', - }) - const again = await placeAgain() - expect(again.success).toBe(true) - }) - - it('applies an isFirstOrderOnly coupon to a genuinely new user', async () => { - const buyer = await registerUserWithAddress() - const coupon = await createCoupon({ flatDiscount: 5, isFirstOrderOnly: true }) - - const res = await apiClient(buyer.token).user.order.placeOrder.mutate({ - selectedItems: [{ skuId, quantity: 1, slotId }], - addressId: buyer.addressId, - couponIds: [coupon.id], - }) - - expect(res.success).toBe(true) - }) - - it('pins: cancelling an already-cancelled order reports a generic message', async () => { - const placed = await place() - const orderId = placed.data[0].id - - await cancel(orderId) - - const error = await captureError(() => cancel(orderId)) - // The specific "already cancelled" 400 is masked by cancelOrder's catch. - expect(error.message).toMatch(/failed to cancel order/i) - }) - - it('propagates the specific notes guard for a cancelled order', async () => { - const placed = await place() - const orderId = placed.data[0].id - await cancel(orderId) - - const error = await captureError(() => - apiClient(userToken).user.order.updateUserNotes.mutate({ - id: orderId, - userNotes: 'too late', - }) - ) - // updateUserNotes has no catch, so the real message survives. - expect(error.message).toMatch(/cannot update notes for cancelled order/i) - }) - - it('pins: a cancelled order can still be marked delivered (no transition guard)', async () => { - const placed = await place() - const orderId = placed.data[0].id - await cancel(orderId) - - const res = await admin.admin.order.updateDelivered.mutate({ - orderId: String(orderId), - isDelivered: true, - }) - expect(res.success).toBe(true) - }) - - it('pins: delivered is reversible', async () => { - const placed = await place() - const orderId = placed.data[0].id - - await admin.admin.order.updateDelivered.mutate({ orderId: String(orderId), isDelivered: true }) - const res = await admin.admin.order.updateDelivered.mutate({ - orderId: String(orderId), - isDelivered: false, - }) - expect(res.success).toBe(true) - }) - - it('rejects a user cancellation of a delivered order', async () => { - const placed = await place() - const orderId = placed.data[0].id - await admin.admin.order.updateDelivered.mutate({ orderId: String(orderId), isDelivered: true }) - - const error = await captureError(() => cancel(orderId)) - expect(error.message).toMatch(/failed to cancel order/i) - }) -}) diff --git a/apps/backend/tests/api/order-lifecycle.test.ts b/apps/backend/tests/api/order-lifecycle.test.ts deleted file mode 100644 index 3a43db9..0000000 --- a/apps/backend/tests/api/order-lifecycle.test.ts +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Order lifecycle: notes, cancellation, pagination and the requested-id contract. - */ - -import { apiClient, captureError } from '../helpers/api' -import { createFutureSlot, createStoreWithSku, ensureUserAddress } from '../helpers/fixtures' -import { userSession } from '../helpers/sessions' - -describe('order lifecycle', () => { - let token = '' - let skuId = 0 - let addressId = 0 - let slotId = 0 - let orderId = 0 - - beforeAll(async () => { - const store = await createStoreWithSku() - const slot = await createFutureSlot([store.skuId]) - const address = await ensureUserAddress() - const user = await userSession() - - token = user.token - skuId = store.skuId - addressId = address.addressId - slotId = slot.slotId - - const res = await apiClient(token).user.order.placeOrder.mutate({ - selectedItems: [{ skuId, quantity: 1, slotId }], - addressId, - }) - orderId = res.data[0].id - }) - - it('persists special instructions', async () => { - const notes = `Leave at reception ${Date.now()}` - - await apiClient(token).user.order.updateUserNotes.mutate({ id: orderId, userNotes: notes }) - const detail = await apiClient(token).user.order.getOrderById.query({ - orderId: String(orderId), - }) - - expect(detail.userNotes).toBe(notes) - }) - - it('cancels the order with a reason and reflects it in the list', async () => { - const reason = `Changed my mind ${Date.now()}` - - await apiClient(token).user.order.cancelOrder.mutate({ id: orderId, reason }) - - const detail = await apiClient(token).user.order.getOrderById.query({ - orderId: String(orderId), - }) - expect(detail.cancelReason).toBe(reason) - expect(String(detail.orderStatus).toLowerCase()).toMatch(/cancel/) - - const list = await apiClient(token).user.order.getOrders.query({ page: 1, pageSize: 10 }) - const row = list.data.find((o) => o.id === orderId) - expect(row).toBeDefined() - expect(String(row!.deliveryStatus).toLowerCase()).toMatch(/cancel/) - }) - - it('rejects a cancellation without a reason', async () => { - const error = await captureError(() => - apiClient(token).user.order.cancelOrder.mutate({ id: orderId, reason: '' }) - ) - - expect(error).toBeInstanceOf(Error) - }) - - it('rejects a readable order id ("ORD") — the API wants the numeric string', async () => { - const error = await captureError(() => - apiClient(token).user.order.getOrderById.query({ orderId: `ORD${orderId}` }) - ) - - expect(error).toBeInstanceOf(Error) - }) - - it('paginates orders and rejects an oversized page size', async () => { - const page1 = await apiClient(token).user.order.getOrders.query({ page: 1, pageSize: 1 }) - const page2 = await apiClient(token).user.order.getOrders.query({ page: 2, pageSize: 1 }) - - expect(page1.data).toHaveLength(1) - expect(page1.pagination.totalCount).toBeGreaterThan(1) - if (page2.data.length > 0) { - expect(page2.data[0].id).not.toBe(page1.data[0].id) - } - - const error = await captureError(() => - apiClient(token).user.order.getOrders.query({ page: 1, pageSize: 51 }) - ) - expect(error).toBeInstanceOf(Error) - }) -}) diff --git a/apps/backend/tests/api/order-rules.test.ts b/apps/backend/tests/api/order-rules.test.ts deleted file mode 100644 index 1e5e883..0000000 --- a/apps/backend/tests/api/order-rules.test.ts +++ /dev/null @@ -1,143 +0,0 @@ -/** - * Order business rules: delivery charge vs the free-delivery threshold, per-slot - * grouping, slot capacity and the flash-delivery gate. - * - * Uses a tiny-priced SKU (5) so a single unit sits below `freeDeliveryThreshold`. - */ - -import { apiClient, captureError } from '../helpers/api' -import { asNumber, getConstants, setConst } from '../helpers/consts' -import { createFutureSlot, createStoreWithSku, ensureUserAddress } from '../helpers/fixtures' -import { staffSession, userSession } from '../helpers/sessions' - -const UNIT_PRICE = 5 - -describe('order rules', () => { - let token = '' - let skuId = 0 - let addressId = 0 - let slotId = 0 - let secondSlotId = 0 - let charge = 0 - let freeDeliveryThreshold = 0 - - beforeAll(async () => { - const store = await createStoreWithSku({ price: UNIT_PRICE }) - const slot = await createFutureSlot([store.skuId], { deliveryInHours: 3, freezeInHours: 2 }) - const secondSlot = await createFutureSlot([store.skuId], { - deliveryInHours: 6, - freezeInHours: 5, - }) - const address = await ensureUserAddress() - const user = await userSession() - const consts = await getConstants() - - token = user.token - skuId = store.skuId - addressId = address.addressId - slotId = slot.slotId - secondSlotId = secondSlot.slotId - charge = asNumber(consts.deliveryCharge) - freeDeliveryThreshold = asNumber(consts.freeDeliveryThreshold) - }) - - it('adds the configured delivery charge below the free-delivery threshold', async () => { - // Guard: this case is only meaningful while a single unit is below the threshold. - expect(freeDeliveryThreshold).toBeGreaterThan(UNIT_PRICE) - - const res = await apiClient(token).user.order.placeOrder.mutate({ - selectedItems: [{ skuId, quantity: 1, slotId }], - addressId, - regionId: 1, - }) - - expect(res.data[0].deliveryCharge).toBe(String(charge)) - }) - - it('waives the delivery charge at or above the free-delivery threshold', async () => { - const quantity = Math.ceil(freeDeliveryThreshold / UNIT_PRICE) + 1 - - const res = await apiClient(token).user.order.placeOrder.mutate({ - selectedItems: [{ skuId, quantity, slotId }], - addressId, - regionId: 1, - }) - - expect(res.data[0].deliveryCharge).toBe('0') - }) - - it('groups items from different slots into one order per slot, charging once', async () => { - const res = await apiClient(token).user.order.placeOrder.mutate({ - selectedItems: [ - { skuId, quantity: 1, slotId }, - { skuId, quantity: 1, slotId: secondSlotId }, - ], - addressId, - regionId: 1, - }) - - expect(res.data).toHaveLength(2) - expect(new Set(res.data.map((o) => o.slotId))).toEqual(new Set([slotId, secondSlotId])) - - const charged = res.data.filter((o) => o.deliveryCharge !== '0') - expect(charged).toHaveLength(1) - }) - - it('rejects an order for a full slot', async () => { - const staff = await staffSession() - const admin = apiClient(staff.token) - - await admin.admin.slots.updateSlotCapacity.mutate({ - slotId, - isCapacityFull: true, - }) - - try { - const error = await captureError(() => - apiClient(token).user.order.placeOrder.mutate({ - selectedItems: [{ skuId, quantity: 1, slotId }], - addressId, - regionId: 1, - }) - ) - expect(error.message).toMatch(/capacity/i) - } finally { - await admin.admin.slots.updateSlotCapacity.mutate({ - slotId, - isCapacityFull: false, - }) - } - }) - - it('rejects flash delivery while it is disabled', async () => { - const consts = await getConstants() - const wasEnabled = consts.isFlashDeliveryEnabled === true - if (wasEnabled) await setConst('isFlashDeliveryEnabled', false) - - try { - const error = await captureError(() => - apiClient(token).user.order.placeOrder.mutate({ - selectedItems: [{ skuId, quantity: 1, slotId: null }], - addressId, - regionId: 1, - isFlashDelivery: true, - }) - ) - expect(error.message).toMatch(/flash/i) - } finally { - if (wasEnabled) await setConst('isFlashDeliveryEnabled', true) - } - }) - - it('rejects an invalid quantity', async () => { - const error = await captureError(() => - apiClient(token).user.order.placeOrder.mutate({ - selectedItems: [{ skuId, quantity: 0, slotId }], - addressId, - regionId: 1, - }) - ) - - expect(error).toBeInstanceOf(Error) - }) -}) diff --git a/apps/backend/tests/api/place-order-edge-cases.test.ts b/apps/backend/tests/api/place-order-edge-cases.test.ts deleted file mode 100644 index 430dcc0..0000000 --- a/apps/backend/tests/api/place-order-edge-cases.test.ts +++ /dev/null @@ -1,219 +0,0 @@ -/** - * placeOrder guard/behaviour coverage that the existing suites do not reach: - * stock, quantity, slot validity, flash pricing, suspension and double-submit. - * - * Guards now enforced by placeOrderUtil (region, stock, slot state/membership) - * are asserted as rejections. Remaining gaps (empty carts, no quantity cap, no - * idempotency) are still pinned as known bugs. See tests/BUGS.md. - */ - -import { apiClient, captureError } from '../helpers/api' -import { asNumber, getConstants, setConst } from '../helpers/consts' -import { - createFutureSlot, - createStoreWithSku, - registerUserWithAddress, -} from '../helpers/fixtures' -import { staffSession } from '../helpers/sessions' - -describe('placeOrder edge cases', () => { - let admin: ReturnType - let userToken = '' - let addressId = 0 - let userId = 0 - let skuId = 0 - let slotId = 0 - let otherSkuId = 0 - let flashSkuId = 0 - let flashFallbackSkuId = 0 - let plainSkuId = 0 - let flashDeliveryCharge = 0 - - beforeAll(async () => { - const staff = await staffSession() - admin = apiClient(staff.token) - - const store = await createStoreWithSku({ price: 100 }) - const other = await createStoreWithSku({ price: 100 }) - const flash = await createStoreWithSku({ price: 100 }) - const flashFallback = await createStoreWithSku({ price: 100 }) - const plain = await createStoreWithSku({ price: 100 }) - - const slot = await createFutureSlot([store.skuId]) - const buyer = await registerUserWithAddress() - const consts = await getConstants() - - userToken = buyer.token - addressId = buyer.addressId - userId = buyer.userId - skuId = store.skuId - otherSkuId = other.skuId - flashSkuId = flash.skuId - flashFallbackSkuId = flashFallback.skuId - plainSkuId = plain.skuId - slotId = slot.slotId - flashDeliveryCharge = asNumber(consts.flashDeliveryCharge) - }) - - const place = (over: Record = {}) => - apiClient(userToken).user.order.placeOrder.mutate({ - selectedItems: [{ skuId, quantity: 1, slotId }], - addressId, - regionId: 1, - ...over, - }) - - const withFlashEnabled = async (fn: () => Promise): Promise => { - const before = await getConstants() - const wasEnabled = before.isFlashDeliveryEnabled === true - if (!wasEnabled) await setConst('isFlashDeliveryEnabled', true) - try { - return await fn() - } finally { - if (!wasEnabled) await setConst('isFlashDeliveryEnabled', false) - } - } - - describe('stock', () => { - it('rejects an out-of-stock product', async () => { - const store = await createStoreWithSku({ price: 100 }) - const slot = await createFutureSlot([store.skuId]) - - await admin.admin.product.toggleOutOfStock.mutate({ id: store.productId }) - try { - const error = await captureError(() => - place({ selectedItems: [{ skuId: store.skuId, quantity: 1, slotId: slot.slotId }] }) - ) - expect(error.message).toMatch(/unavailable/i) - } finally { - await admin.admin.product.toggleOutOfStock.mutate({ id: store.productId }) - } - }) - }) - - describe('input validation gaps', () => { - it('pins: an empty selectedItems list fails with a raw DB error, not validation', async () => { - // There is no `.min(1)` on selectedItems, so the empty list reaches - // Drizzle, which throws "values() must be called with at least one value" - // instead of surfacing a 400 "no items" message. - const error = await captureError(() => place({ selectedItems: [] })) - expect(error.message).toMatch(/at least one value/i) - }) - - it('pins: an arbitrarily large quantity is accepted', async () => { - const res = await place({ selectedItems: [{ skuId, quantity: 1_000_000, slotId }] }) - expect(res.success).toBe(true) - expect(res.data[0].id).toBeGreaterThan(0) - }) - }) - - describe('slot validity', () => { - it('rejects an inactive slot', async () => { - const created = await admin.admin.slots.createSlot.mutate({ - deliveryTime: new Date(Date.now() + 3 * 3600_000).toISOString(), - freezeTime: new Date(Date.now() + 2 * 3600_000).toISOString(), - isActive: false, - skuIds: [skuId], - }) - - const error = await captureError(() => - place({ selectedItems: [{ skuId, quantity: 1, slotId: created.slot.id }] }) - ) - expect(error.message).toMatch(/not available/i) - }) - - it('rejects a slot whose freeze/delivery time has passed', async () => { - const created = await admin.admin.slots.createSlot.mutate({ - deliveryTime: new Date(Date.now() - 3600_000).toISOString(), - freezeTime: new Date(Date.now() - 2 * 3600_000).toISOString(), - isActive: true, - skuIds: [skuId], - }) - - const error = await captureError(() => - place({ selectedItems: [{ skuId, quantity: 1, slotId: created.slot.id }] }) - ) - expect(error.message).toMatch(/closed for orders/i) - }) - - it('rejects a slot that does not carry the ordered SKU', async () => { - const slotWithOtherSku = await createFutureSlot([otherSkuId]) - - const error = await captureError(() => - place({ - selectedItems: [{ skuId, quantity: 1, slotId: slotWithOtherSku.slotId }], - }) - ) - expect(error.message).toMatch(/not available in the selected/i) - }) - }) - - describe('flash delivery pricing', () => { - it('rejects a non-flash SKU on a flash order', async () => { - await withFlashEnabled(async () => { - const error = await captureError(() => - place({ - selectedItems: [{ skuId: plainSkuId, quantity: 1, slotId: null }], - isFlashDelivery: true, - }) - ) - expect(error.message).toMatch(/not available for flash delivery/i) - }) - }) - - it('charges flashPrice plus the flash delivery charge', async () => { - await admin.admin.product.updateProductPrices.mutate({ - updates: [{ skuId: flashSkuId, flashPrice: 60, isFlashAvailable: true }], - }) - - await withFlashEnabled(async () => { - const res = await place({ - selectedItems: [{ skuId: flashSkuId, quantity: 1, slotId: null }], - isFlashDelivery: true, - }) - - // 60 (flashPrice, not the 100 list price) < flashFreeDeliveryThreshold, - // so the flash delivery charge is added on top. - expect(parseFloat(res.data[0].totalAmount)).toBe(60 + flashDeliveryCharge) - }) - }) - - it('falls back to the regular price when flashPrice is null', async () => { - await admin.admin.product.updateProductPrices.mutate({ - updates: [{ skuId: flashFallbackSkuId, flashPrice: null, isFlashAvailable: true }], - }) - - await withFlashEnabled(async () => { - const res = await place({ - selectedItems: [{ skuId: flashFallbackSkuId, quantity: 1, slotId: null }], - isFlashDelivery: true, - }) - - expect(parseFloat(res.data[0].totalAmount)).toBe(100 + flashDeliveryCharge) - }) - }) - }) - - describe('suspension', () => { - it('rejects a suspended user with a 403-style error', async () => { - await admin.admin.user.updateUserSuspension.mutate({ userId, isSuspended: true }) - try { - const error = await captureError(() => place()) - expect(error.message).toMatch(/unable to place order/i) - } finally { - await admin.admin.user.updateUserSuspension.mutate({ userId, isSuspended: false }) - } - }) - }) - - describe('duplicate submission', () => { - it('pins: two identical requests create two orders (no idempotency key)', async () => { - const first = await place() - const second = await place() - - expect(first.data[0].id).toBeGreaterThan(0) - expect(second.data[0].id).toBeGreaterThan(0) - expect(first.data[0].id).not.toBe(second.data[0].id) - }) - }) -}) diff --git a/apps/backend/tests/api/uploads.test.ts b/apps/backend/tests/api/uploads.test.ts deleted file mode 100644 index ba11712..0000000 --- a/apps/backend/tests/api/uploads.test.ts +++ /dev/null @@ -1,133 +0,0 @@ -/** - * Image uploads — the round trip, not just the response shape. - * - * The presigned PUT carries its own signature, so this suite needs no R2 credentials: - * it PUTs real bytes to the URL `common.generateUploadUrls` returns, then GETs the object - * back from the public assets domain (the same source the app renders from) and compares. - * - * Objects are left in the dev bucket, consistent with the rest of these tests. - */ - -import { createHash } from 'crypto' - -import { apiClient, uniqueSuffix } from '../helpers/api' -import { essentialConsts } from '../helpers/cache' -import { userSession } from '../helpers/sessions' - -/** Two 1x1 PNGs that differ only in pixel data, so a mix-up is visible. */ -const PNG_RED = Buffer.from( - 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8DwHwAFAAH/q842iQAAAABJRU5ErkJggg==', - 'base64' -) -const PNG_BLUE = Buffer.from( - 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M/wHwAE/wH/9tH4WQAAAABJRU5ErkJggg==', - 'base64' -) - -const sha = (bytes: Buffer) => createHash('sha256').update(bytes).digest('hex') - -/** The object key, as extractKeyFromPresignedUrl derives it (last two path segments). */ -const keyFromUploadUrl = (url: string) => { - const parts = new URL(url).pathname.split('/').filter(Boolean) - return decodeURIComponent(parts.slice(-2).join('/')) -} - -const publicUrlFor = (assetsDomain: string, key: string) => - `${assetsDomain.replace(/\/+$/, '')}/${key}` - -/** Presign one file and return its URL plus the key it points at. */ -async function presign( - client: ReturnType, - contextString: string, - mimeType: string -) { - const { uploadUrls } = await client.common.generateUploadUrls.mutate({ - contextString: contextString as never, - mimeTypes: [mimeType], - }) - const url = uploadUrls[0] - return { url, key: keyFromUploadUrl(url) } -} - -async function put(url: string, bytes: Buffer) { - const res = await fetch(url, { - method: 'PUT', - body: new Uint8Array(bytes), - }) - if (!res.ok) { - throw new Error( - `[uploads] PUT failed: ${res.status} ${res.statusText} ${await res.text().catch(() => '')}` - ) - } -} - -/** GET the object from the public domain; returns null when it is not there. */ -async function fetchObject(url: string) { - const res = await fetch(url) - if (!res.ok) return null - return Buffer.from(await res.arrayBuffer()) -} - -describe('image upload round trip', () => { - let client: ReturnType - let assetsDomain: string - - beforeAll(async () => { - const session = await userSession() - client = apiClient(session.token) - assetsDomain = (await essentialConsts()).assetsDomain - }) - - it('stores exactly the bytes that were uploaded', async () => { - const { url, key } = await presign(client, 'product_info', 'image/png') - expect(url).toContain('X-Amz-Signature') - - await put(url, PNG_RED) - - const served = await fetchObject(publicUrlFor(assetsDomain, key)) - expect(served).not.toBeNull() - expect(served!.length).toBe(PNG_RED.length) - expect(served!.equals(PNG_RED)).toBe(true) - expect(sha(served!)).toBe(sha(PNG_RED)) - }) - - it('keeps two uploads distinct — each URL serves its own object', async () => { - const first = await presign(client, 'product_info', 'image/png') - const second = await presign(client, 'tags', 'image/png') - expect(second.key).not.toBe(first.key) - - await put(first.url, PNG_RED) - await put(second.url, PNG_BLUE) - - const servedFirst = await fetchObject(publicUrlFor(assetsDomain, first.key)) - const servedSecond = await fetchObject(publicUrlFor(assetsDomain, second.key)) - - expect(servedFirst!.equals(PNG_RED)).toBe(true) - expect(servedSecond!.equals(PNG_BLUE)).toBe(true) - // The two documents really are different files. - expect(sha(servedFirst!)).not.toBe(sha(servedSecond!)) - }) - - it('gives every mime type in one call a usable URL', async () => { - const { uploadUrls } = await client.common.generateUploadUrls.mutate({ - contextString: 'review', - mimeTypes: ['image/png', 'image/jpeg'], - }) - expect(uploadUrls).toHaveLength(2) - - const keys = uploadUrls.map(keyFromUploadUrl) - expect(new Set(keys).size).toBe(2) - - await put(uploadUrls[0], PNG_RED) - await put(uploadUrls[1], PNG_BLUE) - - expect((await fetchObject(publicUrlFor(assetsDomain, keys[0])))!.equals(PNG_RED)).toBe(true) - expect((await fetchObject(publicUrlFor(assetsDomain, keys[1])))!.equals(PNG_BLUE)).toBe(true) - }) - - it('returns 404 for an object that was never uploaded', async () => { - // Guards the read-back itself: a passing comparison must mean the object is really there. - const missing = publicUrlFor(assetsDomain, `product-images/never-${uniqueSuffix()}.png`) - expect(await fetchObject(missing)).toBeNull() - }) -}) diff --git a/apps/backend/tests/api/user-surface.test.ts b/apps/backend/tests/api/user-surface.test.ts deleted file mode 100644 index 8e1063b..0000000 --- a/apps/backend/tests/api/user-surface.test.ts +++ /dev/null @@ -1,108 +0,0 @@ -/** - * User-facing product / coupon / profile surface + the complaint lifecycle - * (raise as the user, resolve as staff). - */ - -import { apiClient, captureError } from '../helpers/api' -import { createStoreWithSku } from '../helpers/fixtures' -import { staffSession, userSession } from '../helpers/sessions' - -describe('user surface', () => { - let token = '' - let userId = 0 - let productId = 0 - - beforeAll(async () => { - const store = await createStoreWithSku() - const user = await userSession() - - token = user.token - userId = user.userId - productId = store.productId - }) - - it('returns the product detail for a product id', async () => { - const detail = await apiClient().user.product.getProductDetails.query({ - id: String(productId), - regionId: 1, - }) - - expect((detail as { name?: string })?.name).toBeTruthy() - }) - - it('creates a review and returns it from getProductReviews', async () => { - const body = `API test review ${Date.now()}` - - await apiClient(token).user.product.createReview.mutate({ - productId, - reviewBody: body, - ratings: 5, - }) - - const reviews = await apiClient().user.product.getProductReviews.query({ - productId, - limit: 50, - offset: 0, - }) - - expect(Array.isArray(reviews.reviews)).toBe(true) - expect(reviews.reviews.some((r) => r.reviewBody === body)).toBe(true) - }) - - it('returns presigned upload URLs', async () => { - const res = await apiClient(token).common.generateUploadUrls.mutate({ - contextString: 'complaint', - mimeTypes: ['image/jpeg'], - }) - - expect(Array.isArray(res.uploadUrls)).toBe(true) - expect(res.uploadUrls).toHaveLength(1) - }) - - it('exposes eligible and owned coupons', async () => { - const eligible = await apiClient(token).user.coupon.getEligible.query() - expect(Array.isArray(eligible.data)).toBe(true) - - const mine = await apiClient(token).user.coupon.getMyCoupons.query() - expect(Array.isArray(mine.data.personal)).toBe(true) - expect(Array.isArray(mine.data.general)).toBe(true) - }) - - it('rejects redeeming an unknown coupon code', async () => { - const error = await captureError(() => - apiClient(token).user.coupon.redeemReservedCoupon.mutate({ - secretCode: `NO-SUCH-COUPON-${Date.now()}`, - }) - ) - - expect(error.message).toMatch(/invalid|redeemed/i) - }) - - it('returns the signed-in user profile', async () => { - const self = await apiClient(token).user.user.getSelfData.query() - - expect(self.data.user.id).toBe(userId) - }) - - it('raises a complaint that staff can resolve', async () => { - const staff = await staffSession() - const admin = apiClient(staff.token) - - const body = `API test complaint ${Date.now()}` - await apiClient(token).user.complaint.raise.mutate({ complaintBody: body }) - - const listed = await apiClient(token).user.complaint.getAll.query() - const complaint = listed.complaints.find((c) => c.complaintBody === body) - expect(complaint).toBeDefined() - expect(complaint!.isResolved).toBe(false) - - await admin.admin.complaint.resolve.mutate({ - id: String(complaint!.id), - response: 'Resolved by API test', - }) - - const after = await apiClient(token).user.complaint.getAll.query() - const resolved = after.complaints.find((c) => c.id === complaint!.id) - expect(resolved!.isResolved).toBe(true) - }) -}) diff --git a/apps/backend/tests/helpers/api.ts b/apps/backend/tests/helpers/api.ts deleted file mode 100644 index 32ee4a7..0000000 --- a/apps/backend/tests/helpers/api.ts +++ /dev/null @@ -1,74 +0,0 @@ -/** - * HTTP client + small utilities for the backend API tests. - * - * Uses the same wire protocol as the apps (`httpBatchLink`, no transformer): - * POST/GET /api/trpc/. -> [{ result: { data } }] - */ - -import { createTRPCClient, httpBatchLink } from '@trpc/client' -import type { AppRouter } from '@/src/trpc/router' -import { API_BASE_URL, TRPC_URL } from './env' - -export type ApiClient = ReturnType> - -/** A tRPC client; pass a token to authenticate as that user/staff. */ -export function apiClient(token?: string): ApiClient { - return createTRPCClient({ - links: [ - httpBatchLink({ - url: TRPC_URL, - headers: () => (token ? { Authorization: `Bearer ${token}` } : {}), - }), - ], - }) -} - -/** Unique-enough suffix so reruns don't collide on names/emails. */ -export function uniqueSuffix(): string { - return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 7)}` -} - -/** Run a call that must reject and hand back the error (fails if it resolves). */ -export async function captureError(fn: () => Promise): Promise { - let error: Error | null = null - try { - await fn() - } catch (caught) { - error = caught as Error - } - if (!error) { - throw new Error('[api-tests] expected the call to reject, but it resolved') - } - return error -} - -/** GET /api/health — the only unauthenticated REST endpoint. */ -export async function health(): Promise<{ ok: boolean; status: number; body: unknown }> { - const res = await fetch(`${API_BASE_URL}/api/health`) - let body: unknown = null - try { - body = await res.json() - } catch { - body = null - } - return { ok: res.ok, status: res.status, body } -} - -/** - * Fail fast with an actionable message when the local backend isn't running, - * instead of letting every request time out. - */ -export async function assertServerUp(): Promise { - try { - const res = await fetch(`${API_BASE_URL}/api/health`, { - signal: AbortSignal.timeout(5000), - }) - if (res.status >= 500) throw new Error(`health returned ${res.status}`) - } catch (error) { - throw new Error( - `[api-tests] Backend not reachable at ${API_BASE_URL}. Start it with ` + - `"cd apps/backend && bun run dev" (wrangler dev, port 8787). ` + - `Cause: ${(error as Error).message}` - ) - } -} diff --git a/apps/backend/tests/helpers/cache.ts b/apps/backend/tests/helpers/cache.ts deleted file mode 100644 index 1945804..0000000 --- a/apps/backend/tests/helpers/cache.ts +++ /dev/null @@ -1,101 +0,0 @@ -/** - * Static JSON cache helpers. - * - * The cache is written through the R2 S3 API and served from the assets domain - * (there is no backend route for it), so tests read the versioned public URL. - * Every file lives under the region that owns it: - * slots ${assetsDomain}regions/${regionId}/slots/v-/slots.json - * availability ${assetsDomain}regions/${regionId}/av-/availability.json - * products ${assetsDomain}${apiCacheKey}/regions/${regionId}/v-/products.json - * store detail ${assetsDomain}${apiCacheKey}/regions/${regionId}/v-/stores/.json - * - * Versions come from common.essentialConsts. - */ - -import { apiClient } from './api' - -export interface EssentialConsts { - assetsDomain: string - apiCacheKey: string - cacheVersion: number - slotsVersionNum: number - availabilityVersionNum: number - regionId?: number - [key: string]: unknown -} - -export async function essentialConsts(): Promise { - const consts = (await apiClient().common.essentialConsts.query()) as EssentialConsts - if (!consts?.assetsDomain || !consts?.apiCacheKey) { - throw new Error( - `[api-tests] common.essentialConsts is missing assetsDomain/apiCacheKey: ${JSON.stringify(consts)}` - ) - } - return consts -} - -// Cache files are region-owned: `regions//...` sits between the assets -// domain and the versioned filename. -const regionPath = (c: EssentialConsts) => - c.regionId != null ? `regions/${c.regionId}/` : '' - -export const slotsCacheUrl = (c: EssentialConsts, version: number) => - `${c.assetsDomain}${regionPath(c)}slots/v-${version}/slots.json` - -export const availabilityCacheUrl = (c: EssentialConsts, version: number) => - `${c.assetsDomain}${regionPath(c)}av-${version}/availability.json` - -export const productsCacheUrl = (c: EssentialConsts, version: number) => - `${c.assetsDomain}${c.apiCacheKey}/${regionPath(c)}v-${version}/products.json` - -export const storesCacheUrl = (c: EssentialConsts, version: number) => - `${c.assetsDomain}${c.apiCacheKey}/${regionPath(c)}v-${version}/stores.json` - -export const essentialConstsCacheUrl = (c: EssentialConsts, version: number) => - `${c.assetsDomain}${c.apiCacheKey}/${regionPath(c)}v-${version}/essential-consts.json` - -export const storeDetailCacheUrl = (c: EssentialConsts, version: number, storeId: number) => - `${c.assetsDomain}${c.apiCacheKey}/${regionPath(c)}v-${version}/stores/${storeId}.json` - -/** GET a cache file and parse it; throws with the status on a non-2xx. */ -export async function fetchCacheJson(url: string): Promise { - const res = await fetch(url) - if (!res.ok) { - throw new Error(`[api-tests] ${res.status} ${res.statusText} fetching cache file ${url}`) - } - return (await res.json()) as T -} - -/** - * Retry `fn` until it returns a value or the timeout elapses. Used for the - * eventual products/stores cache (regenerated ~30s later by the CACHE_CREATOR - * Durable Object). - */ -export async function pollUntil( - label: string, - fn: () => Promise, - options: { timeoutMs?: number; intervalMs?: number } = {} -): Promise { - const timeoutMs = options.timeoutMs ?? 90_000 - const intervalMs = options.intervalMs ?? 5_000 - const deadline = Date.now() + timeoutMs - - let lastError: unknown = null - for (;;) { - try { - const value = await fn() - if (value) return value - } catch (error) { - lastError = error - } - - if (Date.now() >= deadline) { - throw new Error( - `[api-tests] timed out after ${timeoutMs}ms waiting for: ${label}` + - (lastError ? ` (last error: ${(lastError as Error).message})` : '') - ) - } - - await new Promise((resolve) => setTimeout(resolve, intervalMs)) - } -} diff --git a/apps/backend/tests/helpers/consts.ts b/apps/backend/tests/helpers/consts.ts deleted file mode 100644 index 54d7f8a..0000000 --- a/apps/backend/tests/helpers/consts.ts +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Constants the api tests read and flip. - * - * Constants live in three scope tables (`global_consts`, `region_consts`, - * `region_bound_consts`) plus the legacy `key_val_store`, and each scope has its - * own endpoint. These suites care about the delivery settings, which are - * BOUND-scoped, so they read/write the region's effective bound — the same bound - * `placeOrder` falls back to for an address with no coordinates (how these suites' - * addresses are created). - * - * Legacy constants are superadmin-only (`superadmin.const.getLegacyConstants`), and - * the test env has no superadmin credentials, so nothing here touches them anymore. - */ - -import { apiClient } from './api' -import { staffSession } from './sessions' - -export type Constants = Record - -/** The region's effective (lowest-priority) bound, as placeOrder resolves it. */ -export async function effectiveBoundId(regionId = 1): Promise { - const staff = await staffSession() - const bounds = await apiClient(staff.token).admin.region.bounds.query() - const bound = bounds.find((b) => b.regionId === regionId) ?? bounds[0] - if (!bound) { - throw new Error(`[api-tests] region ${regionId} has no configured bound`) - } - return bound.id -} - -/** DB rows come back as strings; give the suites real booleans and numbers. */ -const coerce = (raw: string | null | undefined): unknown => { - if (raw === null || raw === undefined) return undefined - if (raw === 'true') return true - if (raw === 'false') return false - const num = Number(raw) - return raw.trim() !== '' && Number.isFinite(num) ? num : raw -} - -/** - * The region's effective bound settings (deliveryCharge, freeDeliveryThreshold, - * flashDeliveryCharge, isFlashDeliveryEnabled). - */ -export async function getConstants(regionId = 1): Promise { - const staff = await staffSession() - const boundId = await effectiveBoundId(regionId) - const settings = await apiClient(staff.token).admin.region.getBoundSettings.query({ boundId }) - - const out: Constants = {} - for (const [key, value] of Object.entries(settings)) out[key] = coerce(value) - return out -} - -/** Update one bound constant (used to flip the flash gate, always restored by the caller). */ -export async function setConst(key: string, value: unknown, regionId = 1): Promise { - const staff = await staffSession() - const boundId = await effectiveBoundId(regionId) - await apiClient(staff.token).admin.region.updateBoundSettings.mutate({ - boundId, - settings: [{ key, value: String(value) }], - }) -} - -/** The caller's region constants (region_consts for the staff's own region). */ -export async function getRegionConstants(): Promise { - const staff = await staffSession() - const rows = await apiClient(staff.token).admin.region.getRegionConstants.query() - - const out: Constants = {} - for (const { key, value } of rows) out[key] = coerce(value) - return out -} - -/** Update one region constant. Null deletes the row. */ -export async function setRegionConst(key: string, value: string | number | boolean | null): Promise { - const staff = await staffSession() - await apiClient(staff.token).admin.region.updateRegionConstants.mutate({ - constants: [{ key, value }], - }) -} - -export function asNumber(value: unknown, fallback = 0): number { - const parsed = Number(value) - return Number.isFinite(parsed) ? parsed : fallback -} diff --git a/apps/backend/tests/helpers/env.ts b/apps/backend/tests/helpers/env.ts deleted file mode 100644 index 865912b..0000000 --- a/apps/backend/tests/helpers/env.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Environment for the backend API tests. - * - * Values come from tests/.env (loaded in tests/setup.ts). - */ - -export const API_BASE_URL = (process.env.API_BASE_URL ?? 'http://localhost:8787').replace( - /\/+$/, - '' -) - -export const TRPC_URL = `${API_BASE_URL}/api/trpc` - -function required(name: string): string { - const value = process.env[name] - if (!value || !value.trim()) { - throw new Error( - `[api-tests] ${name} is not set. Copy apps/backend/tests/.env.example to ` + - `apps/backend/tests/.env and fill it in.` - ) - } - return value.trim() -} - -export function adminCredentials() { - return { name: required('ADMIN_NAME'), password: required('ADMIN_PASSWORD') } -} - -export function userCredentials() { - return { identifier: required('USER_IDENTIFIER'), password: required('USER_PASSWORD') } -} diff --git a/apps/backend/tests/helpers/fixtures.ts b/apps/backend/tests/helpers/fixtures.ts deleted file mode 100644 index db8eca5..0000000 --- a/apps/backend/tests/helpers/fixtures.ts +++ /dev/null @@ -1,203 +0,0 @@ -/** - * Fixtures created through the API (there is no data seed for these): - * staff login -> store -> product + SKU -> future slot - * user login -> address - * - * Everything is left behind afterwards (no cleanup), so names carry a unique - * suffix to keep reruns valid. - */ - -import { apiClient, uniqueSuffix } from './api' -import { staffSession, userSession } from './sessions' - -export interface StoreWithSku { - storeId: number - storeName: string - productId: number - productName: string - skuId: number -} - -export interface CreatedSlot { - slotId: number - deliveryTime: string - freezeTime: string - skuIds: number[] -} - -/** Create a store and a one-SKU product inside it; returns the ids. */ -export async function createStoreWithSku( - options: { price?: number } = {} -): Promise { - const staff = await staffSession() - const admin = apiClient(staff.token) - const suffix = uniqueSuffix() - - const storeName = `API Test Store ${suffix}` - const storeRes = await admin.admin.store.createStore.mutate({ - name: storeName, - description: 'Created by apps/backend/tests', - owner: staff.staffId, - }) - - const storeId = (storeRes as { store?: { id?: number } })?.store?.id - if (!storeId) { - throw new Error( - `[api-tests] admin.store.createStore returned no store id: ${JSON.stringify(storeRes)}` - ) - } - - const price = options.price ?? 199 - const productName = `API Test Product ${suffix}` - await admin.admin.product.createProduct.mutate({ - name: productName, - shortDescription: 'API test product', - productType: 'item', - storeId, - skus: [ - { - name: '1pc', - price, - marketPrice: price + 50, - isOutOfStock: false, - features: [{ featureName: 'quantity', featureValue: '1pc' }], - }, - ], - }) - - // Read the product back by name — the create response shape is not relied on. - const listed = await admin.admin.product.getProducts.query() - const product = listed.products.find((p) => p.name === productName) - const skuId = product?.skus?.[0]?.id - const productId = product?.id - if (!productId || !skuId) { - throw new Error( - `[api-tests] created product "${productName}" not found via admin.product.getProducts` - ) - } - - return { storeId, storeName, productId, productName, skuId } -} - -/** Register a throwaway user (token returned immediately) for isolation tests. */ -export async function registerThrowawayUser(): Promise<{ token: string; userId: number }> { - const suffix = uniqueSuffix() - const mobile = `9${String(Math.floor(Math.random() * 1e9)).padStart(9, '0')}` - - const res = await apiClient().user.auth.register.mutate({ - name: `API Test User ${suffix}`, - email: `api-test-${suffix}@example.com`, - mobile, - password: 'TestPass123', - }) - - const token = res?.data?.token - const userId = res?.data?.user?.id - if (!token || !userId) { - throw new Error( - `[api-tests] user.auth.register returned no token/user id: ${JSON.stringify(res)}` - ) - } - - return { token, userId: Number(userId) } -} - -/** - * Create a delivery slot in the future (the public slots cache only includes - * future, non-full slots) and return its id, resolved through the public list. - */ -export async function createFutureSlot( - skuIds: number[], - options: { deliveryInHours?: number; freezeInHours?: number } = {} -): Promise { - const staff = await staffSession() - const admin = apiClient(staff.token) - - const deliveryTime = new Date( - Date.now() + (options.deliveryInHours ?? 3) * 3600_000 - ).toISOString() - const freezeTime = new Date( - Date.now() + (options.freezeInHours ?? 2) * 3600_000 - ).toISOString() - - await admin.admin.slots.createSlot.mutate({ - deliveryTime, - freezeTime, - isActive: true, - skuIds, - }) - - const listed = await apiClient().user.slots.getSlots.query({ regionId: 1 }) - const slot = listed.slots.find( - (s) => new Date(s.deliveryTime).toISOString() === deliveryTime - ) - if (!slot) { - throw new Error( - `[api-tests] created slot (delivery ${deliveryTime}) was not returned by user.slots.getSlots` - ) - } - - return { slotId: slot.id, deliveryTime, freezeTime, skuIds } -} - -/** Return an address for the supplied user, creating one if they have none. */ -export async function ensureUserAddress(): Promise<{ addressId: number; created: boolean }> { - const user = await userSession() - const client = apiClient(user.token) - - const existing = await client.user.address.getUserAddresses.query() - const first = existing?.data?.[0] - if (first) return { addressId: first.id, created: false } - - const created = await client.user.address.createAddress.mutate({ - regionId: 1, - name: 'API Test Address', - phone: '9999999999', - addressLine1: '1 API Test Street', - city: 'Mahabubnagar', - state: 'Telangana', - isDefault: true, - }) - - const addressId = created?.data?.id - if (!addressId) { - throw new Error( - `[api-tests] user.address.createAddress returned no address id: ${JSON.stringify(created)}` - ) - } - - return { addressId, created: true } -} - -/** - * Register a throwaway user and give it a default address, so suites that need - * an isolated account (coupon scoping, first-order-only, per-user limits) can - * place orders without touching the shared user. - */ -export async function registerUserWithAddress(): Promise<{ - token: string - userId: number - addressId: number -}> { - const { token, userId } = await registerThrowawayUser() - const client = apiClient(token) - - const created = await client.user.address.createAddress.mutate({ - regionId: 1, - name: 'API Test Address', - phone: '9999999999', - addressLine1: '1 API Test Street', - city: 'Mahabubnagar', - state: 'Telangana', - isDefault: true, - }) - - const addressId = created?.data?.id - if (!addressId) { - throw new Error( - `[api-tests] registerUserWithAddress: no address id in ${JSON.stringify(created)}` - ) - } - - return { token, userId, addressId } -} diff --git a/apps/backend/tests/helpers/sessions.ts b/apps/backend/tests/helpers/sessions.ts deleted file mode 100644 index 8e00b1c..0000000 --- a/apps/backend/tests/helpers/sessions.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Staff (admin-ui) and user (app) sessions. - * - * Logs in once per suite and caches the token, so a bad credential fails once - * with a clear message rather than on every request. - */ - -import { apiClient, assertServerUp } from './api' -import { adminCredentials, userCredentials } from './env' - -export interface StaffSession { - token: string - staffId: number - name: string -} - -export interface UserSession { - token: string - userId: number -} - -let staffPromise: Promise | null = null -let userPromise: Promise | null = null - -export function staffSession(): Promise { - staffPromise ??= loginStaff() - return staffPromise -} - -export function userSession(): Promise { - userPromise ??= loginUser() - return userPromise -} - -async function loginStaff(): Promise { - await assertServerUp() - const { name, password } = adminCredentials() - - const res = await apiClient().admin.staffUser.login.mutate({ name, password }) - if (!res?.token || !res?.staff?.id) { - throw new Error('[api-tests] admin.staffUser.login returned no token/staff id') - } - - return { token: res.token, staffId: res.staff.id, name: res.staff.name } -} - -async function loginUser(): Promise { - await assertServerUp() - const { identifier, password } = userCredentials() - - const res = await apiClient().user.auth.login.mutate({ identifier, password }) - const token = res?.data?.token - const userId = res?.data?.user?.id - if (!token || !userId) { - throw new Error('[api-tests] user.auth.login returned no token/user id') - } - - return { token, userId: Number(userId) } -} diff --git a/apps/backend/tests/jest.config.js b/apps/backend/tests/jest.config.js deleted file mode 100644 index 780ec6e..0000000 --- a/apps/backend/tests/jest.config.js +++ /dev/null @@ -1,41 +0,0 @@ -const path = require('path') - -const rootDir = path.resolve(__dirname, '..') - -/** - * Jest project for the backend HTTP/API tests. - * - * These tests talk to a RUNNING backend over HTTP — they do not import server - * runtime code beyond the AppRouter type. Start the server first: - * - * cd apps/backend && bun run dev # wrangler dev on :8787 - * bun run test:api # from apps/backend - * - * Credentials come from tests/.env (see tests/.env.example). - */ -module.exports = { - rootDir, - roots: ['/tests'], - testEnvironment: 'node', - testMatch: ['/tests/**/*.test.ts'], - setupFiles: ['/tests/setup.ts'], - clearMocks: true, - // The suites share one user/session and mutate shared data — run serially. - maxWorkers: 1, - testTimeout: 180000, - transform: { - '^.+\\.tsx?$': ['ts-jest', { tsconfig: '/tests/tsconfig.json' }], - }, - moduleNameMapper: { - '^@/(.*)$': '/$1', - '^@packages/shared$': '/../../packages/shared', - '^@packages/shared/(.*)$': '/../../packages/shared/$1', - '^global-shared$': '/../../packages/shared', - '^global-shared/(.*)$': '/../../packages/shared/$1', - '^shared-types$': '/../shared-types', - '^sqliteService$': '/../../packages/db_helper_sqlite', - '^sqliteService/(.*)$': '/../../packages/db_helper_sqlite/$1', - '^common-ui$': '/../../packages/ui', - '^common-ui/(.*)$': '/../../packages/ui/$1', - }, -} diff --git a/apps/backend/tests/setup.ts b/apps/backend/tests/setup.ts deleted file mode 100644 index d822154..0000000 --- a/apps/backend/tests/setup.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Loads the API test environment (credentials + base URL) before the suites run. - * - * tests/.env is git-ignored. Copy tests/.env.example and fill it in. - */ - -import path from 'path' -import dotenv from 'dotenv' - -dotenv.config({ path: path.resolve(__dirname, '.env') }) diff --git a/apps/backend/tests/tsconfig.json b/apps/backend/tests/tsconfig.json deleted file mode 100644 index 25c2b7e..0000000 --- a/apps/backend/tests/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "noEmit": true, - "isolatedModules": true, - /* Declared here as well as inherited: the app config's typeRoots are written - relative to apps/backend, so a checker that resolves inherited relative paths - against this file (apps/backend/tests) would miss the hoisted @types/jest and - lose the jest globals. These point at the same directories from here. */ - "typeRoots": ["../../../node_modules/@types", "../node_modules/@types"], - "types": ["jest", "node"] - }, - "include": ["./**/*.ts"] -} diff --git a/apps/user-ui/tests/KNOWN-GAPS.md b/apps/user-ui/tests/KNOWN-GAPS.md deleted file mode 100644 index 96dd15c..0000000 --- a/apps/user-ui/tests/KNOWN-GAPS.md +++ /dev/null @@ -1,189 +0,0 @@ -# Known gaps — apps/user-ui - -Each item is a real defect or a missing guarantee that the test suite **pins -today**. The tests stay green on purpose: they document what the code does now -and will fail loudly when the behaviour changes. When you fix one, update the -matching test to assert the correct behaviour and remove it from this list. - -Location of the pinning test is given for each entry. - ---- - -## 1. A 401 does not log the user out - -`src/trpc-client.ts:33` emits `FORCE_LOGOUT_EVENT` on a `401 UNAUTHORIZED` -response, but **nothing in `apps/user-ui` subscribes to it** (only -`apps/admin-ui` does). A session whose token the server has rejected stays -signed in; the next screen the user opens fails again instead of redirecting to -login. - -**Fix:** subscribe to `FORCE_LOGOUT_EVENT` in `AuthProvider` (or the root -layout) and call `logout()`. - -**Pinned by:** `tests/lib/force-logout.test.tsx` — "leaves the signed-in session -untouched (no subscriber for the event)". It asserts the session survives the -401. Rewrite it to assert the redirect once a listener exists. - ---- - -## 2. A rejected token is deleted from memory but not from storage - -`src/contexts/AuthContext.tsx:105` — `deleteAuthToken()` is commented out in the -`selfDataError` branch. The in-memory session is cleared, but the dead token and -user id stay in secure storage and `initializeAuth` re-authenticates with them -on the next cold start. - -**Fix:** uncomment `deleteAuthToken()` (and clear the stored user id). - -**Pinned by:** `tests/contexts/auth-lifecycle.test.tsx` — "clears the session -when getSelfData fails but leaves the stale token in storage". - ---- - -## 3. The delivery threshold is checked after the discount - -`components/cart-page.tsx:270` and `components/checkout-page.tsx:213` both do: - -```ts -return finalTotal < threshold ? charge : 0 // finalTotal is POST-discount -``` - -**Resolved (2026-10-10):** the backend now uses this exact model — discount the -cart subtotal, then `finalTotal < freeDeliveryThreshold` — so the client and the -persisted order agree. Previously the backend waived delivery from the -**pre-discount** total and from a different constant (`minRegularOrderValue` vs -the client's `freeDeliveryThreshold`), which is what produced the mismatch. -`minRegularOrderValue` has been removed entirely. - -Note the post-discount rule is now the single, intended behaviour on both sides: -a coupon that drops the total under the threshold re-adds the delivery fee, so a -small coupon can still make the payable amount rise above the un-couponed total. -That is by design (it matches the cart), not a client/backend divergence. - -**Pinned by:** `tests/screens/cart-coupons.test.tsx` — "re-adds the delivery fee -when the discount drops the total below the threshold" (the same behaviour is -asserted on the checkout side by `tests/screens/checkout-coupons.test.tsx` — -"charges delivery again when the discount drops the total below the threshold"). - ---- - -## 4. Order success shows the frontend's total, not the backend's charge - -`components/PaymentAndOrderComponent.tsx:86` writes -`totalAmount=${finalTotalWithDelivery}` into the success URL, and -`app/(drawer)/(tabs)/home/order-success.tsx` renders `params.totalAmount` -verbatim. The backend stores a different number: it scales the coupon discount -by `orderGroupProportion` for multi-slot orders and the client does not -(`orderGroupProportion` has zero occurrences in `apps/user-ui`). For a multi-slot -group the two disagree. - -**FIXED (amount) 2026-10-11:** `PaymentAndOrderComponent` now sums the -server-returned orders' `totalAmount` and writes that into the success URL, -falling back to `finalTotalWithDelivery` only when the response omits it. The -cart/checkout discount is also computed with the shared `computeCartDiscount` -helper, so the local preview now matches the server for the single-coupon case. - -The screen still shows only `orders[0].id` for a group of orders created by one -`placeOrder` call (not yet addressed). - -**Pinned by:** `tests/screens/order-amounts.test.tsx` — "renders whatever amount -the caller put in the query string"; `tests/components/payment-and-order-money.test.tsx` -— "uses the server-stored order amount for the success URL when present". - ---- - -## 5. Cart lines vanish when the product cache is incomplete - -`hooks/cart-query-hooks.tsx` — `useGetCart` maps a stored line to `null` when its -`skuId` is missing from `productsById` or `productSlotsMap`, then filters it out. -The line disappears from the view while still on disk, so the cart shows fewer -rows than it holds and the user cannot see or remove the hidden items. - -**FIXED (visibility):** the enriched cart is now derived in a `useMemo` over -`query.data + productsById + productSlotsMap`, so lines reappear as soon as the -central stores populate (no manual refresh). Lines whose product is genuinely -absent from the catalog are still hidden — that remainder is intentional. - -**Pinned by:** `tests/hooks/cart-storage.test.tsx` — "drops lines whose product -is missing from the central stores" (asserts the line is still on disk). - ---- - -## 6. `useReconcileCartSlots` deletes cart lines and never repairs them again - -**FIXED.** The reconciler no longer drops a line whose product has no slots — it -keeps the line untouched. It also runs whenever `productSlotsMap` changes (the -once-per-mount `hasRun` ref is gone), so expired slots are repaired on the next -slot refresh, and it bails when the slots map is empty so it can never wipe the -cart. - -**Pinned by:** `tests/hooks/cart-storage.test.tsx` — "keeps a line whose product -has no slots instead of deleting it" and "re-reconciles when the slots map -changes". - ---- - -## 7. Two adds in the same tick lose the first one - -`hooks/cart-query-hooks.tsx:132` — `addToLocalCart` is read-modify-write with no -locking or serialisation. Two `addToCart` calls fired together both read the -pre-add cart and the second write erases the first. - -**Fix:** serialise the writes (a per-cart promise chain, or a reducer). - -**Pinned by:** `tests/hooks/cart-storage.test.tsx` — "loses the first of two -concurrent adds". - ---- - -## 8. A zero quantity is written through to storage - -`hooks/cart-query-hooks.tsx:158` — `updateLocalCartItem` assigns -`item.quantity = quantity` with no lower bound. A 0-qty line stays in storage -and keeps counting as a cart row. The UI always routes deletion through -`removeFromCart`, so this is only reachable from a direct call today. - -**Fix:** clamp to `>= 1`, or treat 0 as a removal. - -**Pinned by:** `tests/hooks/cart-storage.test.tsx` — "persists a zero quantity -with no guard". - ---- - -## 9. Cart totals follow the live catalog price - -Carts store only `skuId`/`quantity`; the price is read from `productsById` at -read time (`hooks/cart-query-hooks.tsx:205`). A repriced product changes the -bill underneath the user with no notice and no stale-price marker. This may be -intended, but it is unpinned business behaviour — worth an explicit decision. - -**Pinned by:** `tests/hooks/cart-storage.test.tsx` — "prices a line from the -live product record, not the price at add time". - ---- - -## 10. `current` store map is rebuilt wholesale on refresh - -`src/store/centralSlotStore.ts` `setSlotsData` builds `productSlotsMap` from -scratch and calls `set`. A product that drops out of `productAvailability` -disappears from the map entirely, and its `isOutOfStock` flag resets to `false` -when its availability row is missing. Everything downstream (cart reconciler, -out-of-stock rules) then treats it as unknown. - -**Pinned by:** `tests/stores/store-staleness.test.ts` — "replaces the map -wholesale on a refresh, dropping vanished products" and "keeps the availability -flags when the same product is refreshed". - ---- - -## Scope notes - -Excluded from this pass on request: online payments (Razorpay -`verifyPayment`/`markPaymentFailed`/`initiateRazorpayPayment`) and the -notifications service (`services/notif-service/`, `services/toaster.tsx`). - -Backend-side gaps found during the same review (coupon math uncapped for -percentage discounts, coupon scoping not enforced at `placeOrder`, coupon usage -not rolled back on cancellation, out-of-stock items orderable, admin writes -reachable with a user token, `user.payment.*` untested) are tracked separately -in the backend review notes and are not covered here. diff --git a/apps/user-ui/tests/__fixtures__/essentialConsts.json b/apps/user-ui/tests/__fixtures__/essentialConsts.json deleted file mode 100644 index fd670a6..0000000 --- a/apps/user-ui/tests/__fixtures__/essentialConsts.json +++ /dev/null @@ -1,27 +0,0 @@ -[ - { - "result": { - "data": { - "freeDeliveryThreshold": 249, - "deliveryCharge": 15, - "flashFreeDeliveryThreshold": 399, - "flashDeliveryCharge": 39, - "popularItems": "40,109,9,75,98,6,24,59", - "versionNum": "1.2.0", - "playStoreUrl": "https://info.freshyo.in/qr-based-download", - "appStoreUrl": "https://info.freshyo.in/qr-based-download", - "webViewHtml": null, - "webviewHtml": null, - "isWebviewClosable": true, - "isFlashDeliveryEnabled": false, - "supportMobile": "9000885620", - "supportEmail": "qushammohd@gmail.com", - "assetsDomain": "https://assets.freshyo.in/", - "apiCacheKey": "api-cache", - "cacheVersion": 755, - "availabilityVersionNum": 72, - "slotsVersionNum": 401 - } - } - } -] diff --git a/apps/user-ui/tests/components/address-form.test.tsx b/apps/user-ui/tests/components/address-form.test.tsx deleted file mode 100644 index 05a1edf..0000000 --- a/apps/user-ui/tests/components/address-form.test.tsx +++ /dev/null @@ -1,171 +0,0 @@ -/** - * AddressForm (src/components/AddressForm.tsx) — create/update + validation. - * - * The City (region) and bound are derived from the attached location, so these - * cases seed the device location via useLocationStore before rendering. - * Coordinates are mandatory: Add Address stays disabled until a location is - * attached. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import AddressForm from '@/src/components/AddressForm' -import { useLocationStore } from '@/src/store/locationStore' -import { useRegionStore } from '@/src/store/regionStore' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { expectProcedureCalled, lastProcedureInput } from '../mocks/procedures' -import { renderWithProviders } from '../helpers/render' - -const LOCATION = { latitude: 16.7488, longitude: 77.9851 } - -/** Pretend the launch fix already produced coordinates (or was denied). */ -function seedLocation(coords: typeof LOCATION | null) { - useLocationStore.setState({ - coords, - status: coords ? 'granted' : 'denied', - error: null, - }) -} - -describe('AddressForm', () => { - beforeEach(async () => { - const Location = require('expo-location') - Location.requestForegroundPermissionsAsync.mockResolvedValue({ - status: 'granted', - granted: true, - }) - Location.hasServicesEnabledAsync.mockResolvedValue(true) - Location.getCurrentPositionAsync.mockResolvedValue({ - coords: { ...LOCATION, accuracy: 5 }, - timestamp: Date.now(), - }) - - await resetStorage() - // zustand stores are module singletons. - useLocationStore.getState().stop() - useRegionStore.setState({ - selectedRegionId: null, - selectedRegion: null, - selectedBoundId: null, - regionGeneration: 0, - }) - }) - - it('renders the add-address form without a service-area notice', () => { - setupApiMocks() - renderWithProviders(, { centralStores: false }) - - expect(screen.getAllByText('Add Address').length).toBeGreaterThan(0) - expect(screen.getByTestId('address-name')).toBeVisible() - expect(screen.queryByText(/currently serve/)).toBeNull() - }) - - it('keeps Add Address disabled until a location is attached', () => { - const Location = require('expo-location') - Location.requestForegroundPermissionsAsync.mockResolvedValue({ - status: 'denied', - granted: false, - }) - useLocationStore.getState().stop() - setupApiMocks() - - renderWithProviders(, { centralStores: false }) - - expect(screen.getByTestId('address-attach-location')).toBeVisible() - expect(screen.getByTestId('address-submit')).toBeDisabled() - - // The hint only appears once the first field has been touched. - fireEvent.changeText(screen.getByTestId('address-name'), 'Home') - fireEvent(screen.getByTestId('address-name'), 'blur') - expect(screen.getByText('Attach a location to add address')).toBeVisible() - }) - - it('shows the device-source heading once a location is attached', async () => { - seedLocation(LOCATION) - setupApiMocks() - renderWithProviders(, { centralStores: false }) - - await waitFor(() => expect(screen.getByText('Current Location Attached')).toBeVisible()) - expect(screen.getByText('Choose Another Location in Map')).toBeVisible() - }) - - it('validates the required fields', async () => { - seedLocation(LOCATION) - setupApiMocks() - renderWithProviders(, { centralStores: false }) - - await waitFor(() => expect(screen.getByTestId('address-submit')).not.toBeDisabled()) - fireEvent.press(screen.getByTestId('address-submit')) - - await waitFor(() => expect(screen.getByText('Name is required')).toBeVisible()) - expect(screen.getByText('Phone is required')).toBeVisible() - expect(screen.getByText('Address Line 1 is required')).toBeVisible() - }) - - it('creates an address with the region and coordinates derived from the location', async () => { - seedLocation(LOCATION) - const api = setupApiMocks({ - procedures: { 'user.address.createAddress': { data: { id: 7 } } }, - }) - renderWithProviders(, { centralStores: false }) - - // The City shows the region resolved from the attached location. - await waitFor(() => expect(screen.getByText('Mahabubnagar')).toBeVisible()) - - fireEvent.changeText(screen.getByTestId('address-name'), 'Home') - fireEvent.changeText(screen.getByTestId('address-phone'), '9876543210') - fireEvent.changeText(screen.getByTestId('address-line1'), '12 Main Road') - fireEvent.press(screen.getByTestId('address-submit')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'user.address.createAddress')) - expect(lastProcedureInput(api.fetchMock, 'user.address.createAddress')).toMatchObject({ - name: 'Home', - phone: '9876543210', - addressLine1: '12 Main Road', - city: 'Mahabubnagar', - regionId: 1, - latitude: LOCATION.latitude, - longitude: LOCATION.longitude, - }) - }) - - it('updates an address in edit mode via user.address.updateAddress', async () => { - const api = setupApiMocks({ - procedures: { 'user.address.updateAddress': { success: true } }, - }) - renderWithProviders( - , - { centralStores: false } - ) - - expect(screen.getByText('Edit Address')).toBeVisible() - await waitFor(() => expect(screen.getByTestId('address-submit')).not.toBeDisabled()) - fireEvent.press(screen.getByTestId('address-submit')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'user.address.updateAddress')) - expect(lastProcedureInput(api.fetchMock, 'user.address.updateAddress')).toMatchObject({ - id: 3, - name: 'Work', - regionId: 1, - }) - }) -}) diff --git a/apps/user-ui/tests/components/address-selectors.test.tsx b/apps/user-ui/tests/components/address-selectors.test.tsx deleted file mode 100644 index d292542..0000000 --- a/apps/user-ui/tests/components/address-selectors.test.tsx +++ /dev/null @@ -1,180 +0,0 @@ -/** - * CheckoutAddressSelector + QuickDeliveryAddressSelector. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import CheckoutAddressSelector from '@/components/CheckoutAddressSelector' -import QuickDeliveryAddressSelector from '@/components/QuickDeliveryAddressSelector' -import { mockSlots, resetStorage, setupApiMocks } from '../mocks/api' -import { authMock, resetAuthMock } from '../mocks/auth' -import { expectProcedureCalled, lastProcedureInput } from '../mocks/procedures' -import { useAddressStore } from '@/src/store/addressStore' -import { renderWithProviders } from '../helpers/render' - -const ADDRESSES = { - data: [ - { - id: 1, - name: 'Home', - phone: '9876543210', - addressLine1: '12 Main Road', - addressLine2: 'Apt 4', - city: 'Hyderabad', - state: 'Telangana', - isDefault: false, - }, - { - id: 2, - name: 'Work', - phone: '9876543211', - addressLine1: '9 Office St', - addressLine2: null, - city: 'Hyderabad', - state: 'Telangana', - isDefault: true, - }, - ], -} - -describe('CheckoutAddressSelector', () => { - beforeEach(async () => { - resetAuthMock() - authMock.user = { id: 1 } - await resetStorage() - }) - - it('lists the addresses and auto-selects the default', async () => { - setupApiMocks({ - procedures: { 'user.address.getUserAddresses': ADDRESSES }, - }) - const onAddressSelect = jest.fn() - renderWithProviders( - , - { centralStores: false } - ) - - await waitFor(() => expect(screen.getByTestId('address-option-0')).toBeVisible()) - expect(screen.getByText('Home')).toBeVisible() - expect(screen.getByText('Work')).toBeVisible() - - // Auto-select uses the default address (id 2). - await waitFor(() => expect(onAddressSelect).toHaveBeenCalledWith(2)) - }) - - it('selects an address on press', async () => { - setupApiMocks({ - procedures: { 'user.address.getUserAddresses': ADDRESSES }, - }) - const onAddressSelect = jest.fn() - renderWithProviders( - , - { centralStores: false } - ) - - await waitFor(() => expect(screen.getByTestId('address-option-0')).toBeVisible()) - // The selected address sorts first, so the second card is the other one. - fireEvent.press(screen.getByTestId('address-option-1')) - - expect(onAddressSelect).toHaveBeenCalledWith(1) - }) - - it('refreshes the addresses after attaching the current location', async () => { - const api = setupApiMocks({ - procedures: { - 'user.address.getUserAddresses': ADDRESSES, - 'user.address.updateAddress': { data: { id: 2 } }, - }, - }) - renderWithProviders( - , - { centralStores: false } - ) - - await waitFor(() => expect(screen.getByText('Work')).toBeVisible()) - expect(expectProcedureCalled(api.fetchMock, 'user.address.getUserAddresses')).toHaveLength(1) - - fireEvent.press(screen.getByText('+ Attach Current Location')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'user.address.updateAddress')) - expect(lastProcedureInput(api.fetchMock, 'user.address.updateAddress')).toMatchObject({ - id: 2, - latitude: 17.385, - longitude: 78.4867, - }) - - // The invalidation has to actually match: a second read of the addresses. - await waitFor(() => - expect( - expectProcedureCalled(api.fetchMock, 'user.address.getUserAddresses').length - ).toBe(2) - ) - }) - - it('shows the empty state', async () => { - setupApiMocks({ - procedures: { 'user.address.getUserAddresses': { data: [] } }, - }) - renderWithProviders( - , - { centralStores: false } - ) - - await waitFor(() => expect(screen.getByText('No addresses found')).toBeVisible()) - expect(screen.getAllByText('Add Address').length).toBeGreaterThan(0) - }) -}) - -describe('QuickDeliveryAddressSelector', () => { - beforeEach(async () => { - resetAuthMock() - authMock.user = { id: 1 } - await resetStorage() - useAddressStore.setState({ selectedAddressId: null }) - }) - - const procedures = { - 'user.address.getDefaultAddress': { data: { id: 2, name: 'Work', addressLine1: '9 Office St' } }, - 'user.address.getUserAddresses': ADDRESSES, - } - - it('shows the earliest slot and changes it from the dialog', async () => { - setupApiMocks({ procedures }) - const onSlotChange = jest.fn() - renderWithProviders( - , - { centralStores: false } - ) - - await waitFor(() => expect(screen.getByText('Delivery Time')).toBeVisible()) - - fireEvent.press(screen.getByText('Delivery Time')) - - await waitFor(() => - expect(screen.getByText('Select Delivery Time')).toBeVisible() - ) - - // Options render an "Orders Close at" line once the slots cache arrives. - await waitFor(() => - expect(screen.getAllByText(/Orders Close at/).length).toBeGreaterThan(1) - ) - fireEvent.press(screen.getAllByText(/Orders Close at/)[1]) - - expect(onSlotChange).toHaveBeenCalled() - }) - - it('shows the flash header variant', async () => { - setupApiMocks({ procedures }) - renderWithProviders( - , - { centralStores: false } - ) - - await waitFor(() => - expect(screen.getByText('Delivery in within 1 hour')).toBeVisible() - ) - }) -}) diff --git a/apps/user-ui/tests/components/cart-address-gate.test.tsx b/apps/user-ui/tests/components/cart-address-gate.test.tsx deleted file mode 100644 index 642406f..0000000 --- a/apps/user-ui/tests/components/cart-address-gate.test.tsx +++ /dev/null @@ -1,62 +0,0 @@ -/** - * CartAddressGate (components/CartAddressGate.tsx). - * - * The cart's first-address gate: shown before the cart when a signed-in user - * has no delivery address. Offers "Address of current Location" (needs a device - * fix) or "Choose another location" (opens the address form). - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import CartAddressGate from '@/components/CartAddressGate' -import { useLocationStore } from '@/src/store/locationStore' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { renderWithProviders } from '../helpers/render' - -const LOCATION = { latitude: 16.7488, longitude: 77.9851 } - -describe('CartAddressGate', () => { - beforeEach(async () => { - await resetStorage() - useLocationStore.getState().stop() - }) - - it('offers the current-location and map options', () => { - useLocationStore.setState({ coords: LOCATION, status: 'granted', error: null }) - setupApiMocks() - - renderWithProviders(, { - centralStores: false, - }) - - expect(screen.getByText('Where should we deliver?')).toBeVisible() - expect(screen.getByTestId('cart-address-current')).toBeEnabled() - expect(screen.getByTestId('cart-address-other')).toBeVisible() - }) - - it('disables the current-location option without a device fix', () => { - setupApiMocks() - - renderWithProviders(, { - centralStores: false, - }) - - expect(screen.getByTestId('cart-address-current')).toBeDisabled() - expect(screen.getByText('Turn on location to use this option')).toBeVisible() - }) - - it('opens the address form from the map option', async () => { - setupApiMocks() - - renderWithProviders(, { - centralStores: false, - }) - - fireEvent.press(screen.getByTestId('cart-address-other')) - - await waitFor(() => expect(screen.getByTestId('address-name')).toBeVisible()) - }) -}) diff --git a/apps/user-ui/tests/components/complaint-form.test.tsx b/apps/user-ui/tests/components/complaint-form.test.tsx deleted file mode 100644 index b899f4d..0000000 --- a/apps/user-ui/tests/components/complaint-form.test.tsx +++ /dev/null @@ -1,74 +0,0 @@ -/** - * ComplaintForm (components/ComplaintForm.tsx): submit asserts - * user.complaint.raise; empty body is rejected locally. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import ComplaintForm from '@/components/ComplaintForm' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { expectProcedureCalled, lastProcedureInput } from '../mocks/procedures' -import { renderWithProviders } from '../helpers/render' - -const ORDER_ID = 42 - -describe('ComplaintForm', () => { - beforeEach(async () => { - await resetStorage() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('renders nothing when closed', () => { - setupApiMocks() - const { toJSON } = renderWithProviders( - {}} orderId={ORDER_ID} />, - { centralStores: false } - ) - - expect(toJSON()).toBeNull() - }) - - it('rejects an empty complaint without calling the API', async () => { - const api = setupApiMocks({ procedures: { 'user.complaint.raise': { success: true } } }) - renderWithProviders( - {}} orderId={ORDER_ID} />, - { centralStores: false } - ) - - fireEvent.press(screen.getByText('Submit Complaint')) - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith('Error', 'Please enter complaint details') - ) - expect( - api.fetchMock.mock.calls.some(([url]) => String(url).includes('complaint.raise')) - ).toBe(false) - }) - - it('raises a complaint with the typed body and closes', async () => { - const api = setupApiMocks({ procedures: { 'user.complaint.raise': { success: true } } }) - const onClose = jest.fn() - renderWithProviders( - , - { centralStores: false } - ) - - fireEvent.changeText( - screen.getByPlaceholderText('Tell us what went wrong...'), - 'Item was spoiled' - ) - fireEvent.press(screen.getByText('Submit Complaint')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'user.complaint.raise')) - expect(lastProcedureInput(api.fetchMock, 'user.complaint.raise')).toEqual({ - orderId: String(ORDER_ID), - complaintBody: 'Item was spoiled', - imageUrls: [], - }) - await waitFor(() => expect(onClose).toHaveBeenCalled()) - }) -}) diff --git a/apps/user-ui/tests/components/icons.test.tsx b/apps/user-ui/tests/components/icons.test.tsx deleted file mode 100644 index 3c30c59..0000000 --- a/apps/user-ui/tests/components/icons.test.tsx +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Tab bar icons (components/icons/*). - */ - -import React from 'react' -import { render } from '@testing-library/react-native' - -import CartIcon from '@/components/icons/CartIcon' -import HomeIcon from '@/components/icons/HomeIcon' -import MeIcon from '@/components/icons/MeIcon' -import OffersIcon from '@/components/icons/OffersIcon' -import StoresIcon from '@/components/icons/StoresIcon' - -const icons = [ - ['HomeIcon', HomeIcon], - ['CartIcon', CartIcon], - ['StoresIcon', StoresIcon], - ['OffersIcon', OffersIcon], - ['MeIcon', MeIcon], -] as const - -describe('tab icons', () => { - it.each(icons)('%s renders focused and unfocused', (_name, Icon) => { - expect(render().toJSON()).not.toBeNull() - expect(render().toJSON()).not.toBeNull() - }) -}) diff --git a/apps/user-ui/tests/components/location-attacher.test.tsx b/apps/user-ui/tests/components/location-attacher.test.tsx deleted file mode 100644 index e68a691..0000000 --- a/apps/user-ui/tests/components/location-attacher.test.tsx +++ /dev/null @@ -1,64 +0,0 @@ -/** - * LocationAttacher (src/components/LocationAttacher.tsx). - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import * as Location from 'expo-location' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import { LocationAttacher } from '@/src/components/LocationAttacher' -import { renderWithProviders } from '../helpers/render' - -describe('LocationAttacher', () => { - it('attaches the current location on success', async () => { - const onLocationChange = jest.fn() - renderWithProviders(, { - centralStores: false, - }) - - fireEvent.press(screen.getByText('Attach Current Location')) - - await waitFor(() => - expect(onLocationChange).toHaveBeenCalledWith({ - latitude: 17.385, - longitude: 78.4867, - }) - ) - expect(screen.getByText('✓ Location Attached')).toBeVisible() - }) - - it('shows an error when permission is denied', async () => { - ;(Location.requestForegroundPermissionsAsync as jest.Mock).mockResolvedValueOnce({ - status: 'denied', - granted: false, - }) - const onLocationChange = jest.fn() - - renderWithProviders(, { - centralStores: false, - }) - fireEvent.press(screen.getByText('Attach Current Location')) - - await waitFor(() => - expect(screen.getByText('Location Permission denied')).toBeVisible() - ) - expect(onLocationChange).not.toHaveBeenCalled() - }) - - it('does nothing while disabled', () => { - const onLocationChange = jest.fn() - renderWithProviders( - , - { centralStores: false } - ) - - fireEvent.press(screen.getByText('Attach Current Location')) - - expect( - (Location.requestForegroundPermissionsAsync as jest.Mock).mock.calls.length - ).toBe(0) - expect(onLocationChange).not.toHaveBeenCalled() - }) -}) diff --git a/apps/user-ui/tests/components/location-wrapper.test.tsx b/apps/user-ui/tests/components/location-wrapper.test.tsx deleted file mode 100644 index 751aa6c..0000000 --- a/apps/user-ui/tests/components/location-wrapper.test.tsx +++ /dev/null @@ -1,85 +0,0 @@ -/** - * LocationTestWrapper (components/LocationTestWrapper.tsx). - * - * It is the region gate: once a region is selected it is a passthrough, - * otherwise it derives the region from the location/default address and falls - * back to the address chooser with a notice explaining why. - */ - -import React from 'react' -import { Text } from 'react-native' -import { screen, waitFor } from '@testing-library/react-native' - -import LocationTestWrapper from '@/components/LocationTestWrapper' -import { useLocationStore } from '@/src/store/locationStore' -import { useRegionStore } from '@/src/store/regionStore' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { renderWithProviders } from '../helpers/render' - -function renderGate() { - return renderWithProviders( - - app content - , - { centralStores: false } - ) -} - -describe('LocationTestWrapper', () => { - beforeEach(async () => { - const Location = require('expo-location') - Location.requestForegroundPermissionsAsync.mockResolvedValue({ - status: 'granted', - granted: true, - }) - Location.hasServicesEnabledAsync.mockResolvedValue(true) - Location.getCurrentPositionAsync.mockResolvedValue({ - coords: { latitude: 17.385, longitude: 78.4867, accuracy: 5 }, - timestamp: Date.now(), - }) - - await resetStorage() - useLocationStore.getState().stop() - useRegionStore.setState({ - selectedRegionId: null, - selectedRegion: null, - selectedBoundId: null, - regionGeneration: 0, - }) - }) - - it('renders its children once a region is selected', async () => { - setupApiMocks() - - useRegionStore - .getState() - .setRegion({ id: 1, name: 'Test Region', description: null }) - - renderGate() - - expect(screen.getByText('app content')).toBeVisible() - }) - - it('shows a spinner while the region is still resolving', () => { - setupApiMocks() - - renderGate() - - expect(screen.getByText('Finding your region...')).toBeVisible() - }) - - it('asks for an address with a location notice when the location is denied', async () => { - const Location = require('expo-location') - Location.requestForegroundPermissionsAsync.mockResolvedValue({ - status: 'denied', - granted: false, - }) - setupApiMocks() - - renderGate() - - await waitFor(() => expect(screen.getByText('Delivery Address')).toBeVisible()) - expect(screen.getByText(/Location access is not granted/)).toBeVisible() - expect(screen.getByTestId('open-location-settings')).toBeVisible() - }) -}) diff --git a/apps/user-ui/tests/components/notif-region-sync.test.tsx b/apps/user-ui/tests/components/notif-region-sync.test.tsx deleted file mode 100644 index 49f5da0..0000000 --- a/apps/user-ui/tests/components/notif-region-sync.test.tsx +++ /dev/null @@ -1,98 +0,0 @@ -/** - * NotifRegionSync — carries the browsing region with the push token and records a - * location-derived user<->region association. - * - * The notification context and useRegion are mocked so the test drives the - * token/region directly; the tRPC layer is real against the fetch stub, so the - * outbound mutation input is asserted. - */ - -import React from 'react' -import { waitFor } from '@testing-library/react-native' - -import NotifRegionSync from '@/src/components/NotifRegionSync' -import { useRegion } from '@/src/hooks/useRegion' -import { setupApiMocks } from '../mocks/api' -import { lastProcedureInput, procedureCalls } from '../mocks/procedures' -import { renderWithProviders } from '../helpers/render' - -jest.mock('@/services/notif-service/notif-context', () => ({ - useNotification: () => ({ - expoPushToken: 'ExponentPushToken[test]', - notifPermission: 'granted', - notification: null, - error: null, - }), -})) - -jest.mock('@/src/hooks/useRegion', () => ({ useRegion: jest.fn() })) - -const mockedUseRegion = useRegion as unknown as jest.Mock - -const regionValue = (over: Record = {}) => ({ - region: null, - regionId: 1, - boundId: null, - bound: null, - regionGeneration: 0, - hydrated: true, - coords: null, - locationStatus: 'idle', - isResolvingRegion: false, - setRegion: jest.fn(), - clearRegion: jest.fn(), - refreshLocation: jest.fn(), - ...over, -}) - -const procedures = { - 'user.user.savePushToken': { success: true }, - 'user.user.recordTrackedRegion': { success: true }, -} - -const renderSync = () => - renderWithProviders(, { centralStores: false }) - -describe('NotifRegionSync', () => { - it('sends the region with the push token, without a tracked-region call for an address-derived region', async () => { - mockedUseRegion.mockReturnValue(regionValue({ regionId: 1, bound: null })) - const api = setupApiMocks({ procedures }) - - renderSync() - - await waitFor(() => - expect(lastProcedureInput(api.fetchMock, 'user.user.savePushToken')).toEqual({ - token: 'ExponentPushToken[test]', - regionId: 1, - }) - ) - expect(procedureCalls(api.fetchMock, 'user.user.recordTrackedRegion')).toHaveLength(0) - }) - - it('records a tracked region when the region came from the device fix', async () => { - mockedUseRegion.mockReturnValue(regionValue({ regionId: 3, bound: { id: 9 } })) - const api = setupApiMocks({ procedures }) - - renderSync() - - await waitFor(() => - expect(lastProcedureInput(api.fetchMock, 'user.user.recordTrackedRegion')).toEqual({ - regionId: 3, - }) - ) - expect(lastProcedureInput(api.fetchMock, 'user.user.savePushToken')).toEqual({ - token: 'ExponentPushToken[test]', - regionId: 3, - }) - }) - - it('does nothing until a region is known', () => { - mockedUseRegion.mockReturnValue(regionValue({ regionId: null })) - const api = setupApiMocks({ procedures }) - - renderSync() - - expect(procedureCalls(api.fetchMock, 'user.user.savePushToken')).toHaveLength(0) - expect(procedureCalls(api.fetchMock, 'user.user.recordTrackedRegion')).toHaveLength(0) - }) -}) diff --git a/apps/user-ui/tests/components/order-menu.test.tsx b/apps/user-ui/tests/components/order-menu.test.tsx deleted file mode 100644 index 3f23157..0000000 --- a/apps/user-ui/tests/components/order-menu.test.tsx +++ /dev/null @@ -1,123 +0,0 @@ -/** - * OrderMenu (components/OrderMenu.tsx): order actions sheet. - * Buttons assert the tRPC mutation (user.order.cancelOrder / updateUserNotes). - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' -import { MyTouchableOpacity } from 'common-ui' - -import OrderMenu from '@/components/OrderMenu' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { expectProcedureCalled, lastProcedureInput } from '../mocks/procedures' -import { routerMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const ORDER_ID = 42 - -const setup = (procedures: Record = {}) => - setupApiMocks({ - procedures: { - 'user.order.cancelOrder': { success: true }, - 'user.order.updateUserNotes': { success: true }, - ...procedures, - }, - }) - -const openMenu = () => { - fireEvent.press(screen.UNSAFE_getAllByType(MyTouchableOpacity)[0]) -} - -describe('OrderMenu', () => { - beforeEach(async () => { - await resetStorage() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('navigates to the order details', async () => { - setup() - renderWithProviders(, { centralStores: false }) - - openMenu() - fireEvent.press(screen.getByText('View Details')) - - expect(routerMock.push).toHaveBeenCalledWith( - `/(drawer)/(tabs)/me/my-orders/${ORDER_ID}` - ) - }) - - it('saves edited instructions via user.order.updateUserNotes', async () => { - const api = setup() - const postAction = jest.fn() - renderWithProviders(, { - centralStores: false, - }) - - openMenu() - fireEvent.press(screen.getByText('Edit Notes')) - await act(async () => { - jest.advanceTimersByTime(400) - }) - - const input = screen.getByPlaceholderText('Add special delivery instructions here...') - fireEvent.changeText(input, 'Leave at the door') - fireEvent.press(screen.getByText('Save Instructions')) - - await waitFor(() => - expectProcedureCalled(api.fetchMock, 'user.order.updateUserNotes') - ) - expect(lastProcedureInput(api.fetchMock, 'user.order.updateUserNotes')).toEqual({ - id: ORDER_ID, - userNotes: 'Leave at the door', - }) - }) - - it('requires a reason before cancelling', async () => { - const api = setup() - renderWithProviders(, { centralStores: false }) - - openMenu() - fireEvent.press(screen.getByText('Cancel Order')) - await act(async () => { - jest.advanceTimersByTime(400) - }) - - fireEvent.press(screen.getByText('Confirm Cancellation')) - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith( - 'Error', - 'Please enter a reason for cancellation' - ) - ) - expect( - api.fetchMock.mock.calls.some(([url]) => String(url).includes('cancelOrder')) - ).toBe(false) - }) - - it('cancels the order with a reason via user.order.cancelOrder', async () => { - const api = setup() - renderWithProviders(, { centralStores: false }) - - openMenu() - fireEvent.press(screen.getByText('Cancel Order')) - await act(async () => { - jest.advanceTimersByTime(400) - }) - - fireEvent.changeText( - screen.getByPlaceholderText('Please tell us why you are cancelling...'), - 'Ordered by mistake' - ) - fireEvent.press(screen.getByText('Confirm Cancellation')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'user.order.cancelOrder')) - expect(lastProcedureInput(api.fetchMock, 'user.order.cancelOrder')).toEqual({ - id: ORDER_ID, - reason: 'Ordered by mistake', - }) - }) -}) diff --git a/apps/user-ui/tests/components/payment-and-order-money.test.tsx b/apps/user-ui/tests/components/payment-and-order-money.test.tsx deleted file mode 100644 index a039070..0000000 --- a/apps/user-ui/tests/components/payment-and-order-money.test.tsx +++ /dev/null @@ -1,234 +0,0 @@ -/** - * PaymentAndOrderComponent — the bill rows and the placeOrder payload. - * - * Extends tests/components/payment-and-order.test.tsx with the parts that carry - * money: the discount row, the coupon and flash fields of the mutation, the - * COD-only payment method and the out-of-stock gating. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' -import { StorageServiceCasual } from 'common-ui/src/services/StorageServiceCasual' - -import PaymentAndOrderComponent from '@/components/PaymentAndOrderComponent' -import { useCentralProductStore } from '@/src/store/centralProductStore' -import { useCentralSlotStore } from '@/src/store/centralSlotStore' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { lastProcedureInput, expectProcedureCalled } from '../mocks/procedures' -import { routerMock } from '../mocks/router' -import { Providers, renderWithProviders } from '../helpers/render' - -const PLACE_ORDER_OK = { data: [{ id: 99 }] } - -const baseProps = { - selectedAddress: 1, - selectedSlots: { 1: 1849 }, - selectedCouponIds: [], - cartItems: [{ id: 1, skuId: 2, quantity: 1, slotId: 1849 }], - totalPrice: 215, - totalSavings: 0, - discountAmount: 0, - finalTotal: 215, - finalTotalWithDelivery: 230, - deliveryCharge: 15, - constsData: { freeDeliveryThreshold: 249, deliveryCharge: 15 }, - selectedCoupons: [], -} - -const readCart = async (key: string) => { - const raw = await StorageServiceCasual.getItem(key) - return raw ? JSON.parse(raw) : [] -} - -describe('PaymentAndOrderComponent money', () => { - beforeEach(async () => { - await resetStorage() - useCentralProductStore.setState({ products: [], productsById: {} }) - useCentralSlotStore.setState({ slots: [], productSlotsMap: {}, isSlotsLoaded: false }) - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('renders the Product Discount row only when there is a discount', () => { - setupApiMocks({ procedures: { 'user.order.placeOrder': PLACE_ORDER_OK } }) - - const first = renderWithProviders(, { - centralStores: false, - }) - expect(screen.queryByText('Product Discount')).toBeNull() - first.unmount() - - renderWithProviders( - , - { centralStores: false } - ) - - expect(screen.getByText('Product Discount')).toBeVisible() - expect(screen.getByText('-₹20')).toBeVisible() - }) - - it('renders the savings banner from the discount and the waived fee', () => { - setupApiMocks({ procedures: { 'user.order.placeOrder': PLACE_ORDER_OK } }) - - renderWithProviders( - , - { centralStores: false } - ) - - // 20 discount + 5 savings + 15 waived fee = 40. - expect(screen.getByText('You saved ₹40 on this order')).toBeVisible() - }) - - it('offers more spending when the order is under the free-delivery threshold', () => { - setupApiMocks({ procedures: { 'user.order.placeOrder': PLACE_ORDER_OK } }) - - renderWithProviders(, { - centralStores: false, - }) - - // 249 - 215 = 34 more for free delivery. - expect(screen.getByText('Add products worth ₹34 for free delivery')).toBeVisible() - }) - - it('keeps Pay Online disabled so only Cash on Delivery can be chosen', () => { - setupApiMocks({ procedures: { 'user.order.placeOrder': PLACE_ORDER_OK } }) - - renderWithProviders(, { - centralStores: false, - }) - - const online = screen.getByText('Pay Online (Coming Soon)') - expect(online).toBeVisible() - // The online row is wrapped in a disabled touchable. - expect(screen.getByText('Cash on Delivery')).toBeVisible() - }) - - it('sends the coupon id and the flash flag with the order', async () => { - const api = setupApiMocks({ - procedures: { 'user.order.placeOrder': PLACE_ORDER_OK }, - }) - - renderWithProviders( - , - { centralStores: false } - ) - - fireEvent.press(screen.getByTestId('place-order-button')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'user.order.placeOrder')) - const input = lastProcedureInput(api.fetchMock, 'user.order.placeOrder') as Record - expect(input.couponIds).toEqual([77]) - expect(input.isFlashDelivery).toBe(false) - }) - - it('uses the server-stored order amount for the success URL when present', async () => { - const api = setupApiMocks({ - procedures: { - 'user.order.placeOrder': { data: [{ id: 99, totalAmount: '400' }] }, - }, - }) - - renderWithProviders(, { centralStores: false }) - - fireEvent.press(screen.getByTestId('place-order-button')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'user.order.placeOrder')) - // baseProps.finalTotalWithDelivery is 230; the server total (400) wins. - await waitFor(() => - expect(routerMock.replace).toHaveBeenCalledWith( - './order-success?orderId=99&totalAmount=400' - ) - ) - }) - - it('places a flash order with null slots and clears the flash cart only', async () => { - const api = setupApiMocks({ - procedures: { 'user.order.placeOrder': PLACE_ORDER_OK }, - }) - await StorageServiceCasual.setItem( - 'cart_items', - JSON.stringify([{ id: 1, skuId: 2, quantity: 1, slotId: 1849, addedAt: '' }]) - ) - await StorageServiceCasual.setItem( - 'flash_cart_items', - JSON.stringify([{ id: 1, skuId: 2, quantity: 1, slotId: 0, addedAt: '' }]) - ) - - // flashEligibleProductIds is derived from the central stores. - useCentralProductStore.setState({ - products: [{ id: 2, name: 'Chicken Breast 500 g', price: 215 }] as never, - productsById: { 2: { id: 2, name: 'Chicken Breast 500 g', price: 215 } } as never, - }) - useCentralSlotStore.setState({ - slots: [], - isSlotsLoaded: true, - productSlotsMap: { - 2: { slots: [], isOutOfStock: false, isFlashAvailable: true, isSuspended: false }, - } as never, - }) - - renderWithProviders( - , - { centralStores: false } - ) - - fireEvent.press(screen.getByTestId('place-order-button')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'user.order.placeOrder')) - const input = lastProcedureInput(api.fetchMock, 'user.order.placeOrder') as Record - expect(input.isFlashDelivery).toBe(true) - expect(input.selectedItems).toEqual([{ skuId: 2, quantity: 1, slotId: null }]) - - await waitFor(() => - expect(routerMock.replace).toHaveBeenCalledWith( - expect.stringContaining('/flash-delivery/order-success') - ) - ) - await waitFor(async () => expect(await readCart('flash_cart_items')).toHaveLength(0)) - // The scheduled cart is untouched by a flash order. - expect(await readCart('cart_items')).toHaveLength(1) - }) - - it('refuses to order when every line is out of stock', async () => { - useCentralSlotStore.setState({ - slots: [], - isSlotsLoaded: true, - productSlotsMap: { - 2: { slots: [], isOutOfStock: true, isFlashAvailable: true, isSuspended: false }, - } as never, - }) - setupApiMocks({ procedures: { 'user.order.placeOrder': PLACE_ORDER_OK } }) - - renderWithProviders(, { - centralStores: false, - }) - - fireEvent.press(screen.getByTestId('place-order-button')) - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith('Error', 'No valid items to order') - ) - expect(routerMock.replace).not.toHaveBeenCalled() - }) -}) diff --git a/apps/user-ui/tests/components/payment-and-order.test.tsx b/apps/user-ui/tests/components/payment-and-order.test.tsx deleted file mode 100644 index 6daba6c..0000000 --- a/apps/user-ui/tests/components/payment-and-order.test.tsx +++ /dev/null @@ -1,194 +0,0 @@ -/** - * PaymentAndOrderComponent — bill, address gating and placing the order. - * Asserts user.order.placeOrder, cart clearing and the success redirect. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' -import { StorageServiceCasual } from 'common-ui/src/services/StorageServiceCasual' - -import PaymentAndOrderComponent from '@/components/PaymentAndOrderComponent' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { expectProcedureCalled, lastProcedureInput } from '../mocks/procedures' -import { routerMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const baseProps = { - selectedAddress: 1, - selectedSlots: { 1: 1849 }, - selectedCouponIds: [], - cartItems: [{ id: 1, skuId: 2, quantity: 1, slotId: 1849 }], - totalPrice: 215, - totalSavings: 0, - discountAmount: 0, - finalTotal: 215, - finalTotalWithDelivery: 230, - deliveryCharge: 15, - constsData: { freeDeliveryThreshold: 249, deliveryCharge: 15 }, - selectedCoupons: [], -} - -const PLACE_ORDER_OK = { data: [{ id: 99 }] } - -const readCart = async (key: string) => { - const raw = await StorageServiceCasual.getItem(key) - return raw ? JSON.parse(raw) : [] -} - -describe('PaymentAndOrderComponent', () => { - beforeEach(async () => { - await resetStorage() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('renders the bill and an enabled Place Order button', () => { - setupApiMocks({ procedures: { 'user.order.placeOrder': PLACE_ORDER_OK } }) - renderWithProviders(, { - centralStores: false, - }) - - expect(screen.getByText('Bill Details')).toBeVisible() - expect(screen.getByText('To Pay')).toBeVisible() - expect(screen.getByText('₹230')).toBeVisible() - expect(screen.getByTestId('place-order-button')).toBeEnabled() - }) - - it('blocks ordering without an address', () => { - setupApiMocks() - renderWithProviders( - , - { centralStores: false } - ) - - expect(screen.getByTestId('select-address-error')).toBeVisible() - expect(screen.getByTestId('place-order-button')).toBeDisabled() - }) - - it('places a COD order and redirects to order success, clearing the cart', async () => { - const api = setupApiMocks({ - procedures: { 'user.order.placeOrder': PLACE_ORDER_OK }, - }) - await StorageServiceCasual.setItem( - 'cart_items', - JSON.stringify([{ id: 1, skuId: 2, quantity: 1, slotId: 1849, addedAt: '' }]) - ) - - renderWithProviders(, { - centralStores: false, - }) - - fireEvent.press(screen.getByTestId('place-order-button')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'user.order.placeOrder')) - expect(lastProcedureInput(api.fetchMock, 'user.order.placeOrder')).toEqual({ - selectedItems: [{ skuId: 2, quantity: 1, slotId: 1849 }], - addressId: 1, - couponIds: undefined, - userNotes: '', - isFlashDelivery: false, - }) - - await waitFor(() => - expect(routerMock.replace).toHaveBeenCalledWith( - './order-success?orderId=99&totalAmount=230' - ) - ) - await waitFor(async () => expect(await readCart('cart_items')).toHaveLength(0)) - }) - - it('renders the product discount and the savings banner when a coupon is applied', () => { - setupApiMocks() - renderWithProviders( - , - { centralStores: false } - ) - - expect(screen.getByText('Product Discount')).toBeVisible() - expect(screen.getByText('-₹43')).toBeVisible() - expect(screen.getByText('₹387')).toBeVisible() - // 43 discount + the 15 delivery fee the discount earned back. - expect(screen.getByText('You saved ₹58 on this order')).toBeVisible() - }) - - it('sends the selected coupon id with the order', async () => { - const api = setupApiMocks({ - procedures: { 'user.order.placeOrder': PLACE_ORDER_OK }, - }) - - renderWithProviders( - , - { centralStores: false } - ) - - fireEvent.press(screen.getByTestId('place-order-button')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'user.order.placeOrder')) - expect(lastProcedureInput(api.fetchMock, 'user.order.placeOrder')).toMatchObject({ - couponIds: [77], - }) - }) - - it('shows an error when placing the order fails', async () => { - setupApiMocks({ - procedures: { - 'user.order.placeOrder': () => { - throw new Error('order failed') - }, - }, - }) - renderWithProviders(, { - centralStores: false, - }) - - fireEvent.press(screen.getByTestId('place-order-button')) - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith('Error', expect.any(String)) - ) - }) - - it('ignores a second press while the order is in flight', async () => { - let resolveOrder: (value: unknown) => void = () => {} - const api = setupApiMocks({ - procedures: { - 'user.order.placeOrder': () => - new Promise((resolve) => { - resolveOrder = resolve - }), - }, - }) - - renderWithProviders(, { - centralStores: false, - }) - - const button = screen.getByTestId('place-order-button') - fireEvent.press(button) - fireEvent.press(button) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'user.order.placeOrder')) - // The double-tap must not submit twice. - expectProcedureCalled(api.fetchMock, 'user.order.placeOrder', { times: 1 }) - - resolveOrder(PLACE_ORDER_OK) - }) -}) diff --git a/apps/user-ui/tests/components/product-card.test.tsx b/apps/user-ui/tests/components/product-card.test.tsx deleted file mode 100644 index 1ca8858..0000000 --- a/apps/user-ui/tests/components/product-card.test.tsx +++ /dev/null @@ -1,131 +0,0 @@ -/** - * ProductCard (components/ProductCard.tsx) — component-level branches. - * Seeds the central stores directly so each branch is driven deterministically. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Image } from 'react-native' -import { fireEvent, screen } from '@testing-library/react-native' -import dayjs from 'dayjs' - -import ProductCard from '@/components/ProductCard' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { useCartStore } from '@/src/store/cartStore' -import { useCentralProductStore } from '@/src/store/centralProductStore' -import { useCentralSlotStore } from '@/src/store/centralSlotStore' -import { renderWithProviders } from '../helpers/render' - -const futureSlot = { - id: 1849, - deliveryTime: dayjs().add(3, 'hour').toISOString(), - freezeTime: dayjs().add(2, 'hour').toISOString(), -} - -const product = (over: Record = {}) => ({ - id: 2, - name: 'Chicken Breast 500 g', - price: 215, - marketPrice: 220, - flashPrice: null, - images: ['https://assets.freshyo.in/p/2.png'], - incrementStep: 1, - productQuantity: 1, - unitNotation: '0.5Kg', - productType: 'item', - storeId: 1, - ...over, -}) - -const seedStores = (opts: { isOutOfStock?: boolean } = {}) => { - useCentralProductStore.setState({ - products: [], - productsById: { 2: product() } as never, - }) - useCentralSlotStore.setState({ - slots: [futureSlot] as never, - productSlotsMap: { - 2: { - slots: [futureSlot], - isOutOfStock: opts.isOutOfStock ?? false, - isFlashAvailable: false, - isSuspended: false, - }, - } as never, - }) -} - -describe('ProductCard', () => { - beforeEach(async () => { - await resetStorage() - setupApiMocks() - useCartStore.getState().clearAddedToCartProduct() - }) - - it('renders the name, price, struck market price and unit', () => { - seedStores() - renderWithProviders( - , - { centralStores: false } - ) - - expect(screen.getByText('Chicken Breast 500 g')).toBeVisible() - expect(screen.getByText('₹215')).toBeVisible() - expect(screen.getByText('₹220')).toBeVisible() - expect(screen.getByText('0.5Kg')).toBeVisible() - }) - - it('shows the out-of-stock overlay when unavailable', () => { - seedStores({ isOutOfStock: true }) - renderWithProviders( - , - { centralStores: false } - ) - - expect(screen.getByTestId('out-of-stock-badge')).toBeVisible() - }) - - it('queues the product when the add icon is pressed (dialog mode)', () => { - seedStores() - renderWithProviders( - , - { centralStores: false } - ) - - fireEvent.press(screen.getByTestId('add-to-cart-icon')) - - expect(useCartStore.getState().addedToCartProduct).toMatchObject({ productId: 2 }) - }) - - it('shows the image-error fallback', () => { - seedStores() - renderWithProviders( - , - { centralStores: false } - ) - - fireEvent(screen.UNSAFE_getAllByType(Image)[0], 'error') - - expect(screen.getByText('Image failed to load')).toBeVisible() - }) - - it('calls onPress when the card is tapped', () => { - seedStores() - const onPress = jest.fn() - renderWithProviders( - , - { centralStores: false } - ) - - fireEvent.press(screen.getByTestId('product-card')) - - expect(onPress).toHaveBeenCalled() - }) -}) diff --git a/apps/user-ui/tests/components/product-detail.test.tsx b/apps/user-ui/tests/components/product-detail.test.tsx deleted file mode 100644 index 4fb02ac..0000000 --- a/apps/user-ui/tests/components/product-detail.test.tsx +++ /dev/null @@ -1,109 +0,0 @@ -/** - * ProductDetail (components/ProductDetail.tsx) — the four routes render it. - * Covers loading, loaded, error and the add-to-cart entry point. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import ProductDetail from '@/components/ProductDetail' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { expectProcedureCalled, lastProcedureInput } from '../mocks/procedures' -import { useCartStore } from '@/src/store/cartStore' -import { renderWithProviders } from '../helpers/render' - -const DETAIL = { - id: 2, - productId: 2, - name: 'Chicken Breast 500 g', - shortDescription: 'Farm Chicken Breast uncut and solid.', - price: 215, - marketPrice: 220, - flashPrice: 199, - images: ['https://assets.freshyo.in/p/2.png'], - unitNotation: '0.5Kg', - unit: '0.5Kg', - productType: 'item', - incrementStep: 1, -} - -const REVIEWS = { reviews: [], hasMore: false } - -describe('ProductDetail', () => { - beforeEach(async () => { - await resetStorage() - useCartStore.getState().clearAddedToCartProduct() - }) - - it('shows the loading state', async () => { - setupApiMocks({ - procedures: { - 'user.product.getProductDetails': () => new Promise(() => {}), - 'user.product.getProductReviews': REVIEWS, - }, - }) - renderWithProviders() - - await waitFor(() => - expect(screen.getByText('Loading product details...')).toBeVisible() - ) - }) - - it('renders the product and loads its reviews', async () => { - const api = setupApiMocks({ - procedures: { - 'user.product.getProductDetails': DETAIL, - 'user.product.getProductReviews': REVIEWS, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Chicken Breast 500 g')).toBeVisible()) - expect(screen.getByText('₹215')).toBeVisible() - // The flash badge comes from the central productSlotsMap, loaded separately. - await waitFor(() => expect(screen.getByText('1 Hr Delivery')).toBeVisible()) - - await waitFor(() => - expectProcedureCalled(api.fetchMock, 'user.product.getProductReviews') - ) - expect(lastProcedureInput(api.fetchMock, 'user.product.getProductDetails')).toEqual({ - id: '2', - regionId: 1, - }) - }) - - it('shows the error state when the product fails to load', async () => { - setupApiMocks({ - procedures: { - 'user.product.getProductDetails': () => { - throw new Error('not found') - }, - 'user.product.getProductReviews': REVIEWS, - }, - }) - renderWithProviders() - - await waitFor(() => - expect(screen.getByText('Product not found or error loading')).toBeVisible() - ) - expect(screen.getByText('Oops!')).toBeVisible() - }) - - it('queues the add-to-cart dialog from the Add to Cart button', async () => { - setupApiMocks({ - procedures: { - 'user.product.getProductDetails': DETAIL, - 'user.product.getProductReviews': REVIEWS, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Chicken Breast 500 g')).toBeVisible()) - - fireEvent.press(screen.getByText('Add to Cart')) - - expect(useCartStore.getState().addedToCartProduct).toMatchObject({ productId: 2 }) - }) -}) diff --git a/apps/user-ui/tests/components/registration-form.test.tsx b/apps/user-ui/tests/components/registration-form.test.tsx deleted file mode 100644 index a65c9df..0000000 --- a/apps/user-ui/tests/components/registration-form.test.tsx +++ /dev/null @@ -1,119 +0,0 @@ -/** - * RegistrationForm (components/registration-form.tsx): validation, the - * normalised register payload, and the edit-mode password update. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import RegistrationForm from '@/components/registration-form' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { expectProcedureCalled, lastProcedureInput } from '../mocks/procedures' -import { renderWithProviders } from '../helpers/render' - -const fillRegisterForm = () => { - fireEvent.changeText(screen.getByPlaceholderText('Enter your full name'), 'Test User') - fireEvent.changeText( - screen.getByPlaceholderText('Enter your email address'), - 'Test@Example.com' - ) - fireEvent.changeText(screen.getByPlaceholderText('Enter your mobile number'), '9876543210') - fireEvent.changeText(screen.getByPlaceholderText('Create a password'), 'secret123') - fireEvent.changeText(screen.getByPlaceholderText('Confirm your password'), 'secret123') - fireEvent.press(screen.getByText(/I agree to the/)) -} - -describe('RegistrationForm', () => { - beforeEach(async () => { - await resetStorage() - }) - - it('renders the registration fields', () => { - setupApiMocks() - renderWithProviders(, { - centralStores: false, - }) - - expect(screen.getByText('Create Account')).toBeVisible() - expect(screen.getByPlaceholderText('Enter your full name')).toBeVisible() - }) - - it('blocks submit with a validation error', async () => { - setupApiMocks() - const onSubmit = jest.fn() - renderWithProviders(, { - centralStores: false, - }) - - fireEvent.press(screen.getByText('Create Account')) - - await waitFor(() => expect(screen.getByText('Name is required')).toBeVisible()) - expect(onSubmit).not.toHaveBeenCalled() - }) - - it('rejects mismatched passwords', async () => { - setupApiMocks() - const onSubmit = jest.fn() - renderWithProviders(, { - centralStores: false, - }) - - fireEvent.changeText(screen.getByPlaceholderText('Enter your full name'), 'Test User') - fireEvent.changeText(screen.getByPlaceholderText('Enter your email address'), 'a@b.com') - fireEvent.changeText(screen.getByPlaceholderText('Enter your mobile number'), '9876543210') - fireEvent.changeText(screen.getByPlaceholderText('Create a password'), 'secret123') - fireEvent.changeText(screen.getByPlaceholderText('Confirm your password'), 'different') - fireEvent.press(screen.getByText(/I agree to the/)) - fireEvent.press(screen.getByText('Create Account')) - - await waitFor(() => - expect(screen.getByText('Passwords do not match')).toBeVisible() - ) - expect(onSubmit).not.toHaveBeenCalled() - }) - - it('submits the normalised register payload', async () => { - setupApiMocks() - const onSubmit = jest.fn() - renderWithProviders(, { - centralStores: false, - }) - - fillRegisterForm() - fireEvent.press(screen.getByText('Create Account')) - - await waitFor(() => expect(onSubmit).toHaveBeenCalled()) - expect(onSubmit.mock.calls[0][0]).toMatchObject({ - name: 'Test User', - email: 'test@example.com', - mobile: '9876543210', - password: 'secret123', - }) - }) - - it('updates the password in edit mode via user.auth.updatePassword', async () => { - const api = setupApiMocks({ - procedures: { 'user.auth.updatePassword': { success: true } }, - }) - renderWithProviders(, { - centralStores: false, - }) - - expect(screen.getByText('Update Profile')).toBeVisible() - - fireEvent.press(screen.getByText('Update Password')) - - fireEvent.changeText(screen.getByPlaceholderText('New Password'), 'newpass1') - fireEvent.changeText(screen.getByPlaceholderText('Confirm Password'), 'newpass1') - fireEvent.press(screen.getByText('Update')) - - await waitFor(() => - expectProcedureCalled(api.fetchMock, 'user.auth.updatePassword') - ) - expect(lastProcedureInput(api.fetchMock, 'user.auth.updatePassword')).toEqual({ - password: 'newpass1', - }) - }) -}) diff --git a/apps/user-ui/tests/components/slot-layout.test.tsx b/apps/user-ui/tests/components/slot-layout.test.tsx deleted file mode 100644 index 121a507..0000000 --- a/apps/user-ui/tests/components/slot-layout.test.tsx +++ /dev/null @@ -1,67 +0,0 @@ -/** - * SlotLayout (components/SlotSpecificView.tsx) — the quick-delivery shell. - * The @react-navigation Drawer is stubbed so the layout's own chrome is - * isolated (SlotProducts / FlashDeliveryProducts are covered in slot-view). - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) -jest.mock('expo-router/drawer', () => ({ Drawer: () => null })) - -import React from 'react' -import { screen, waitFor } from '@testing-library/react-native' - -import { SlotLayout } from '@/components/SlotSpecificView' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { authMock, resetAuthMock } from '../mocks/auth' -import { renderWithProviders } from '../helpers/render' - -const PROCEDURES = { - 'user.address.getDefaultAddress': { data: { id: 1, name: 'Home', addressLine1: '12 Main Road' } }, - 'user.address.getUserAddresses': { - data: [ - { - id: 1, - name: 'Home', - phone: '9876543210', - addressLine1: '12 Main Road', - addressLine2: null, - city: 'Hyderabad', - state: 'Telangana', - isDefault: true, - }, - ], - }, -} - -describe('SlotLayout', () => { - beforeEach(async () => { - resetAuthMock() - authMock.user = { id: 1 } - await resetStorage() - }) - - it('renders the delivery-time selector and the cart bar', async () => { - setupApiMocks({ procedures: PROCEDURES }) - renderWithProviders( - - ) - - await waitFor(() => expect(screen.getByText('Delivery Time')).toBeVisible()) - await waitFor(() => expect(screen.getByText('No Items In Cart')).toBeVisible()) - }) - - it('renders the flash variant header', async () => { - setupApiMocks({ procedures: PROCEDURES }) - renderWithProviders( - - ) - - await waitFor(() => - expect(screen.getByText('Delivery in within 1 hour')).toBeVisible() - ) - }) -}) diff --git a/apps/user-ui/tests/components/static-components.test.tsx b/apps/user-ui/tests/components/static-components.test.tsx deleted file mode 100644 index f234154..0000000 --- a/apps/user-ui/tests/components/static-components.test.tsx +++ /dev/null @@ -1,167 +0,0 @@ -/** - * Static / presentational components: Terms, notes, tab wrapper, first-run gate, - * webview overlay and the Android back handler. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert, BackHandler, Text } from 'react-native' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' - -import BackHandlerWrapper from '@/components/BackHandler' -import FirstUserWrapper from '@/components/FirstUserWrapper' -import FlashDeliveryNote from '@/components/FlashDeliveryNote' -import TabLayoutWrapper from '@/components/TabLayoutWrapper' -import TestingPhaseNote from '@/components/TestingPhaseNote' -import WebViewWrapper from '@/components/WebViewWrapper' -import { TermsAndConditionsContent } from '@/components/TermsAndConditions' -import { resetStorage, setupApiMocks, ESSENTIAL_CONSTS_DATA } from '../mocks/api' -import { renderWithProviders } from '../helpers/render' - -describe('TermsAndConditionsContent', () => { - it('renders the full policy with the title by default', () => { - renderWithProviders(, { centralStores: false }) - - expect(screen.getByText('FRESHYO – Legal Policies')).toBeVisible() - expect(screen.getByText('A. TERMS & CONDITIONS')).toBeVisible() - expect(screen.getByText(/support@freshyo.in/)).toBeVisible() - }) - - it('hides the title when showTitle is false', () => { - renderWithProviders(, { - centralStores: false, - }) - - expect(screen.queryByText('FRESHYO – Legal Policies')).toBeNull() - expect(screen.getByText('A. TERMS & CONDITIONS')).toBeVisible() - }) -}) - -describe('FlashDeliveryNote', () => { - it('renders the notice and dismisses via the close button', () => { - const onClose = jest.fn() - renderWithProviders(, { - centralStores: false, - }) - - expect(screen.getByText('1 Hr Delivery Notice')).toBeVisible() - - // The only touchable in the note is the close button. - fireEvent.press(screen.getByText('1 Hr Delivery Notice')) - - // Pressing the title does nothing; press the icon-bearing touchable instead. - expect(onClose).not.toHaveBeenCalled() - }) - - it('auto-hides after the delay', () => { - renderWithProviders(, { - centralStores: false, - }) - expect(screen.getByText('1 Hr Delivery Notice')).toBeVisible() - - act(() => { - jest.advanceTimersByTime(5000) - }) - - expect(screen.queryByText('1 Hr Delivery Notice')).toBeNull() - }) -}) - -describe('TestingPhaseNote', () => { - it('renders the testing-phase bullets', () => { - renderWithProviders(, { centralStores: false }) - - expect(screen.getByText('Testing Phase')).toBeVisible() - expect(screen.getByText(/Prices shown are not real/)).toBeVisible() - }) -}) - -describe('TabLayoutWrapper', () => { - it('renders its children', () => { - renderWithProviders( - - wrapped - , - { centralStores: false } - ) - - expect(screen.getByText('wrapped')).toBeVisible() - }) -}) - -describe('FirstUserWrapper', () => { - beforeEach(async () => { - await resetStorage() - }) - - it('shows the welcome screen once, then the children after Next', async () => { - renderWithProviders( - - app content - , - { centralStores: false } - ) - - await waitFor(() => expect(screen.getByText('Hello Happy Shopping')).toBeVisible()) - expect(screen.queryByText('app content')).toBeNull() - - fireEvent.press(screen.getByText('Next')) - - await waitFor(() => expect(screen.getByText('app content')).toBeVisible()) - expect(screen.queryByText('Hello Happy Shopping')).toBeNull() - }) -}) - -describe('WebViewWrapper', () => { - it('renders children when there is no webview html', async () => { - setupApiMocks() - renderWithProviders( - - children - , - { centralStores: false } - ) - - await waitFor(() => expect(screen.getByText('children')).toBeVisible()) - expect(screen.queryByTestId('mock-webview')).toBeNull() - }) - - it('renders the webview when the server provides html', async () => { - setupApiMocks({ - consts: { ...ESSENTIAL_CONSTS_DATA, webviewHtml: '

hi

', isWebviewClosable: true }, - }) - renderWithProviders( - - children - , - { centralStores: false } - ) - - await waitFor(() => expect(screen.getByTestId('mock-webview')).toBeVisible()) - expect(screen.queryByText('children')).toBeNull() - }) -}) - -describe('BackHandlerWrapper', () => { - it('shows the exit confirmation on the home screen and swallows the event', async () => { - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - const addListener = jest - .spyOn(BackHandler, 'addEventListener') - .mockImplementation((() => ({ remove: jest.fn() })) as never) - - renderWithProviders(, { centralStores: false }) - - await waitFor(() => expect(addListener).toHaveBeenCalled()) - - const handler = addListener.mock.calls[0][1] as () => boolean - const result = handler() - - expect(Alert.alert).toHaveBeenCalledWith( - 'Exit App', - expect.any(String), - expect.any(Array) - ) - expect(result).toBe(true) - }) -}) diff --git a/apps/user-ui/tests/components/wrappers.test.tsx b/apps/user-ui/tests/components/wrappers.test.tsx deleted file mode 100644 index 7c6e733..0000000 --- a/apps/user-ui/tests/components/wrappers.test.tsx +++ /dev/null @@ -1,202 +0,0 @@ -/** - * HealthTestWrapper + UpdateChecker. - * Health asserts common.healthCheck (retry refetches). UpdateChecker gates on - * the backend's internalAppVersion vs the shipped constants.INTERNAL_APP_VERSION - * (and is skipped on dev builds). - */ - -jest.mock('expo-constants', () => ({ - __esModule: true, - default: { expoConfig: { version: '1.0.0' } }, -})) - -import React from 'react' -import { Alert, Text } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' -import * as Updates from 'expo-updates' - -import HealthTestWrapper from '@/components/HealthTestWrapper' -import UpdateChecker from '@/components/UpdateChecker' -import constants from '@/src/constants' -import { - ESSENTIAL_CONSTS_DATA, - resetEssentialConsts, - resetStorage, - setupApiMocks, -} from '../mocks/api' -import { procedureCalls } from '../mocks/procedures' -import { renderWithProviders } from '../helpers/render' - -describe('HealthTestWrapper', () => { - beforeEach(async () => { - await resetStorage() - }) - - it('renders children when the backend is healthy', async () => { - setupApiMocks({ - procedures: { 'common.healthCheck': { status: 'ok' } }, - consts: { ...ESSENTIAL_CONSTS_DATA, versionNum: '0.0.1' }, - }) - renderWithProviders( - - app content - , - { centralStores: false } - ) - - await waitFor(() => expect(screen.getByText('app content')).toBeVisible()) - }) - - it('shows the service-unavailable state and retries', async () => { - const api = setupApiMocks({ - procedures: { - 'common.healthCheck': () => { - throw new Error('backend down') - }, - }, - }) - renderWithProviders( - - app content - , - { centralStores: false } - ) - - await waitFor(() => expect(screen.getByText('Service Unavailable')).toBeVisible()) - expect(screen.queryByText('app content')).toBeNull() - - const before = procedureCalls(api.fetchMock, 'common.healthCheck').length - fireEvent.press(screen.getByText('Retry')) - - await waitFor(() => - expect(procedureCalls(api.fetchMock, 'common.healthCheck').length).toBeGreaterThan( - before - ) - ) - }) - - it('prompts to update when the backend version is ahead', async () => { - setupApiMocks({ - procedures: { 'common.healthCheck': { status: 'ok' } }, - consts: { - ...ESSENTIAL_CONSTS_DATA, - versionNum: '99.0.0', - playStoreUrl: 'https://play.example/app', - }, - }) - renderWithProviders( - - app content - , - { centralStores: false } - ) - - await waitFor(() => expect(screen.getByText('Update Available')).toBeVisible()) - }) -}) - -describe('UpdateChecker', () => { - const originalDev = (global as unknown as { __DEV__: boolean }).__DEV__ - - /** Invoke a button inside a React Native Alert from the alert spy. */ - const pressAlertButton = (label: string) => { - const calls = (Alert.alert as jest.Mock).mock.calls - const buttons = calls[calls.length - 1]?.[2] as - | { text: string; onPress?: () => void }[] - | undefined - const button = buttons?.find((b) => b.text === label) - if (!button?.onPress) throw new Error(`[tests] no alert button "${label}"`) - button.onPress() - } - - beforeEach(async () => { - // The gate only runs on production builds; jest sets __DEV__ true. - ;(global as unknown as { __DEV__: boolean }).__DEV__ = false - await resetEssentialConsts() - await resetStorage() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - afterEach(() => { - ;(global as unknown as { __DEV__: boolean }).__DEV__ = originalDev - }) - - it('shows a blocking restart dialog when the backend version is ahead', async () => { - setupApiMocks({ - consts: { ...ESSENTIAL_CONSTS_DATA, internalAppVersion: constants.INTERNAL_APP_VERSION + 1 }, - }) - renderWithProviders( - - app content - , - { centralStores: false } - ) - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith( - 'Update available', - expect.any(String), - expect.any(Array), - expect.objectContaining({ cancelable: false }) - ) - ) - - // Only the restart action — no "Later" escape hatch. - const buttons = (Alert.alert as jest.Mock).mock.calls.at(-1)![2] as { text: string }[] - expect(buttons.map((b) => b.text)).toEqual(['Update & Restart']) - expect(screen.getByText('app content')).toBeVisible() - }) - - it('does not prompt when the shipped version matches the backend', async () => { - const api = setupApiMocks({ - consts: { ...ESSENTIAL_CONSTS_DATA, internalAppVersion: constants.INTERNAL_APP_VERSION }, - }) - renderWithProviders( - - app content - , - { centralStores: false } - ) - - await waitFor(() => - expect(procedureCalls(api.fetchMock, 'common.essentialConsts').length).toBeGreaterThan(0) - ) - expect(Alert.alert).not.toHaveBeenCalled() - }) - - it('does not prompt when the shipped version is ahead of the backend', async () => { - const api = setupApiMocks({ - consts: { ...ESSENTIAL_CONSTS_DATA, internalAppVersion: constants.INTERNAL_APP_VERSION - 1 }, - }) - renderWithProviders( - - app content - , - { centralStores: false } - ) - - await waitFor(() => - expect(procedureCalls(api.fetchMock, 'common.essentialConsts').length).toBeGreaterThan(0) - ) - expect(Alert.alert).not.toHaveBeenCalled() - }) - - it('fetches then reloads the update when the action is pressed', async () => { - setupApiMocks({ - consts: { ...ESSENTIAL_CONSTS_DATA, internalAppVersion: constants.INTERNAL_APP_VERSION + 1 }, - }) - renderWithProviders( - - app content - , - { centralStores: false } - ) - - await waitFor(() => expect(Alert.alert).toHaveBeenCalled()) - - pressAlertButton('Update & Restart') - - await waitFor(() => expect(Updates.fetchUpdateAsync).toHaveBeenCalledTimes(1)) - expect(Updates.reloadAsync).toHaveBeenCalledTimes(1) - }) -}) diff --git a/apps/user-ui/tests/contexts/auth-context.test.tsx b/apps/user-ui/tests/contexts/auth-context.test.tsx deleted file mode 100644 index 1028b52..0000000 --- a/apps/user-ui/tests/contexts/auth-context.test.tsx +++ /dev/null @@ -1,124 +0,0 @@ -/** - * AuthContext (src/contexts/AuthContext.tsx) — the REAL provider. - * tests/setup.ts stubs this module globally, so it is unmocked here. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) -jest.unmock('@/src/contexts/AuthContext') - -import React from 'react' -import { Text, TouchableOpacity } from 'react-native' -import { fireEvent, render, screen, waitFor } from '@testing-library/react-native' - -import { AuthProvider, useAuth, useUserDetails } from '@/src/contexts/AuthContext' -import { getAuthToken } from '@/hooks/useJWT' -import { resetEssentialConsts, resetStorage, setupApiMocks } from '../mocks/api' -import { renderWithProviders } from '../helpers/render' - -const USER = { - id: 5, - name: 'Test User', - email: 'test@example.com', - mobile: '9876543210', - profileImage: '', - createdAt: '', -} - -const Probe = () => { - const auth = useAuth() - const details = useUserDetails() - return ( - <> - - {`${auth.isAuthenticated}|${auth.isLoading}|${auth.user?.id ?? 'none'}`} - - {details ? 'yes' : 'no'} - auth.loginWithToken('tok', USER as never)} - > - login - - auth.logout()}> - logout - - - ) -} - -const renderAuth = () => { - setupApiMocks({ - procedures: { - 'user.user.getSelfData': { data: { user: USER } }, - 'user.auth.login': { data: { token: 'tok2', user: USER } }, - 'user.auth.register': { token: 'tok3', user: USER }, - }, - }) - return renderWithProviders( - - - , - { centralStores: false } - ) -} - -describe('AuthProvider', () => { - beforeEach(async () => { - await resetEssentialConsts() - await resetStorage() - }) - - it('settles to a signed-out state when there is no stored token', async () => { - renderAuth() - - await waitFor(() => - expect(screen.getByTestId('state')).toHaveTextContent('false|false|none') - ) - expect(screen.getByTestId('details')).toHaveTextContent('no') - }) - - it('loginWithToken persists the token and authenticates', async () => { - renderAuth() - await waitFor(() => - expect(screen.getByTestId('state')).toHaveTextContent('false|false|none') - ) - - fireEvent.press(screen.getByTestId('do-login-token')) - - await waitFor(() => - expect(screen.getByTestId('state')).toHaveTextContent('true|false|5') - ) - expect(await getAuthToken()).toBe('tok') - expect(screen.getByTestId('details')).toHaveTextContent('yes') - }) - - it('logout clears the session and the stored token', async () => { - renderAuth() - await waitFor(() => - expect(screen.getByTestId('state')).toHaveTextContent('false|false|none') - ) - - fireEvent.press(screen.getByTestId('do-login-token')) - await waitFor(() => - expect(screen.getByTestId('state')).toHaveTextContent('true|false|5') - ) - - fireEvent.press(screen.getByTestId('do-logout')) - - await waitFor(() => - expect(screen.getByTestId('state')).toHaveTextContent('false|false|none') - ) - expect(await getAuthToken()).toBeNull() - }) - - it('useAuth throws outside an AuthProvider', () => { - const Bare = () => { - useAuth() - return null - } - - expect(() => render()).toThrow( - 'useAuth must be used within an AuthProvider' - ) - }) -}) diff --git a/apps/user-ui/tests/contexts/auth-lifecycle.test.tsx b/apps/user-ui/tests/contexts/auth-lifecycle.test.tsx deleted file mode 100644 index 17f267f..0000000 --- a/apps/user-ui/tests/contexts/auth-lifecycle.test.tsx +++ /dev/null @@ -1,267 +0,0 @@ -/** - * AuthContext (src/contexts/AuthContext.tsx) — the paths that only run against - * the REAL provider: session restore from storage, getSelfData handling, the - * real login()/register() mutations, and the post-login redirect. - * - * tests/setup.ts stubs this module globally, so it is unmocked here. Known bugs - * are pinned — see tests/KNOWN-GAPS.md. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) -jest.unmock('@/src/contexts/AuthContext') - -import React from 'react' -import { Text, TouchableOpacity } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' -import { StorageService } from 'common-ui/src/services/StorageService' -import { StorageServiceCasual } from 'common-ui/src/services/StorageServiceCasual' - -import { AuthProvider, useAuth, useUserDetails } from '@/src/contexts/AuthContext' -import { getAuthToken, getUserId } from '@/hooks/useJWT' -import constants from '@/src/constants' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { routerMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const USER = { - id: 5, - name: 'Test User', - email: 'test@example.com', - mobile: '9876543210', - profileImage: '', - createdAt: '', -} - -/** - * getCurrentUserId decodes the JWT payload, so a restore test needs a token - * jwtDecode accepts. Only the payload is inspected — the signature is a stub. - */ -const jwtFor = (payload: Record) => { - const enc = (obj: unknown) => - Buffer.from(JSON.stringify(obj)).toString('base64url') - return `${enc({ alg: 'HS256', typ: 'JWT' })}.${enc(payload)}.sig` -} - -const USER_JWT = jwtFor({ id: USER.id }) - -const Probe = () => { - const auth = useAuth() - const details = useUserDetails() - const [loginError, setLoginError] = React.useState('') - return ( - <> - - {`${auth.isAuthenticated}|${auth.isLoading}|${auth.user?.id ?? 'none'}`} - - {details ? 'yes' : 'no'} - {loginError} - - auth - .login({ mobile: '9876543210', password: 'pw' } as never) - .catch(() => setLoginError('failed')) - } - > - login - - - auth.register({ name: 'T', email: 't@e.com', mobile: '9876543210', password: 'pw' } as never) - } - > - register - - auth.loginWithToken('tok', USER as never)}> - token - - - ) -} - -const SELF_DATA = { data: { user: USER } } - -const renderAuth = (procedures: Record = {}) => - renderWithProviders( - - - , - { centralStores: false } - ) - -/** A getSelfData mock that rejects, to drive the invalid-token path. */ -const failingSelfData = () => { - throw new Error('UNAUTHORIZED') -} - -describe('Auth lifecycle (real provider)', () => { - beforeEach(async () => { - await resetStorage() - await StorageService.clearAll(['authToken', 'userId']) - await StorageServiceCasual.clearAll([constants.AUTH_REDIRECT_KEY]) - routerMock.back.mockClear() - routerMock.replace.mockClear() - }) - - it('restores the session from a stored token and populates userDetails', async () => { - await StorageService.setItem('authToken', USER_JWT) - await StorageService.setItem('userId', String(USER.id)) - - setupApiMocks({ - procedures: { 'user.user.getSelfData': SELF_DATA }, - }) - renderAuth() - - // Restored from storage before the query settles: authenticated, still loading. - await waitFor(() => expect(screen.getByTestId('state')).toHaveTextContent('true|true|5')) - - // getSelfData then fills the profile in and drops the loading flag. - await waitFor(() => expect(screen.getByTestId('state')).toHaveTextContent('true|false|5')) - expect(screen.getByTestId('details')).toHaveTextContent('yes') - }) - - it('settles to signed-out when the stored token carries no user id', async () => { - // getCurrentUserId derives the id from the JWT payload, not the userId key. - await StorageService.setItem('authToken', jwtFor({ role: 'guest' })) - await StorageService.setItem('userId', '5') - - setupApiMocks({ procedures: { 'user.user.getSelfData': SELF_DATA } }) - renderAuth() - - await waitFor(() => expect(screen.getByTestId('state')).toHaveTextContent('false|false|none')) - expect(screen.getByTestId('details')).toHaveTextContent('no') - }) - - it('settles to signed-out when the stored token cannot be decoded', async () => { - await StorageService.setItem('authToken', 'not-a-jwt') - await StorageService.setItem('userId', '5') - - setupApiMocks({ procedures: { 'user.user.getSelfData': SELF_DATA } }) - renderAuth() - - await waitFor(() => expect(screen.getByTestId('state')).toHaveTextContent('false|false|none')) - }) - - /** - * KNOWN GAP: AuthContext clears the in-memory session on a getSelfData error - * but `deleteAuthToken()` is commented out, so the dead token is restored on - * the next cold start. This pins that behaviour — it should fail once the - * token is actually deleted. - */ - it('clears the session when getSelfData fails but leaves the stale token in storage', async () => { - await StorageService.setItem('authToken', USER_JWT) - await StorageService.setItem('userId', String(USER.id)) - - setupApiMocks({ - procedures: { 'user.user.getSelfData': failingSelfData }, - }) - renderAuth() - - await waitFor(() => expect(screen.getByTestId('state')).toHaveTextContent('false|false|none')) - // The bug: the token survives and would re-authenticate on next launch. - expect(await getAuthToken()).toBe(USER_JWT) - expect(await getUserId()).toBe(String(USER.id)) - }) - - it('login() persists the token and user id and authenticates', async () => { - setupApiMocks({ - procedures: { - 'user.user.getSelfData': SELF_DATA, - 'user.auth.login': { data: { token: 'tok-login', user: USER } }, - }, - }) - renderAuth() - await waitFor(() => expect(screen.getByTestId('state')).toHaveTextContent('false|false|none')) - - fireEvent.press(screen.getByTestId('do-login')) - - await waitFor(() => expect(screen.getByTestId('state')).toHaveTextContent('true|false|5')) - expect(await getAuthToken()).toBe('tok-login') - expect(await getUserId()).toBe(String(USER.id)) - expect(screen.getByTestId('details')).toHaveTextContent('yes') - }) - - it('login() surfaces the failure and stays signed-out', async () => { - setupApiMocks({ - procedures: { - 'user.auth.login': () => { - throw new Error('bad credentials') - }, - }, - }) - renderAuth() - await waitFor(() => expect(screen.getByTestId('state')).toHaveTextContent('false|false|none')) - - fireEvent.press(screen.getByTestId('do-login')) - - await waitFor(() => expect(screen.getByTestId('login-error')).toHaveTextContent('failed')) - expect(screen.getByTestId('state')).toHaveTextContent('false|false|none') - expect(await getAuthToken()).toBeNull() - }) - - it('register() persists the token and user id and authenticates', async () => { - setupApiMocks({ - procedures: { - 'user.user.getSelfData': SELF_DATA, - 'user.auth.register': { data: { token: 'tok-reg', user: USER } }, - }, - }) - renderAuth() - await waitFor(() => expect(screen.getByTestId('state')).toHaveTextContent('false|false|none')) - - fireEvent.press(screen.getByTestId('do-register')) - - await waitFor(() => expect(screen.getByTestId('state')).toHaveTextContent('true|false|5')) - expect(await getAuthToken()).toBe('tok-reg') - expect(await getUserId()).toBe(String(USER.id)) - }) - - it('consumes the stored post-login redirect and calls router.back()', async () => { - const redirectState = { - targetUrl: '/(drawer)/(tabs)/home/checkout', - queryParams: { slots: '1:1' }, - timestamp: Date.now(), - } - await StorageServiceCasual.setItem(constants.AUTH_REDIRECT_KEY, JSON.stringify(redirectState)) - - setupApiMocks({ procedures: { 'user.user.getSelfData': SELF_DATA } }) - renderAuth() - await waitFor(() => expect(screen.getByTestId('state')).toHaveTextContent('false|false|none')) - - fireEvent.press(screen.getByTestId('do-login-token')) - - await waitFor(() => expect(routerMock.back).toHaveBeenCalled()) - // The redirect state is single-use. - expect(await StorageServiceCasual.getItem(constants.AUTH_REDIRECT_KEY)).toBeNull() - }) - - it('falls back to router.back() when the redirect state has expired', async () => { - const stale = { - targetUrl: '/somewhere', - queryParams: {}, - timestamp: Date.now() - 25 * 60 * 60 * 1000, - } - await StorageServiceCasual.setItem(constants.AUTH_REDIRECT_KEY, JSON.stringify(stale)) - - setupApiMocks({ procedures: { 'user.user.getSelfData': SELF_DATA } }) - renderAuth() - await waitFor(() => expect(screen.getByTestId('state')).toHaveTextContent('false|false|none')) - - fireEvent.press(screen.getByTestId('do-login-token')) - - await waitFor(() => expect(routerMock.back).toHaveBeenCalled()) - expect(routerMock.replace).not.toHaveBeenCalled() - expect(await StorageServiceCasual.getItem(constants.AUTH_REDIRECT_KEY)).toBeNull() - }) - - it('calls router.back() when there is no stored redirect state', async () => { - setupApiMocks({ procedures: { 'user.user.getSelfData': SELF_DATA } }) - renderAuth() - await waitFor(() => expect(screen.getByTestId('state')).toHaveTextContent('false|false|none')) - - fireEvent.press(screen.getByTestId('do-login-token')) - - await waitFor(() => expect(routerMock.back).toHaveBeenCalled()) - }) -}) diff --git a/apps/user-ui/tests/contexts/auth-logout-cache.test.tsx b/apps/user-ui/tests/contexts/auth-logout-cache.test.tsx deleted file mode 100644 index 1db3d29..0000000 --- a/apps/user-ui/tests/contexts/auth-logout-cache.test.tsx +++ /dev/null @@ -1,56 +0,0 @@ -/** - * AuthProvider.logout must clear the query cache. - * - * Without it, a signed-out (or deleted) account's orders, addresses, coupons - * and profile stay cached and are served to the next session on the same - * device. Uses the REAL provider (tests/setup.ts stubs AuthContext globally). - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) -jest.unmock('@/src/contexts/AuthContext') - -import React from 'react' -import { Text, TouchableOpacity } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import { AuthProvider, useAuth } from '@/src/contexts/AuthContext' -import { setupApiMocks } from '../mocks/api' -import { createQueryClient, renderWithProviders } from '../helpers/render' - -const Probe = () => { - const { logout } = useAuth() - return ( - { - void logout() - }} - > - logout - - ) -} - -describe('AuthProvider logout', () => { - it('removes cached queries so the next session starts clean', async () => { - setupApiMocks() - const queryClient = createQueryClient() - - // Stand in for the user-scoped data cached during a session. - queryClient.setQueryData(['user-scoped-data'], { orders: [1, 2, 3] }) - expect(queryClient.getQueryData(['user-scoped-data'])).toEqual({ orders: [1, 2, 3] }) - - renderWithProviders( - - - , - { queryClient, centralStores: false } - ) - - fireEvent.press(screen.getByTestId('logout')) - - await waitFor(() => - expect(queryClient.getQueryData(['user-scoped-data'])).toBeUndefined() - ) - }) -}) diff --git a/apps/user-ui/tests/helpers/real-router.tsx b/apps/user-ui/tests/helpers/real-router.tsx deleted file mode 100644 index 64c8d84..0000000 --- a/apps/user-ui/tests/helpers/real-router.tsx +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Real-router render helper. - * - * IMPORTANT: only import this from a test file that does NOT mock expo-router. - * `jest.mock('expo-router', ...)` also affects `expo-router/testing-library`, - * so mixing the two in one file breaks the real router. - * - * Route keys mirror app/ (e.g. '(drawer)/(tabs)/home/index'); renderRouter - * strips the group segments, so that route is reachable at '/home'. - */ - -import type React from 'react' -import { renderRouter } from 'expo-router/testing-library' - -export interface RouteMap { - [route: string]: React.ComponentType -} - -export function renderRoute(routes: RouteMap, initialUrl: string) { - return renderRouter(routes, { initialUrl }) -} diff --git a/apps/user-ui/tests/helpers/render.tsx b/apps/user-ui/tests/helpers/render.tsx deleted file mode 100644 index 544c898..0000000 --- a/apps/user-ui/tests/helpers/render.tsx +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Generic render helpers shared by the screen and component tests. - * - * The provider stack mirrors app/_layout.tsx, minus the wrappers that need a - * real device or navigation container (Location/Health/WebView/Notification). - * `CentralStoreInitializer` is on by default because most screens read the - * central product/slot stores it populates; pass `centralStores: false` for - * pure components that must not trigger CDN fetches. - * - * A file that renders router consumers must declare the router mock itself: - * - * jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - * - * For real-router navigation assertions, use tests/helpers/real-router.tsx - * instead (and do NOT mock expo-router in that file). - */ - -import React from 'react' -import { QueryClient, QueryClientProvider } from '@tanstack/react-query' -import { render } from '@testing-library/react-native' -import { RefreshProvider } from 'common-ui' - -import CentralStoreInitializer from '@/src/components/CentralStoreInitializer' -import { trpc, trpcClient } from '@/src/trpc-client' - -export function createQueryClient() { - return new QueryClient({ - defaultOptions: { queries: { retry: false, gcTime: 0 } }, - }) -} - -export interface ProviderOptions { - /** Include CentralStoreInitializer (products/slots/cart reconcile). Default true. */ - centralStores?: boolean - /** Reuse a specific query client (e.g. to assert refetches). */ - queryClient?: QueryClient -} - -export function Providers({ - children, - centralStores = true, - queryClient, -}: { children?: React.ReactNode } & ProviderOptions) { - const client = React.useMemo( - () => queryClient ?? createQueryClient(), - [queryClient] - ) - - return ( - - - - {centralStores ? ( - {children} - ) : ( - <>{children} - )} - - - - ) -} - -/** Render a screen/component inside the standard provider stack. */ -export function renderWithProviders( - ui: React.ReactElement, - options?: ProviderOptions -) { - return render({ui}) -} diff --git a/apps/user-ui/tests/home-page/README.md b/apps/user-ui/tests/home-page/README.md deleted file mode 100644 index 1df98e5..0000000 --- a/apps/user-ui/tests/home-page/README.md +++ /dev/null @@ -1,150 +0,0 @@ -# Home page tests - -Jest integration tests for the user-ui home page -(`apps/user-ui/app/(drawer)/(tabs)/home/index.tsx`) and the components it renders. - -- **9 files, 48 tests** -- Runner: `jest-expo` + `@testing-library/react-native`, config at `tests/jest.config.js` -- Network is mocked at the layer (`tests/mocks/api.ts`); components, stores, hooks and the router wiring stay real - -## Run - -From `apps/user-ui`: - -```bash -NODE_ENV=test bun run test tests/home-page # this folder -NODE_ENV=test bun run test # every test in the app -NODE_ENV=test bun run test:watch # watch mode -``` - -`NODE_ENV=test` is required: with `NODE_ENV=production` React loads its production -build and every render throws *"act(...) is not supported in production builds of -React"*. (Raw jest equivalent: `NODE_ENV=test bunx jest --config tests/jest.config.js`.) - -## Layout - -| File | Tests | Covers | -| --- | --- | --- | -| `home.test.tsx` | 18 | Core home behaviour (mocked router) | -| `navigation.test.tsx` | 3 | Real expo-router navigation + params | -| `home-states.test.tsx` | 5 | Loading / error / empty states | -| `home-refresh.test.tsx` | 2 | Pull-to-refresh fan-out | -| `home-slots.test.tsx` | 3 | Slot card badge + labels | -| `home-add-to-cart-dialog.test.tsx` | 3 | Add-to-cart dialog specifics | -| `home-floating-cart-bar.test.tsx` | 5 | Floating cart bar (pinned products, totals, slots) | -| `next-order-glimpse.test.tsx` | 5 | Upcoming-order preview | -| `home-cards.test.tsx` | 4 | Product card / store list details | -| `render.tsx` | — | Shared provider stack + helpers (not a test) | - -Shared fixtures live in `tests/mocks/` (network + router + auth + refresh) and -`tests/__fixtures__/`. `setup.ts` stubs auth/refresh/storage and freezes the clock. - ---- - -## `home.test.tsx` — core home behaviour - -API responses are mocked at the network layer; the tree includes the real -`CentralStoreInitializer` so the slot/availability/product stores are populated as -in the app. `expo-router` is mocked here. - -| # | Test | What it asserts | -| --- | --- | --- | -| 1 | requests the products cache url derived from common.essentialConsts | Fetches `common.essentialConsts`, then derives and requests the products CDN URL | -| 2 | shows a tab for every tag | One `tag-tab-*` per tag, each showing its name | -| 3 | shows every product of every tag, expanding each grid once | 6-item preview per tag, "Show More" reveals the rest | -| 4 | renders a tag with its out-of-stock items last | Out-of-stock pushed to the end; admin order preserved within each group | -| 5 | shows the upcoming slots in delivery order | First 5 upcoming slots, sorted by delivery then freeze | -| 6 | hides a slot whose freeze time has passed | Expired-freeze slot absent from the home strip | -| 7 | hides a slot whose freeze time has passed in the add-to-cart dialog | Expired slot not offered; a valid slot still is | -| 8 | shows the load-all button until every product is loaded | `products-show-more` pages 21 at a time until gone | -| 9 | marks exactly the unavailable products out of stock in every tag | Badge present iff the product is unavailable | -| 10 | lists the main product list with unavailable items last | Mounted head of the list matches expected sort order | -| 11 | adds items to the cart | Floating bar counts lines; card swaps add icon for a stepper | -| 12 | updates and removes a cart item through the card quantity stepper | Increment opens update dialog; quantity changes in dialog; delete removes | -| 13 | shows the store list and navigates when a store is tapped | Store row renders; tap pushes to stores + sets navigation store | -| 14 | opens the product detail page from a tag grid card | Push `.../product-detail/` | -| 15 | opens the product detail page from the main list | Push `.../product-detail/` | -| 16 | opens the slot detail page when a slot card is tapped | Push `.../slot-view?slotId=` | -| 17 | opens search from the search bar | Push `.../search-results` | -| 18 | opens the cart from the floating bar | Push `.../home/cart` | - -## `navigation.test.tsx` — real router - -Renders the actual `expo-router` (via `expo-router/testing-library`) with a route -map mirroring `app/`, proving pushed URLs resolve and params arrive. - -| # | Test | What it asserts | -| --- | --- | --- | -| 1 | routes to the product detail screen carrying the id | Pathname `/home/product-detail/`, `id` param delivered | -| 2 | routes to the slot view carrying the slotId | Pathname `/home/slot-view`, `slotId` search param delivered | -| 3 | routes to the stores screen | Pathname `/stores`, stores stub visible | - -## `home-states.test.tsx` — page states - -| # | Test | What it asserts | -| --- | --- | --- | -| 1 | shows the loading screen while the products request is pending | "Loading products..." while the products request never resolves | -| 2 | shows the products error state when the products request fails | "Oops!" + "Failed to load products" | -| 3 | shows the app-settings error state when essentialConsts fails | "Oops!" + "Failed to load app settings" | -| 4 | shows the empty state when there are no products | "No products available" (list empty component) | -| 5 | shows the empty-category message for a tag with no products | "No products in this category yet" for an empty tag | - -## `home-refresh.test.tsx` — refresh - -`handleRefresh` fans out to products, slots, stores and essentialConsts. -Availability is intentionally not asserted (it is not refetched). - -| # | Test | What it asserts | -| --- | --- | --- | -| 1 | refetches every data source through useManualRefresh | Each URL requested again after the manual-refresh callback fires | -| 2 | refetches every data source through useMarkDataFetchers | Same, via the mark-data-fetchers callback | - -## `home-slots.test.tsx` — slot card details - -| # | Test | What it asserts | -| --- | --- | --- | -| 1 | marks only the slots closing within 4 hours | "CLOSING SOON" iff freeze is within 4h (both branches exercised) | -| 2 | labels each slot with its delivery range and order-by time | Delivery range, order-by clock time, date line | -| 3 | shows how many products each slot holds | "View all N items" matches the slot's product count | - -## `home-add-to-cart-dialog.test.tsx` — add-to-cart dialog - -| # | Test | What it asserts | -| --- | --- | --- | -| 1 | offers flash delivery and routes to the flash cart when enabled | Flash row shown (flash enabled + SKU flash-available); confirm pushes the flash cart | -| 2 | keeps confirm disabled until a delivery option is chosen | Confirm disabled with no slot selected | -| 3 | pre-selects the cart quantity when reopened from the card stepper | Update mode shows the current cart quantity | - -## `home-floating-cart-bar.test.tsx` — floating cart bar - -Uses two **pinned** products with exact fixture prices so every money and slot -expectation is a fixed number: `2` "Chicken Breast 500 g" (₹215) and `40` -"Chicken regular cut Large pieces" (₹129), both in the "Chicken" tag. A single -expanded grid holds them; the free-delivery threshold is ₹249. - -| # | Test | What it asserts | -| --- | --- | --- | -| 1 | adds exactly the pinned products and tracks the total and delivery threshold | ₹215 → "₹34 more for FREE Delivery"; +₹129 → ₹344 • 2 Items → "Free Delivery Unlocked" | -| 2 | places each pinned product in the first open slot it belongs to | Each line shows its slot label (both resolve to slot 1849) | -| 3 | recomputes the total when the quantity changes | Quantity 1 → 2 moves the total ₹215 → ₹430 (still one line) | -| 4 | expands into the cart dialog with the line and the subtotal | "Your Cart" dialog shows the item and Subtotal | -| 5 | re-slots a stored cart item whose slot no longer exists | `useReconcileCartSlots` rewrites the invalid `slotId` to a real slot | - -## `next-order-glimpse.test.tsx` — upcoming order preview - -| # | Test | What it asserts | -| --- | --- | --- | -| 1 | renders nothing and never requests orders when signed out | No "Upcoming Order"; `user.order.getOrders` not requested | -| 2 | previews an upcoming order | Order id, "N items • ₹total", status label (`pending` → "Confirmed") | -| 3 | flags a flash order | "FLASH" badge + "30-Min Delivery" | -| 4 | ignores cancelled and completed orders | Cancelled / successful orders produce no preview | -| 5 | routes to my-orders when a card is tapped | `router.replace('/(drawer)/(tabs)/me')` | - -## `home-cards.test.tsx` — card / list details - -| # | Test | What it asserts | -| --- | --- | --- | -| 1 | never renders a combo-only SKU | Combo-only SKU (149) absent from the main list and every tag grid | -| 2 | renders every store with the leading "The " stripped | All stores render; `The ` prefix removed from the display name | -| 3 | strikes through the market price when it is above the selling price | Market price shown when greater than the selling price | -| 4 | shows a fallback when a product image fails to load | "Image failed to load" after an image error | diff --git a/apps/user-ui/tests/home-page/home-add-to-cart-dialog.test.tsx b/apps/user-ui/tests/home-page/home-add-to-cart-dialog.test.tsx deleted file mode 100644 index 0c59498..0000000 --- a/apps/user-ui/tests/home-page/home-add-to-cart-dialog.test.tsx +++ /dev/null @@ -1,119 +0,0 @@ -/** - * AddToCartDialog behaviour reached from the home tag grid: - * - the flash-delivery option (only when flash is enabled AND the SKU is - * flash available) and its route, - * - the confirm button staying disabled until a delivery option is chosen, - * - reopening from the card stepper pre-loading the cart quantity. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import { fireEvent, screen, waitFor, within } from '@testing-library/react-native' - -import { - FLASH_ENABLED_CONSTS, - outOfStockIds, - resetEssentialConsts, - resetStorage, - setupApiMocks, -} from '../mocks/api' -import { routerMock } from '../mocks/router' -import { useNavigationStore } from '@/src/store/navigationStore' -import { - addToCartFromTagGrid, - expandTag, - flashAvailableById, - productIdsForTag, - renderLoadedHome, - tags, -} from './render' - -/** First in-stock product in a tag that is also flash available. */ -const findFlashProduct = () => { - for (const tag of tags) { - for (const id of productIdsForTag(tag)) { - if (!outOfStockIds.has(id) && flashAvailableById.get(id) === true) { - return { tagId: tag.id, productId: id } - } - } - } - throw new Error('[tests] no in-stock flash product in any tag') -} - -/** First in-stock product in any tag. */ -const findInStockProduct = () => { - for (const tag of tags) { - for (const id of productIdsForTag(tag)) { - if (!outOfStockIds.has(id)) return { tagId: tag.id, productId: id } - } - } - throw new Error('[tests] no in-stock product in any tag') -} - -const openDialog = ({ tagId, productId }: { tagId: number; productId: number }) => { - expandTag(tagId) - fireEvent.press( - within(screen.getByTestId(`tag-product-${productId}`)).getByTestId( - 'add-to-cart-icon' - ) - ) -} - -describe('Home add-to-cart dialog', () => { - beforeEach(async () => { - // A consts override is persisted by useGetEssentialConsts, so clear it - // between tests or the flash-enabled payload leaks into the next case. - await resetEssentialConsts() - await resetStorage() - useNavigationStore.setState({ - isNavigatedFromHome: false, - selectedStoreId: null, - }) - }) - - it('offers flash delivery and routes to the flash cart when enabled', async () => { - setupApiMocks({ consts: FLASH_ENABLED_CONSTS }) - await renderLoadedHome() - - openDialog(findFlashProduct()) - - expect(screen.getByText('1 hr Delivery')).toBeVisible() - fireEvent.press(screen.getByText('1 hr Delivery')) - fireEvent.press(screen.getByTestId('add-to-cart-confirm')) - - expect(routerMock.push).toHaveBeenCalledWith( - '/(drawer)/(tabs)/flash-delivery/(products)' - ) - }) - - it('keeps confirm disabled until a delivery option is chosen', async () => { - setupApiMocks() - await renderLoadedHome() - - openDialog(findInStockProduct()) - - expect(screen.getByTestId('add-to-cart-confirm')).toBeDisabled() - }) - - it('pre-selects the cart quantity when reopened from the card stepper', async () => { - setupApiMocks() - await renderLoadedHome() - - const target = findInStockProduct() - expandTag(target.tagId) - addToCartFromTagGrid(target.productId) - - await waitFor(() => expect(screen.getByText(/1 Item/)).toBeVisible()) - - // The card increment opens the dialog in update mode, preloaded with the - // cart quantity (the pressed delta is discarded by ProductCard). - fireEvent.press( - within(screen.getByTestId(`tag-product-${target.productId}`)).getByTestId( - 'mini-quantifier-increment' - ) - ) - - expect(screen.getByText('Update Item')).toBeVisible() - expect(screen.getByTestId('quantifier-value')).toHaveTextContent('1') - }) -}) diff --git a/apps/user-ui/tests/home-page/home-cards.test.tsx b/apps/user-ui/tests/home-page/home-cards.test.tsx deleted file mode 100644 index fc454e7..0000000 --- a/apps/user-ui/tests/home-page/home-cards.test.tsx +++ /dev/null @@ -1,102 +0,0 @@ -/** - * Home card/list details: combo-only SKUs are hidden, every store renders with - * its display name, and ProductCard's market-price and image-error branches. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import { Image } from 'react-native' -import { fireEvent, screen, within } from '@testing-library/react-native' - -import { outOfStockIds, resetStorage, setupApiMocks } from '../mocks/api' -import storesResponse from '../mocks/mock-stores-response.json' -import { useNavigationStore } from '@/src/store/navigationStore' -import { - expandTag, - marketPriceById, - priceById, - productIdsForTag, - renderLoadedHome, - tags, -} from './render' - -const COMBO_ONLY_ID = 149 - -const firstInStockInTag = () => { - for (const tag of tags) { - for (const id of productIdsForTag(tag)) { - if (!outOfStockIds.has(id)) return { tagId: tag.id, productId: id } - } - } - throw new Error('[tests] no in-stock product in any tag') -} - -/** First in-stock tag product whose marketPrice is above its selling price. */ -const productWithMarkup = () => { - for (const tag of tags) { - for (const id of productIdsForTag(tag)) { - if (outOfStockIds.has(id)) continue - const marketPrice = marketPriceById.get(id) - const price = priceById.get(id) - if (marketPrice != null && price != null && marketPrice > price) { - return { tagId: tag.id, productId: id, marketPrice } - } - } - } - throw new Error('[tests] no in-stock product with a market price above its price') -} - -describe('Home cards + lists', () => { - beforeEach(async () => { - setupApiMocks() - await resetStorage() - useNavigationStore.setState({ - isNavigatedFromHome: false, - selectedStoreId: null, - }) - }) - - it('never renders a combo-only SKU', async () => { - await renderLoadedHome() - - expect(screen.queryByTestId(`product-item-${COMBO_ONLY_ID}`)).toBeNull() - - for (const tag of tags) { - expandTag(tag.id) - expect(screen.queryByTestId(`tag-product-${COMBO_ONLY_ID}`)).toBeNull() - } - }) - - it('renders every store with the leading "The " stripped', async () => { - await renderLoadedHome() - - for (const store of storesResponse.stores) { - const row = screen.getByTestId(`store-item-${store.id}`) - expect( - within(row).getByText(store.name.replace(/^The\s+/i, '')) - ).toBeVisible() - } - }) - - it('strikes through the market price when it is above the selling price', async () => { - await renderLoadedHome() - - const target = productWithMarkup() - expandTag(target.tagId) - - const card = screen.getByTestId(`tag-product-${target.productId}`) - expect(within(card).getByText(`₹${target.marketPrice}`)).toBeVisible() - }) - - it('shows a fallback when a product image fails to load', async () => { - await renderLoadedHome() - - const target = firstInStockInTag() - expandTag(target.tagId) - const card = screen.getByTestId(`tag-product-${target.productId}`) - - fireEvent(within(card).UNSAFE_getByType(Image), 'error') - - expect(within(card).getByText('Image failed to load')).toBeVisible() - }) -}) diff --git a/apps/user-ui/tests/home-page/home-floating-cart-bar.test.tsx b/apps/user-ui/tests/home-page/home-floating-cart-bar.test.tsx deleted file mode 100644 index 62f0469..0000000 --- a/apps/user-ui/tests/home-page/home-floating-cart-bar.test.tsx +++ /dev/null @@ -1,203 +0,0 @@ -/** - * FloatingCartBar — the home page's cart bar and its "Your Cart" dialog. - * - * Products are pinned (see PINNED_PRODUCTS) so every money and slot expectation - * is an exact number rather than a computed one: - * - they all live in the "Chicken" tag, so a single expanded grid holds them, - * - their prices come from mock-availability-response.json, - * - the free-delivery threshold is consts.freeDeliveryThreshold (249). - * - * The bar counts cart LINES (itemCount = cartItems.length), so one product at - * quantity 2 still reads "1 Item". - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import { fireEvent, screen, waitFor, within } from '@testing-library/react-native' -import { StorageServiceCasual } from 'common-ui/src/services/StorageServiceCasual' -import dayjs from 'dayjs' - -import { - ESSENTIAL_CONSTS_DATA, - mockSlots, - outOfStockIds, - resetStorage, - setupApiMocks, -} from '../mocks/api' -import { useNavigationStore } from '@/src/store/navigationStore' -import { addToCartFromTagGrid, expandTag, renderLoadedHome } from './render' - -const FREE_DELIVERY_THRESHOLD = ESSENTIAL_CONSTS_DATA.freeDeliveryThreshold - -/** - * The products these tests add, with their exact fixture prices. - * 215 + 129 = 344 crosses the 249 threshold; 215 alone leaves a 34 gap. - */ -const PINNED_PRODUCTS = [ - { id: 2, name: 'Chicken Breast 500 g', price: 215, tagId: 1 }, - { id: 40, name: 'Chicken regular cut Large pieces', price: 129, tagId: 1 }, -] as const - -const [CHICKEN_BREAST, CHICKEN_LARGE_CUT] = PINNED_PRODUCTS - -/** Mirrors formatTimeRange in components/floating-cart-bar.tsx (includes the date). */ -const formatSlotLabel = (deliveryTime: string) => { - const time = dayjs(deliveryTime) - const endTime = time.add(1, 'hour') - const startPeriod = time.format('A') - const endPeriod = endTime.format('A') - - const range = - startPeriod === endPeriod - ? `${time.format('h')}-${endTime.format('h')} ${startPeriod}` - : `${time.format('h:mm')} ${startPeriod} - ${endTime.format('h:mm')} ${endPeriod}` - - return `${time.format('ddd, DD MMM ')}${range}` -} - -/** The slot addToCartFromTagGrid will pick: first in fixture order, freeze ahead. */ -const firstOpenSlotFor = (productId: number) => { - const slot = mockSlots.slots.find( - (s) => - s.products.some((p) => p.id === productId) && - dayjs(s.freezeTime).isAfter(dayjs()) - ) - if (!slot) throw new Error(`[tests] no open slot for product ${productId}`) - return slot -} - -const expandCart = () => { - // The collapsed bar only expands while it has items. - fireEvent.press(screen.getByText(/• \d+ Items?/)) -} - -describe('Floating cart bar', () => { - beforeEach(async () => { - setupApiMocks() - await resetStorage() - useNavigationStore.setState({ - isNavigatedFromHome: false, - selectedStoreId: null, - }) - }) - - it('adds exactly the pinned products and tracks the total and delivery threshold', async () => { - await renderLoadedHome() - - // Guards the pinned prices against a fixture change. - for (const product of PINNED_PRODUCTS) { - expect(outOfStockIds.has(product.id)).toBe(false) - } - - expandTag(CHICKEN_BREAST.tagId) - - addToCartFromTagGrid(CHICKEN_BREAST.id) - await waitFor(() => - expect(screen.getByText(`₹${CHICKEN_BREAST.price} • 1 Item`)).toBeVisible() - ) - expect( - screen.getByText( - new RegExp(`₹${FREE_DELIVERY_THRESHOLD - CHICKEN_BREAST.price} more for`) - ) - ).toBeVisible() - - addToCartFromTagGrid(CHICKEN_LARGE_CUT.id) - - const total = CHICKEN_BREAST.price + CHICKEN_LARGE_CUT.price - await waitFor(() => expect(screen.getByText(`₹${total} • 2 Items`)).toBeVisible()) - expect(screen.getByText(/Free Delivery Unlocked/)).toBeVisible() - expect(screen.queryByText(/more for/)).toBeNull() - }) - - it('places each pinned product in the first open slot it belongs to', async () => { - await renderLoadedHome() - - expandTag(CHICKEN_BREAST.tagId) - addToCartFromTagGrid(CHICKEN_BREAST.id) - - // Wait for the first add to settle, otherwise its dialog cleanup can race - // the second product's dialog and drop it. - await waitFor(() => expect(screen.getByText(/• 1 Item/)).toBeVisible()) - - addToCartFromTagGrid(CHICKEN_LARGE_CUT.id) - await waitFor(() => expect(screen.getByText(/• 2 Items/)).toBeVisible()) - - const slot = firstOpenSlotFor(CHICKEN_BREAST.id) - // Both pinned products resolve to the first open slot in the fixture. - expect(firstOpenSlotFor(CHICKEN_LARGE_CUT.id).id).toBe(slot.id) - - expandCart() - expect(screen.getByText('Your Cart')).toBeVisible() - - // One delivery-slot label per cart line (each row shows its own slot). - expect(screen.getAllByText(formatSlotLabel(slot.deliveryTime))).toHaveLength( - PINNED_PRODUCTS.length - ) - }) - - it('recomputes the total when the quantity changes', async () => { - await renderLoadedHome() - - expandTag(CHICKEN_BREAST.tagId) - addToCartFromTagGrid(CHICKEN_BREAST.id) - await waitFor(() => expect(screen.getByText(/1 Item/)).toBeVisible()) - - // The card stepper reopens the dialog in update mode, preloaded with 1. - fireEvent.press( - within(screen.getByTestId(`tag-product-${CHICKEN_BREAST.id}`)).getByTestId( - 'mini-quantifier-increment' - ) - ) - expect(screen.getByText('Update Item')).toBeVisible() - expect(screen.getByTestId('quantifier-value')).toHaveTextContent('1') - - fireEvent.press(screen.getByTestId('quantifier-increment')) - expect(screen.getByTestId('quantifier-value')).toHaveTextContent('2') - fireEvent.press(screen.getByTestId('add-to-cart-confirm')) - - // Still one line, but the value is price * 2. - const doubled = CHICKEN_BREAST.price * 2 - await waitFor(() => expect(screen.getByText(`₹${doubled} • 1 Item`)).toBeVisible()) - expect(screen.getByText(/Free Delivery Unlocked/)).toBeVisible() - }) - - it('expands into the cart dialog with the line and the subtotal', async () => { - await renderLoadedHome() - - expandTag(CHICKEN_BREAST.tagId) - addToCartFromTagGrid(CHICKEN_BREAST.id) - await waitFor(() => expect(screen.getByText(/• 1 Item/)).toBeVisible()) - - expandCart() - - expect(screen.getByText('Your Cart')).toBeVisible() - expect(screen.getByText('Subtotal')).toBeVisible() - expect(screen.getAllByText(`₹${CHICKEN_BREAST.price}`).length).toBeGreaterThan(0) - }) - - it('re-slots a stored cart item whose slot no longer exists', async () => { - await StorageServiceCasual.setItem( - 'cart_items', - JSON.stringify([ - { - id: 1, - skuId: CHICKEN_BREAST.id, - quantity: 1, - slotId: 999999, - addedAt: new Date().toISOString(), - }, - ]) - ) - - await renderLoadedHome() - - await waitFor(async () => { - const raw = await StorageServiceCasual.getItem('cart_items') - const items = raw ? JSON.parse(raw) : [] - - expect(items).toHaveLength(1) - expect(items[0].slotId).not.toBe(999999) - expect(mockSlots.slots.some((s) => s.id === items[0].slotId)).toBe(true) - }) - }) -}) diff --git a/apps/user-ui/tests/home-page/home-refresh.test.tsx b/apps/user-ui/tests/home-page/home-refresh.test.tsx deleted file mode 100644 index 6149771..0000000 --- a/apps/user-ui/tests/home-page/home-refresh.test.tsx +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Home page pull-to-refresh. - * - * The page funnels both useManualRefresh and useMarkDataFetchers into - * handleRefresh, which refetches products, slots, stores and essentialConsts. - * tests/setup.ts records those callbacks (tests/mocks/refresh.ts) so a test can - * invoke them directly. - * - * Availability is deliberately NOT asserted: handleRefresh does not refetch it. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import { act, waitFor } from '@testing-library/react-native' - -import { resetStorage, setupApiMocks } from '../mocks/api' -import { refreshHooks, resetRefreshHooks } from '../mocks/refresh' -import { useNavigationStore } from '@/src/store/navigationStore' -import { renderLoadedHome } from './render' - -const countRequests = ( - mock: { mock: { calls: unknown[][] } }, - needle: string -) => mock.mock.calls.filter(([url]) => String(url).includes(needle)).length - -describe('Home page refresh', () => { - beforeEach(async () => { - resetRefreshHooks() - await resetStorage() - useNavigationStore.setState({ - isNavigatedFromHome: false, - selectedStoreId: null, - }) - }) - - const expectRefetchFanOut = async (invoke: () => void) => { - const api = setupApiMocks() - await renderLoadedHome() - - const before = { - products: countRequests(api.axiosGet, 'products.json'), - stores: countRequests(api.axiosGet, 'stores.json'), - slots: countRequests(api.axiosGet, 'slots.json'), - consts: countRequests(api.fetchMock, 'common.essentialConsts'), - } - - expect(before.products).toBeGreaterThan(0) - expect(before.stores).toBeGreaterThan(0) - expect(before.slots).toBeGreaterThan(0) - expect(before.consts).toBeGreaterThan(0) - - await act(async () => { - invoke() - }) - - await waitFor(() => { - expect(countRequests(api.axiosGet, 'products.json')).toBeGreaterThan( - before.products - ) - expect(countRequests(api.axiosGet, 'stores.json')).toBeGreaterThan( - before.stores - ) - expect(countRequests(api.axiosGet, 'slots.json')).toBeGreaterThan( - before.slots - ) - expect(countRequests(api.fetchMock, 'common.essentialConsts')).toBeGreaterThan( - before.consts - ) - }) - } - - it('refetches every data source through useManualRefresh', async () => { - await expectRefetchFanOut(() => { - expect(typeof refreshHooks.manualRefresh).toBe('function') - refreshHooks.manualRefresh?.() - }) - }) - - it('refetches every data source through useMarkDataFetchers', async () => { - await expectRefetchFanOut(() => { - expect(typeof refreshHooks.markDataFetchers).toBe('function') - refreshHooks.markDataFetchers?.() - }) - }) -}) diff --git a/apps/user-ui/tests/home-page/home-slots.test.tsx b/apps/user-ui/tests/home-page/home-slots.test.tsx deleted file mode 100644 index 7e65b2f..0000000 --- a/apps/user-ui/tests/home-page/home-slots.test.tsx +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Slot card details beyond the ordering coverage in home.test.tsx: the - * CLOSING SOON badge (freeze within 4 hours) and the delivery / order-by labels. - * - * The slot fixture is rebased so the earliest delivery is 2h out; because the - * rebase is uniform, the earliest two slots freeze within 4h and the rest do - * not, giving both sides of the badge rule deterministically. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import { screen, within } from '@testing-library/react-native' -import dayjs from 'dayjs' - -import { resetStorage, setupApiMocks } from '../mocks/api' -import { useNavigationStore } from '@/src/store/navigationStore' -import { renderLoadedHome, upcomingSlots } from './render' - -/** Mirrors formatTimeRange in the page / SlotCard. */ -const formatTimeRange = (deliveryTime: string) => { - const time = dayjs(deliveryTime) - const endTime = time.add(1, 'hour') - const startPeriod = time.format('A') - const endPeriod = endTime.format('A') - - if (startPeriod === endPeriod) { - return `${time.format('h')}-${endTime.format('h')} ${startPeriod}` - } - return `${time.format('h:mm')} ${startPeriod} - ${endTime.format('h:mm')} ${endPeriod}` -} - -describe('Home page slots', () => { - beforeEach(async () => { - setupApiMocks() - await resetStorage() - useNavigationStore.setState({ - isNavigatedFromHome: false, - selectedStoreId: null, - }) - }) - - // The strip renders only the first 5 upcoming slots. - const renderedSlots = () => upcomingSlots().slice(0, 5) - - it('marks only the slots closing within 4 hours', async () => { - await renderLoadedHome() - - const slots = renderedSlots() - expect(slots.length).toBeGreaterThan(0) - - let withBadge = 0 - for (const slot of slots) { - const card = screen.getByTestId(`slot-card-${slot.id}`) - const freezeTime = dayjs(slot.freezeTime) - const closingSoon = - freezeTime.diff(dayjs(), 'hour') < 4 && freezeTime.isAfter(dayjs()) - - expect(within(card).queryByText('CLOSING SOON') !== null).toBe(closingSoon) - if (closingSoon) withBadge += 1 - } - - // Both branches are exercised by the fixture. - expect(withBadge).toBeGreaterThan(0) - expect(withBadge).toBeLessThan(slots.length) - }) - - it('labels each slot with its delivery range and order-by time', async () => { - await renderLoadedHome() - - for (const slot of renderedSlots()) { - const card = screen.getByTestId(`slot-card-${slot.id}`) - - // Delivery range and order-by clock time are each unique within the card. - expect( - within(card).getByText(formatTimeRange(slot.deliveryTime)) - ).toBeVisible() - expect( - within(card).getByText(dayjs(slot.freezeTime).format('h:mm A')) - ).toBeVisible() - - // The date line is shared by "Delivery At" and "Order By", so it appears - // twice when both fall on the same day. - expect( - within(card).getAllByText(dayjs(slot.deliveryTime).format('ddd, MMM DD')) - .length - ).toBeGreaterThan(0) - } - }) - - it('shows how many products each slot holds', async () => { - await renderLoadedHome() - - for (const slot of renderedSlots()) { - const card = screen.getByTestId(`slot-card-${slot.id}`) - expect( - within(card).getByText(`View all ${slot.products.length} items`) - ).toBeVisible() - } - }) -}) diff --git a/apps/user-ui/tests/home-page/home-states.test.tsx b/apps/user-ui/tests/home-page/home-states.test.tsx deleted file mode 100644 index 7adcdd4..0000000 --- a/apps/user-ui/tests/home-page/home-states.test.tsx +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Home page top-level states: loading, error and the two empty states. - * - * These render branches (see app/(drawer)/(tabs)/home/index.tsx) are not hit by - * the happy-path file, so they are covered here with success/failure variants of - * the mocked network layer. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import { EMPTY_PRODUCTS, EMPTY_TAG, resetStorage, setupApiMocks } from '../mocks/api' -import { useNavigationStore } from '@/src/store/navigationStore' -import { renderHome, renderLoadedHome } from './render' - -describe('Home page states', () => { - beforeEach(async () => { - await resetStorage() - useNavigationStore.setState({ - isNavigatedFromHome: false, - selectedStoreId: null, - }) - }) - - it('shows the loading screen while the products request is pending', async () => { - setupApiMocks({ pendingProducts: true }) - renderHome() - - await waitFor(() => { - expect(screen.getByText('Loading products...')).toBeVisible() - }) - }) - - it('shows the products error state when the products request fails', async () => { - setupApiMocks({ failProducts: true }) - renderHome() - - await waitFor(() => { - expect(screen.getByText('Failed to load products')).toBeVisible() - }) - expect(screen.getByText('Oops!')).toBeVisible() - }) - - it('shows the app-settings error state when essentialConsts fails', async () => { - setupApiMocks({ failConsts: true }) - renderHome() - - await waitFor(() => { - expect(screen.getByText('Failed to load app settings')).toBeVisible() - }) - expect(screen.getByText('Oops!')).toBeVisible() - }) - - it('shows the empty state when there are no products', async () => { - setupApiMocks({ products: EMPTY_PRODUCTS }) - renderHome() - - await waitFor(() => { - expect(screen.getByText('No products available')).toBeVisible() - }) - }) - - it('shows the empty-category message for a tag with no products', async () => { - setupApiMocks({ extraTags: [EMPTY_TAG] }) - await renderLoadedHome() - - fireEvent.press(screen.getByTestId(`tag-tab-${EMPTY_TAG.id}`)) - - expect(screen.getByText('No products in this category yet')).toBeVisible() - }) -}) diff --git a/apps/user-ui/tests/home-page/home.test.tsx b/apps/user-ui/tests/home-page/home.test.tsx deleted file mode 100644 index ac7e9c6..0000000 --- a/apps/user-ui/tests/home-page/home.test.tsx +++ /dev/null @@ -1,611 +0,0 @@ -/** - * Integration tests for app/(drawer)/(tabs)/home/index.tsx - * - * API responses are mocked at the network layer: - * - common.essentialConsts -> tests/__fixtures__/essentialConsts.json - * - assets CDN -> tests/mocks/mock-*-response.json - * - * The tree includes CentralStoreInitializer (the real one from app/_layout.tsx) - * so the slot/availability/product stores are populated the same way the app - * populates them. Without it productSlotsMap is empty and the out-of-stock and - * cart paths cannot be exercised. - * - * Runner: `bun run test` (or `bun run test:watch`) from apps/user-ui. - */ - -import React from 'react' -import { QueryClient, QueryClientProvider } from '@tanstack/react-query' -import { - fireEvent, - render, - screen, - waitFor, - within, -} from '@testing-library/react-native' -import { RefreshProvider } from 'common-ui' -import dayjs from 'dayjs' - -// Mocked router: this file renders router consumers without a router. The real -// router is exercised in tests/home-page/navigation.test.tsx instead. -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import Dashboard from '@/app/(drawer)/(tabs)/home/index' -import CentralStoreInitializer from '@/src/components/CentralStoreInitializer' -import { useNavigationStore } from '@/src/store/navigationStore' -import { trpc, trpcClient } from '@/src/trpc-client' -import productsResponse from '../mocks/mock-products-response.json' -import storesResponse from '../mocks/mock-stores-response.json' -import { routerMock } from '../mocks/router' -import { - EXPIRED_DIALOG_SLOT_ID, - EXPIRED_HOME_SLOT_ID, - PRODUCTS_URL, - mockSlots, - outOfStockIds, - resetStorage, - setupApiMocks, -} from '../mocks/api' - -// The tag grid renders at most this many items before its "Show More" button -// expands it (see the products.slice(0, 6) in TagScene). -const TAG_GRID_PREVIEW = 6 -// The main list loads products in pages of 21 (see visibleCount). -const PRODUCT_PAGE_SIZE = 21 - -// useAllProducts drops combo-only SKUs before the page ever sees them. -const products = productsResponse.products.filter((p) => !p.isComboOnly) -const knownProductIds = new Set(products.map((p) => p.id)) -const tags = productsResponse.tags - -// Availability flag OR no upcoming slot; shared with the other test files via -// tests/mocks/api.ts so the expectation has a single definition. -const expectedOutOfStock = outOfStockIds - -/** Products a tag points at that exist in the (combo-filtered) cache. */ -const productIdsForTag = (tag: (typeof tags)[number]) => - tag.productIds.filter((id) => knownProductIds.has(id)) - -/** - * The order the page renders a tag's grid in: the admin-curated order with - * out-of-stock items pushed to the end (see productsByTagId in the page). - */ -const orderedProductIdsForTag = (tag: (typeof tags)[number]) => { - const ids = productIdsForTag(tag) - return [ - ...ids.filter((id) => !expectedOutOfStock.has(id)), - ...ids.filter((id) => expectedOutOfStock.has(id)), - ] -} - -const idFromTestID = (testID: string | undefined, prefix: string) => - Number(String(testID).slice(prefix.length)) - -function renderHome() { - const queryClient = new QueryClient({ - defaultOptions: { queries: { retry: false, gcTime: 0 } }, - }) - - return render( - - - - - - - - - - ) -} - -/** Renders and waits for the first tag tab, i.e. the tag strip is live. */ -async function renderLoadedHome() { - const result = renderHome() - await waitFor(() => { - expect(screen.getByTestId(`tag-tab-${tags[0].id}`)).toBeTruthy() - }) - return result -} - -/** Selects a tag and expands its grid past the preview. */ -function expandTag(tagId: number) { - fireEvent.press(screen.getByTestId(`tag-tab-${tagId}`)) - - const expand = screen.queryByTestId(`tag-show-more-${tagId}`) - if (expand) fireEvent.press(expand) -} - -/** Adds a product from the tag grid: add icon -> first open slot -> confirm. */ -function addToCartFromTagGrid(productId: number) { - fireEvent.press( - within(screen.getByTestId(`tag-product-${productId}`)).getByTestId( - 'add-to-cart-icon' - ) - ) - - const slot = mockSlots.slots.find( - (s) => - s.products.some((p) => p.id === productId) && - dayjs(s.freezeTime).isAfter(dayjs()) - ) - if (!slot) throw new Error(`[tests] no open slot for product ${productId}`) - - fireEvent.press( - screen.getByTestId( - `slot-${dayjs(slot.deliveryTime).format('YYYY-MM-DD-HH-mm')}` - ) - ) - fireEvent.press(screen.getByTestId('add-to-cart-confirm')) -} - -// Mirrors the backend (scaffoldSlotsWithProducts): a slot is offerable only -// while both its freeze and delivery times are in the future. -const isUpcomingSlot = (slot: { deliveryTime: string; freezeTime: string }) => - dayjs(slot.deliveryTime).isAfter(dayjs()) && dayjs(slot.freezeTime).isAfter(dayjs()) - -describe('Home page', () => { - let api: ReturnType - - beforeEach(async () => { - api = setupApiMocks() - await resetStorage() - // zustand stores are module singletons and are not covered by clearMocks. - useNavigationStore.setState({ - isNavigatedFromHome: false, - selectedStoreId: null, - }) - }) - - it('requests the products cache url derived from common.essentialConsts', async () => { - renderHome() - - await waitFor(() => { - expect( - api.fetchMock.mock.calls.some(([url]) => - String(url).includes('common.essentialConsts') - ) - ).toBe(true) - }) - - await waitFor(() => { - expect(api.axiosGet).toHaveBeenCalledWith(PRODUCTS_URL) - }) - }) - - it('shows a tab for every tag', async () => { - await renderLoadedHome() - - for (const tag of tags) { - const tab = screen.getByTestId(`tag-tab-${tag.id}`) - expect(within(tab).getByText(tag.tagName)).toBeVisible() - } - }) - - it('shows every product of every tag, expanding each grid once', async () => { - await renderLoadedHome() - - for (const tag of tags) { - fireEvent.press(screen.getByTestId(`tag-tab-${tag.id}`)) - - const expected = orderedProductIdsForTag(tag) - expect(expected.length).toBeGreaterThan(0) - - for (const id of expected.slice(0, TAG_GRID_PREVIEW)) { - expect(screen.getByTestId(`tag-product-${id}`)).toBeVisible() - } - - if (expected.length <= TAG_GRID_PREVIEW) continue - - // Items past the preview are withheld until the grid is expanded. - expect( - screen.queryByTestId(`tag-product-${expected[TAG_GRID_PREVIEW]}`) - ).toBeNull() - - fireEvent.press(screen.getByTestId(`tag-show-more-${tag.id}`)) - - for (const id of expected) { - expect(screen.getByTestId(`tag-product-${id}`)).toBeVisible() - } - } - }) - - it('renders a tag with its out-of-stock items last', async () => { - await renderLoadedHome() - - let tagsWithBothGroups = 0 - - for (const tag of tags) { - expandTag(tag.id) - - const rendered = screen - .getAllByTestId(/^tag-product-/) - .map((node) => idFromTestID(node.props.testID, 'tag-product-')) - - const declared = productIdsForTag(tag) - expect(rendered.length).toBe(declared.length) - - const inStockRendered = rendered.filter( - (id) => !expectedOutOfStock.has(id) - ) - const outOfStockRendered = rendered.filter((id) => - expectedOutOfStock.has(id) - ) - - const declaredInStock = declared.filter( - (id) => !expectedOutOfStock.has(id) - ) - const declaredOutOfStock = declared.filter((id) => - expectedOutOfStock.has(id) - ) - - if (declaredInStock.length > 0 && declaredOutOfStock.length > 0) { - tagsWithBothGroups += 1 - } - - // No in-stock item may appear after an out-of-stock item. - const firstOutOfStock = rendered.findIndex((id) => - expectedOutOfStock.has(id) - ) - if (firstOutOfStock !== -1) { - expect( - rendered.slice(firstOutOfStock).every((id) => expectedOutOfStock.has(id)) - ).toBe(true) - } - - // Within each group the admin-curated order is preserved. - expect(inStockRendered).toEqual(declaredInStock) - expect(outOfStockRendered).toEqual(declaredOutOfStock) - } - - // Guarantees the ordering property above was actually exercised. - expect(tagsWithBothGroups).toBeGreaterThan(0) - }) - - it('shows the upcoming slots in delivery order', async () => { - await renderLoadedHome() - - const expected = mockSlots.slots - .filter(isUpcomingSlot) - .sort((a, b) => { - const byDelivery = dayjs(a.deliveryTime).diff(dayjs(b.deliveryTime)) - return byDelivery !== 0 - ? byDelivery - : dayjs(a.freezeTime).diff(dayjs(b.freezeTime)) - }) - - // The section only renders the first 5 of the upcoming slots. - expect(expected.length).toBeGreaterThan(5) - - await waitFor(() => { - expect(screen.getAllByTestId(/^slot-card-/).length).toBeGreaterThan(0) - }) - - const rendered = screen - .getAllByTestId(/^slot-card-/) - .map((node) => idFromTestID(node.props.testID, 'slot-card-')) - expect(rendered).toEqual(expected.slice(0, 5).map((s) => s.id)) - - for (const slot of expected.slice(5)) { - expect(screen.queryByTestId(`slot-card-${slot.id}`)).toBeNull() - } - }) - - it('hides a slot whose freeze time has passed', async () => { - await renderLoadedHome() - - const upcoming = mockSlots.slots.filter(isUpcomingSlot) - const hidden = mockSlots.slots.filter((slot) => !isUpcomingSlot(slot)) - expect(hidden.map((slot) => slot.id)).toContain(EXPIRED_HOME_SLOT_ID) - - // Sanity: the hidden slot really is a future delivery, so only its freeze - // time can be responsible for hiding it. - const homeSlot = mockSlots.slots.find((s) => s.id === EXPIRED_HOME_SLOT_ID)! - expect(dayjs(homeSlot.deliveryTime).isAfter(dayjs())).toBe(true) - expect(dayjs(homeSlot.freezeTime).isAfter(dayjs())).toBe(false) - - await waitFor(() => { - expect(screen.getAllByTestId(/^slot-card-/).length).toBeGreaterThan(0) - }) - - expect(screen.queryByTestId(`slot-card-${EXPIRED_HOME_SLOT_ID}`)).toBeNull() - - const rendered = screen - .getAllByTestId(/^slot-card-/) - .map((node) => idFromTestID(node.props.testID, 'slot-card-')) - - expect(rendered).not.toContain(EXPIRED_HOME_SLOT_ID) - expect(rendered).toEqual(upcoming.slice(0, 5).map((s) => s.id)) - }) - - it('hides a slot whose freeze time has passed in the add-to-cart dialog', async () => { - await renderLoadedHome() - - const [productId] = mockSlots.slots.find( - (s) => s.id === EXPIRED_DIALOG_SLOT_ID - )!.products.map((p) => p.id) - - const dialogSlot = mockSlots.slots.find( - (s) => s.id === EXPIRED_DIALOG_SLOT_ID - )! - expect(dayjs(dialogSlot.deliveryTime).isAfter(dayjs())).toBe(true) - expect(dayjs(dialogSlot.freezeTime).isAfter(dayjs())).toBe(false) - - const tag = tags.find((t) => productIdsForTag(t).includes(productId)) - expect(tag).toBeDefined() - - expandTag(tag!.id) - fireEvent.press( - within(screen.getByTestId(`tag-product-${productId}`)).getByTestId( - 'add-to-cart-icon' - ) - ) - - // The expired slot's option is not offered... - expect( - screen.queryByTestId( - `slot-${dayjs(dialogSlot.deliveryTime).format('YYYY-MM-DD-HH-mm')}` - ) - ).toBeNull() - - // ...while a real, still-open slot is, so the dialog remains usable. - const openSlot = mockSlots.slots - .filter( - (s) => - s.id !== EXPIRED_DIALOG_SLOT_ID && - s.products.some((p) => p.id === productId) - ) - .find((s) => dayjs(s.freezeTime).isAfter(dayjs())) - expect(openSlot).toBeDefined() - - fireEvent.press( - screen.getByTestId( - `slot-${dayjs(openSlot!.deliveryTime).format('YYYY-MM-DD-HH-mm')}` - ) - ) - fireEvent.press(screen.getByTestId('add-to-cart-confirm')) - - await waitFor(() => { - expect(screen.getByText(/1 Item/)).toBeVisible() - }) - }) - - it('shows the load-all button until every product is loaded', async () => { - await renderLoadedHome() - - expect(screen.getByTestId('products-show-more')).toBeVisible() - - let presses = 0 - while (screen.queryByTestId('products-show-more')) { - fireEvent.press(screen.getByTestId('products-show-more')) - presses += 1 - if (presses > products.length) { - throw new Error('products-show-more never disappeared') - } - } - - expect(screen.queryByTestId('products-show-more')).toBeNull() - expect(presses).toBe( - Math.ceil((products.length - PRODUCT_PAGE_SIZE) / PRODUCT_PAGE_SIZE) - ) - }) - - it('marks exactly the unavailable products out of stock in every tag', async () => { - await renderLoadedHome() - - for (const tag of tags) { - expandTag(tag.id) - - const ids = productIdsForTag(tag) - expect(ids.length).toBeGreaterThan(0) - - for (const id of ids) { - const card = screen.getByTestId(`tag-product-${id}`) - const badge = within(card).queryByTestId('out-of-stock-badge') - - if (expectedOutOfStock.has(id)) { - expect(badge).not.toBeNull() - } else { - expect(badge).toBeNull() - } - } - } - }) - - it('lists the main product list with unavailable items last', async () => { - await renderLoadedHome() - - // displayedProducts keeps cache order within each group and only moves - // unavailable items to the end, so this is the expected render order. - const expectedOrder = [ - ...products.filter((p) => !expectedOutOfStock.has(p.id)).map((p) => p.id), - ...products.filter((p) => expectedOutOfStock.has(p.id)).map((p) => p.id), - ] - - const rendered = screen - .getAllByTestId(/^product-item-/) - .map((node) => idFromTestID(node.props.testID, 'product-item-')) - - expect(rendered.length).toBeGreaterThan(0) - - // FlatList virtualizes, so only a head of the list is mounted. Whatever is - // mounted must be that head, in that order. - expect(rendered).toEqual(expectedOrder.slice(0, rendered.length)) - - // A missing sort would put an unavailable product at the very front. - expect(rendered.some((id) => expectedOutOfStock.has(id))).toBe(false) - expect(expectedOutOfStock.size).toBeGreaterThan(0) - expect(expectedOutOfStock.has(products[0].id)).toBe(true) - }) - - // The main list cannot verify badges for unavailable products: they sort last - // and FlatList virtualizes, so those rows never mount. The tag grids carry - // that check; the ordering itself is covered by the test above. - - it('adds items to the cart', async () => { - await renderLoadedHome() - - expect(screen.getByText('No Items In Cart')).toBeVisible() - expect(screen.getByTestId('go-to-cart')).toBeVisible() - - const tag = tags.find( - (t) => productIdsForTag(t).filter((id) => !expectedOutOfStock.has(id)).length >= 2 - ) - expect(tag).toBeDefined() - - const inStock = productIdsForTag(tag!) - .filter((id) => !expectedOutOfStock.has(id)) - .slice(0, 2) - - expandTag(tag!.id) - - for (const [index, id] of inStock.entries()) { - addToCartFromTagGrid(id) - - const count = index + 1 - await waitFor(() => { - expect( - screen.getByText(new RegExp(`${count} ${count === 1 ? 'Item' : 'Items'}`)) - ).toBeVisible() - }) - } - - // The first product's card now shows a quantity stepper, not the add icon. - expect( - within(screen.getByTestId(`tag-product-${inStock[0]}`)).queryByTestId( - 'add-to-cart-icon' - ) - ).toBeNull() - }) - - it('updates and removes a cart item through the card quantity stepper', async () => { - await renderLoadedHome() - - const tag = tags.find( - (t) => productIdsForTag(t).filter((id) => !expectedOutOfStock.has(id)).length >= 1 - ) - expect(tag).toBeDefined() - - const [productId] = productIdsForTag(tag!).filter( - (id) => !expectedOutOfStock.has(id) - ) - expandTag(tag!.id) - - const card = () => screen.getByTestId(`tag-product-${productId}`) - - addToCartFromTagGrid(productId) - await waitFor(() => expect(screen.getByText(/1 Item/)).toBeVisible()) - expect(within(card()).getByTestId('mini-quantifier-value')).toHaveTextContent('1') - - // Pressing increment on the card does not change the cart inline: the card - // opens the dialog in update mode, preloaded with the current quantity (the - // pressed delta is discarded by ProductCard). - fireEvent.press(within(card()).getByTestId('mini-quantifier-increment')) - expect(screen.getByText('Update Item')).toBeVisible() - expect(screen.getByTestId('quantifier-value')).toHaveTextContent('1') - - // The dialog is where the quantity actually changes. - fireEvent.press(screen.getByTestId('quantifier-increment')) - expect(screen.getByTestId('quantifier-value')).toHaveTextContent('2') - fireEvent.press(screen.getByTestId('add-to-cart-confirm')) - - // The floating bar counts cart lines, not units, so a single product at - // quantity 2 still reads "1 Item" - assert the per-card quantity instead. - await waitFor(() => - expect(within(card()).getByTestId('mini-quantifier-value')).toHaveTextContent('2') - ) - expect(screen.getByText(/1 Item/)).toBeVisible() - - // Decrementing on the card reopens the update dialog; removal happens via - // the dialog's delete button, which drops the item back to zero. - fireEvent.press(within(card()).getByTestId('mini-quantifier-decrement')) - expect(screen.getByText('Update Item')).toBeVisible() - fireEvent.press(screen.getByTestId('remove-from-cart')) - - await waitFor(() => expect(screen.getByText('No Items In Cart')).toBeVisible()) - expect(within(card()).getByTestId('add-to-cart-icon')).toBeVisible() - }) - - it('shows the store list and navigates when a store is tapped', async () => { - await renderLoadedHome() - - const store = storesResponse.stores[0] - const row = screen.getByTestId(`store-item-${store.id}`) - expect( - within(row).getByText(store.name.replace(/^The\s+/i, '')) - ).toBeVisible() - - fireEvent.press(row) - - expect(routerMock.push).toHaveBeenCalledWith('/(drawer)/(tabs)/stores') - - const navigation = useNavigationStore.getState() - expect(navigation.isNavigatedFromHome).toBe(true) - expect(navigation.selectedStoreId).toBe(store.id) - }) - - it('opens the product detail page from a tag grid card', async () => { - await renderLoadedHome() - - const tag = tags[0] - const [productId] = productIdsForTag(tag) - fireEvent.press(screen.getByTestId(`tag-tab-${tag.id}`)) - - fireEvent.press( - within(screen.getByTestId(`tag-product-${productId}`)).getByTestId( - 'product-card' - ) - ) - - expect(routerMock.push).toHaveBeenCalledWith( - `/(drawer)/(tabs)/home/product-detail/${productId}` - ) - }) - - it('opens the product detail page from the main list', async () => { - await renderLoadedHome() - - const [productId] = products.filter( - (p) => !expectedOutOfStock.has(p.id) - ).map((p) => p.id) - - fireEvent.press( - within(screen.getByTestId(`product-item-${productId}`)).getByTestId( - 'product-card' - ) - ) - - expect(routerMock.push).toHaveBeenCalledWith( - `/(drawer)/(tabs)/home/product-detail/${productId}` - ) - }) - - it('opens the slot detail page when a slot card is tapped', async () => { - await renderLoadedHome() - - const slot = mockSlots.slots.filter(isUpcomingSlot)[0] - - fireEvent.press(screen.getByTestId(`slot-card-${slot.id}`)) - - expect(routerMock.push).toHaveBeenCalledWith( - `/(drawer)/(tabs)/home/slot-view?slotId=${slot.id}` - ) - }) - - it('opens search from the search bar', async () => { - await renderLoadedHome() - - fireEvent.press(screen.getByTestId('home-search')) - - expect(routerMock.push).toHaveBeenCalledWith( - '/(drawer)/(tabs)/home/search-results' - ) - }) - - it('opens the cart from the floating bar', async () => { - await renderLoadedHome() - - fireEvent.press(screen.getByTestId('go-to-cart')) - - expect(routerMock.push).toHaveBeenCalledWith('/(drawer)/(tabs)/home/cart') - }) -}) diff --git a/apps/user-ui/tests/home-page/navigation.test.tsx b/apps/user-ui/tests/home-page/navigation.test.tsx deleted file mode 100644 index 3f72c2d..0000000 --- a/apps/user-ui/tests/home-page/navigation.test.tsx +++ /dev/null @@ -1,139 +0,0 @@ -/** - * Navigation tests for the home page using the REAL expo-router. - * - * Unlike tests/home.test.tsx (which mocks the router and asserts the intended - * push target), this file renders the actual router with a route map mirroring - * the app's group structure. That proves the pushed URLs resolve to a route and - * that params arrive. - * - * Route keys mirror app/ (see the directory listing); renderRouter strips the - * group segments, so '(drawer)/(tabs)/home/index' is reachable at '/home'. - * - * expo-router is deliberately not mocked in tests/setup.ts - that is what makes - * this file possible. - */ - -import React from 'react' -import { QueryClient, QueryClientProvider } from '@tanstack/react-query' -import { fireEvent, within } from '@testing-library/react-native' -import { renderRouter, screen } from 'expo-router/testing-library' -import { useLocalSearchParams } from 'expo-router' -import { MyText, RefreshProvider } from 'common-ui' - -import Dashboard from '@/app/(drawer)/(tabs)/home/index' -import CentralStoreInitializer from '@/src/components/CentralStoreInitializer' -import { useNavigationStore } from '@/src/store/navigationStore' -import { trpc, trpcClient } from '@/src/trpc-client' -import { mockSlots, outOfStockIds, resetStorage, setupApiMocks } from '../mocks/api' -import productsResponse from '../mocks/mock-products-response.json' -import storesResponse from '../mocks/mock-stores-response.json' - -const products = productsResponse.products.filter((p) => !p.isComboOnly) - -function Providers({ children }: { children?: React.ReactNode }) { - const queryClient = React.useMemo( - () => - new QueryClient({ - defaultOptions: { queries: { retry: false, gcTime: 0 } }, - }), - [] - ) - - return ( - - - - {children} - - - - ) -} - -const HomeRoute = () => ( - - - -) - -const DetailStub = () => { - const { id } = useLocalSearchParams<{ id: string }>() - return {String(id)} -} - -const SlotViewStub = () => { - const { slotId } = useLocalSearchParams<{ slotId: string }>() - return {String(slotId)} -} - -const StoresStub = () => stores -const SearchStub = () => search -const CartStub = () => cart - -const ROUTES = { - '(drawer)/(tabs)/home/index': HomeRoute, - '(drawer)/(tabs)/home/product-detail/[id]': DetailStub, - '(drawer)/(tabs)/home/slot-view/index': SlotViewStub, - '(drawer)/(tabs)/home/search-results/index': SearchStub, - '(drawer)/(tabs)/home/cart': CartStub, - '(drawer)/(tabs)/stores/index': StoresStub, -} - -async function renderHomeRoute() { - const result = renderRouter(ROUTES, { initialUrl: '/home' }) - - await screen.findByTestId(`tag-tab-${productsResponse.tags[0].id}`) - - return result -} - -describe('Home navigation (real router)', () => { - beforeEach(async () => { - setupApiMocks() - await resetStorage() - useNavigationStore.setState({ - isNavigatedFromHome: false, - selectedStoreId: null, - }) - }) - - it('routes to the product detail screen carrying the id', async () => { - const nav = await renderHomeRoute() - - // Must be in stock: unavailable products sort last and are not mounted. - const productId = products.find((p) => !outOfStockIds.has(p.id))!.id - const card = await screen.findByTestId(`product-item-${productId}`) - - fireEvent.press(within(card).getByTestId('product-card')) - - expect(nav.getPathname()).toBe(`/home/product-detail/${productId}`) - expect(screen.getByTestId('product-detail-screen')).toHaveTextContent( - String(productId) - ) - }) - - it('routes to the slot view carrying the slotId', async () => { - const nav = await renderHomeRoute() - - const slot = mockSlots.slots.find( - (s) => new Date(s.freezeTime).getTime() > Date.now() - )! - - fireEvent.press(screen.getByTestId(`slot-card-${slot.id}`)) - - expect(nav.getPathname()).toBe('/home/slot-view') - expect(nav.getSearchParams()).toMatchObject({ slotId: String(slot.id) }) - expect(screen.getByTestId('slot-view-screen')).toHaveTextContent( - String(slot.id) - ) - }) - - it('routes to the stores screen', async () => { - const nav = await renderHomeRoute() - - fireEvent.press(screen.getByTestId(`store-item-${storesResponse.stores[0].id}`)) - - expect(nav.getPathname()).toBe('/stores') - expect(screen.getByTestId('stores-screen')).toBeVisible() - }) -}) diff --git a/apps/user-ui/tests/home-page/next-order-glimpse.test.tsx b/apps/user-ui/tests/home-page/next-order-glimpse.test.tsx deleted file mode 100644 index 2d47ef8..0000000 --- a/apps/user-ui/tests/home-page/next-order-glimpse.test.tsx +++ /dev/null @@ -1,133 +0,0 @@ -/** - * NextOrderGlimpse — the "Upcoming Order" preview rendered by the home page. - * - * It returns null unless useUserDetails() is set, so these tests use the - * overridable auth mock (tests/mocks/auth.ts) plus a mocked user.order.getOrders - * response (tRPC over fetch, handled in tests/mocks/api.ts). - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import { resetStorage, setupApiMocks } from '../mocks/api' -import { authMock, resetAuthMock } from '../mocks/auth' -import { routerMock } from '../mocks/router' -import { useNavigationStore } from '@/src/store/navigationStore' -import { renderLoadedHome, tags } from './render' - -const countRequests = ( - mock: { mock: { calls: unknown[][] } }, - needle: string -) => mock.mock.calls.filter(([url]) => String(url).includes(needle)).length - -const baseOrder = (over: Record = {}) => ({ - id: 1, - orderId: 'ORD-1001', - orderDate: '2026-09-25T10:00:00.000Z', - deliveryStatus: 'pending', - orderStatus: 'confirmed', - deliveryDate: '2026-09-26T10:00:00.000Z', - cancelReason: null, - totalAmount: 500, - deliveryCharge: 0, - userNotes: null, - isFlashDelivery: false, - createdAt: '2026-09-25T10:00:00.000Z', - items: [ - { - productName: 'Chicken Breast 500 g', - quantity: 1, - unitNotation: '500g', - price: 200, - discountedPrice: 200, - amount: 200, - image: null, - }, - { - productName: 'Chicken Liver', - quantity: 1, - unitNotation: '1kg', - price: 300, - discountedPrice: 300, - amount: 300, - image: null, - }, - ], - ...over, -}) - -describe('NextOrderGlimpse', () => { - beforeEach(async () => { - resetAuthMock() - await resetStorage() - useNavigationStore.setState({ - isNavigatedFromHome: false, - selectedStoreId: null, - }) - }) - - afterEach(() => resetAuthMock()) - - it('renders nothing and never requests orders when signed out', async () => { - const api = setupApiMocks({ orders: [baseOrder()] }) - await renderLoadedHome() - - expect(screen.queryByText('Upcoming Order')).toBeNull() - expect(countRequests(api.fetchMock, 'user.order.getOrders')).toBe(0) - }) - - it('previews an upcoming order', async () => { - authMock.userDetails = { id: 1, name: 'Test User' } - setupApiMocks({ orders: [baseOrder()] }) - await renderLoadedHome() - - await waitFor(() => expect(screen.getByText('Upcoming Order')).toBeVisible()) - - expect(screen.getByText('#ORD-1001')).toBeVisible() - expect(screen.getByText('2 items • ₹500')).toBeVisible() - // The status pill is hidden for Confirmed/Packaged; the tracker shows the stage. - expect(screen.getByTestId('order-status-tracker')).toBeVisible() - expect(screen.getByText('Placed')).toBeVisible() - expect(screen.queryByText('Confirmed')).toBeNull() - }) - - it('flags a flash order', async () => { - authMock.userDetails = { id: 1 } - setupApiMocks({ orders: [baseOrder({ isFlashDelivery: true })] }) - await renderLoadedHome() - - await waitFor(() => expect(screen.getByText('FLASH')).toBeVisible()) - expect(screen.getByText('30-Min')).toBeVisible() - expect(screen.getByText('Delivery')).toBeVisible() - }) - - it('ignores cancelled and completed orders', async () => { - authMock.userDetails = { id: 1 } - const api = setupApiMocks({ - orders: [ - baseOrder({ orderStatus: 'cancelled' }), - baseOrder({ id: 2, orderId: 'ORD-1002', deliveryStatus: 'success' }), - ], - }) - await renderLoadedHome() - - // Let the orders query resolve before asserting the empty result. - await waitFor(() => - expect(countRequests(api.fetchMock, 'user.order.getOrders')).toBeGreaterThan(0) - ) - expect(screen.getByTestId(`tag-tab-${tags[0].id}`)).toBeVisible() - expect(screen.queryByText('Upcoming Order')).toBeNull() - }) - - it('routes to my-orders when a card is tapped', async () => { - authMock.userDetails = { id: 1 } - setupApiMocks({ orders: [baseOrder()] }) - await renderLoadedHome() - - await waitFor(() => expect(screen.getByText('#ORD-1001')).toBeVisible()) - fireEvent.press(screen.getByText('#ORD-1001')) - - expect(routerMock.replace).toHaveBeenCalledWith('/(drawer)/(tabs)/me') - }) -}) diff --git a/apps/user-ui/tests/home-page/render.tsx b/apps/user-ui/tests/home-page/render.tsx deleted file mode 100644 index 052d229..0000000 --- a/apps/user-ui/tests/home-page/render.tsx +++ /dev/null @@ -1,126 +0,0 @@ -/** - * Shared render helpers + expectations for the mocked-router home-page tests. - * - * Unlike tests/home-page/navigation.test.tsx (which drives the real router), - * every file that imports this must also declare the mocked router itself: - * - * jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - * - * The provider stack mirrors app/_layout.tsx: CentralStoreInitializer populates - * the slot/availability/product stores the same way the app does, so - * productSlotsMap is non-empty and the out-of-stock / add-to-cart paths work. - */ - -import React from 'react' -import { - fireEvent, - render, - screen, - waitFor, - within, -} from '@testing-library/react-native' -import dayjs from 'dayjs' - -import Dashboard from '@/app/(drawer)/(tabs)/home/index' -import availability from '../mocks/mock-availability-response.json' -import productsResponse from '../mocks/mock-products-response.json' -import { mockSlots } from '../mocks/api' -// The provider stack moved to tests/helpers/render.tsx; re-exported so the -// home-page tests keep importing everything from './render'. -import { Providers } from '../helpers/render' - -export { Providers } - -/** Products the page can show: useAllProducts drops combo-only SKUs. */ -export const products = productsResponse.products.filter((p) => !p.isComboOnly) -export const tags = productsResponse.tags -export const knownProductIds = new Set(products.map((p) => p.id)) - -/** price/isFlashAvailable as the app sees them (from the availability cache). */ -export const priceById = new Map( - availability.availability.map((a) => [a.id, Number(a.price)]) -) -export const flashAvailableById = new Map( - availability.availability.map((a) => [a.id, a.isFlashAvailable]) -) -export const marketPriceById = new Map( - availability.availability.map((a) => [ - a.id, - a.marketPrice == null ? null : Number(a.marketPrice), - ]) -) - -/** Mirrors the backend: a slot is offerable only while both times are future. */ -export const isUpcomingSlot = (slot: { - deliveryTime: string - freezeTime: string -}) => - dayjs(slot.deliveryTime).isAfter(dayjs()) && - dayjs(slot.freezeTime).isAfter(dayjs()) - -/** Upcoming slots in the order the home page renders them (delivery asc). */ -export const upcomingSlots = () => - mockSlots.slots.filter(isUpcomingSlot).sort((a, b) => { - const byDelivery = dayjs(a.deliveryTime).diff(dayjs(b.deliveryTime)) - return byDelivery !== 0 - ? byDelivery - : dayjs(a.freezeTime).diff(dayjs(b.freezeTime)) - }) - -/** Products a tag points at that exist in the (combo-filtered) cache. */ -export const productIdsForTag = (tag: { productIds: number[] }) => - tag.productIds.filter((id) => knownProductIds.has(id)) - -export function renderHome() { - return render( - - - - ) -} - -/** Renders and waits for the first tag tab and the slot strip to be live. */ -export async function renderLoadedHome() { - const result = renderHome() - await waitFor(() => { - expect(screen.getByTestId(`tag-tab-${tags[0].id}`)).toBeTruthy() - }) - await waitFor(() => { - expect(screen.getAllByTestId(/^slot-card-/).length).toBeGreaterThan(0) - }) - return result -} - -/** Selects a tag and expands its grid past the 6-item preview. */ -export function expandTag(tagId: number) { - fireEvent.press(screen.getByTestId(`tag-tab-${tagId}`)) - - const expand = screen.queryByTestId(`tag-show-more-${tagId}`) - if (expand) fireEvent.press(expand) -} - -/** - * Adds a product from the tag grid: add icon -> first open slot -> confirm. - * The dialog only offers slots for the product whose freezeTime is still ahead. - */ -export function addToCartFromTagGrid(productId: number) { - fireEvent.press( - within(screen.getByTestId(`tag-product-${productId}`)).getByTestId( - 'add-to-cart-icon' - ) - ) - - const slot = mockSlots.slots.find( - (s) => - s.products.some((p) => p.id === productId) && - dayjs(s.freezeTime).isAfter(dayjs()) - ) - if (!slot) throw new Error(`[tests] no open slot for product ${productId}`) - - fireEvent.press( - screen.getByTestId( - `slot-${dayjs(slot.deliveryTime).format('YYYY-MM-DD-HH-mm')}` - ) - ) - fireEvent.press(screen.getByTestId('add-to-cart-confirm')) -} diff --git a/apps/user-ui/tests/hooks/cart-query-hooks.test.tsx b/apps/user-ui/tests/hooks/cart-query-hooks.test.tsx deleted file mode 100644 index 9156040..0000000 --- a/apps/user-ui/tests/hooks/cart-query-hooks.test.tsx +++ /dev/null @@ -1,169 +0,0 @@ -/** - * hooks/cart-query-hooks.tsx — the local (AsyncStorage-backed) cart. - * - * useGetCart only builds items when productsById/productSlotsMap are populated, - * so each test seeds the central stores first. - */ - -import React from 'react' -import { QueryClient, QueryClientProvider } from '@tanstack/react-query' -import { act, renderHook, waitFor } from '@testing-library/react-native' -import { StorageServiceCasual } from 'common-ui/src/services/StorageServiceCasual' - -import { - clearLocalCart, - useAddToCart, - useGetCart, - useRemoveFromCart, - useUpdateCartItem, -} from '@/hooks/cart-query-hooks' -import { resetStorage } from '../mocks/api' -import { useCentralProductStore } from '@/src/store/centralProductStore' -import { useCentralSlotStore } from '@/src/store/centralSlotStore' - -const PRODUCT_ID = 2 - -const seedCentralStores = () => { - useCentralProductStore.setState({ - products: [], - productsById: { - [PRODUCT_ID]: { - id: PRODUCT_ID, - name: 'Chicken Breast 500 g', - price: 215, - marketPrice: 220, - flashPrice: 199, - images: [], - incrementStep: 1, - productQuantity: 1, - unitNotation: '0.5Kg', - }, - } as never, - }) - - useCentralSlotStore.setState({ - productSlotsMap: { - [PRODUCT_ID]: { - slots: [{ id: 1849 }], - isOutOfStock: false, - isFlashAvailable: true, - isSuspended: false, - }, - } as never, - }) -} - -const readCart = async (key: string) => { - const raw = await StorageServiceCasual.getItem(key) - return raw ? JSON.parse(raw) : [] -} - -const wrapper = ({ children }: { children: React.ReactNode }) => { - const client = new QueryClient({ - defaultOptions: { queries: { retry: false, gcTime: 0 } }, - }) - return {children} -} - -describe('cart-query-hooks', () => { - beforeEach(async () => { - await resetStorage() - seedCentralStores() - }) - - it('adds an item to the regular cart', async () => { - const { result } = renderHook(() => useAddToCart({}, 'regular'), { wrapper }) - - await act(async () => { - result.current.addToCart(PRODUCT_ID, 1, 1849) - }) - - await waitFor(async () => { - const items = await readCart('cart_items') - expect(items).toHaveLength(1) - expect(items[0]).toMatchObject({ skuId: PRODUCT_ID, quantity: 1, slotId: 1849 }) - }) - }) - - it('keeps the flash cart separate from the regular cart', async () => { - const { result } = renderHook(() => useAddToCart({}, 'flash'), { wrapper }) - - await act(async () => { - result.current.addToCart(PRODUCT_ID, 1, 0) - }) - - expect(await readCart('flash_cart_items')).toHaveLength(1) - expect(await readCart('cart_items')).toHaveLength(0) - }) - - it('increments the quantity of an item already in the cart', async () => { - const { result } = renderHook(() => useAddToCart({}, 'regular'), { wrapper }) - - // Separate ticks: concurrent adds both read the pre-add cart. - await act(async () => { - result.current.addToCart(PRODUCT_ID, 1, 1849) - }) - await act(async () => { - result.current.addToCart(PRODUCT_ID, 2, 1849) - }) - - await waitFor(async () => { - const items = await readCart('cart_items') - expect(items).toHaveLength(1) - expect(items[0].quantity).toBe(3) - }) - }) - - it('updates and removes a cart line', async () => { - const add = renderHook(() => useAddToCart({}, 'regular'), { wrapper }) - await act(async () => { - add.result.current.addToCart(PRODUCT_ID, 1, 1849) - }) - - const [item] = await readCart('cart_items') - - const update = renderHook(() => useUpdateCartItem({}, 'regular'), { wrapper }) - await act(async () => { - update.result.current.mutate({ itemId: item.id, quantity: 4 }) - }) - await waitFor(async () => { - expect((await readCart('cart_items'))[0].quantity).toBe(4) - }) - - const remove = renderHook(() => useRemoveFromCart({}, 'regular'), { wrapper }) - await act(async () => { - remove.result.current.mutate({ itemId: item.id }) - }) - await waitFor(async () => { - expect(await readCart('cart_items')).toHaveLength(0) - }) - }) - - it('derives cart items and the total from the central stores', async () => { - const add = renderHook(() => useAddToCart({}, 'regular'), { wrapper }) - await act(async () => { - add.result.current.addToCart(PRODUCT_ID, 2, 1849) - }) - - const { result } = renderHook(() => useGetCart({}, 'regular'), { wrapper }) - - await waitFor(() => expect(result.current.totalItems).toBe(1)) - expect(result.current.cartItems[0].subtotal).toBe(430) - expect(result.current.totalPrice).toBe(430) - expect(result.current.hasItems).toBe(true) - expect(result.current.isEmpty).toBe(false) - }) - - it('clears the local cart', async () => { - const add = renderHook(() => useAddToCart({}, 'regular'), { wrapper }) - await act(async () => { - add.result.current.addToCart(PRODUCT_ID, 1, 1849) - }) - expect(await readCart('cart_items')).toHaveLength(1) - - await act(async () => { - await clearLocalCart('regular') - }) - expect(await readCart('cart_items')).toHaveLength(0) - }) -}) diff --git a/apps/user-ui/tests/hooks/cart-storage.test.tsx b/apps/user-ui/tests/hooks/cart-storage.test.tsx deleted file mode 100644 index 79e92d4..0000000 --- a/apps/user-ui/tests/hooks/cart-storage.test.tsx +++ /dev/null @@ -1,335 +0,0 @@ -/** - * Cart storage mechanics (hooks/cart-query-hooks.tsx) — the local cart is a - * JSON blob in StorageServiceCasual, so every write is read-modify-write. - * - * Covers the money-affecting edge cases the screen tests cannot reach: live - * repricing, zero quantities, unknown products, concurrent writes and - * useReconcileCartSlots' slot repair. Known bugs are pinned — see - * tests/KNOWN-GAPS.md. - */ - -import React from 'react' -import { renderHook, waitFor } from '@testing-library/react-native' -import { StorageServiceCasual } from 'common-ui/src/services/StorageServiceCasual' - -import { - useAddToCart, - useGetCart, - useReconcileCartSlots, - useUpdateCartItem, - clearLocalCart, -} from '@/hooks/cart-query-hooks' -import { useCentralProductStore } from '@/src/store/centralProductStore' -import { useCentralSlotStore } from '@/src/store/centralSlotStore' -import { resetStorage } from '../mocks/api' -import { Providers } from '../helpers/render' - -const SKU_IN_STOCK = 2 // Chicken Breast 500 g, price 215 -const SKU_OTHER = 5 // Cucumber(Kheera), price 15 -const SLOT_A = 1849 -const SLOT_B = 1847 - -const product = (id: number, price: number, over: Record = {}) => ({ - id, - name: `Product ${id}`, - price, - marketPrice: price + 20, - flashPrice: null, - incrementStep: 1, - images: [], - productQuantity: 1, - unitNotation: 'pc', - isComboOnly: false, - ...over, -}) - -const slotInfo = (slots: number[], over: Record = {}) => ({ - slots: slots.map((id) => ({ - id, - deliveryTime: new Date(Date.now() + 3 * 3600_000).toISOString(), - freezeTime: new Date(Date.now() + 2 * 3600_000).toISOString(), - products: [], - })), - isOutOfStock: false, - isFlashAvailable: false, - isSuspended: false, - ...over, -}) - -/** Point the central stores at a known product/slot universe. */ -const setCentral = ( - products: Record, - slotMap: Record, - isSlotsLoaded = true -) => { - useCentralProductStore.setState({ - products: Object.values(products) as never, - productsById: products as never, - }) - useCentralSlotStore.setState({ - slots: [], - productSlotsMap: slotMap as never, - isSlotsLoaded, - }) -} - -const readCart = async (key = 'cart_items') => { - const raw = await StorageServiceCasual.getItem(key) - return raw ? JSON.parse(raw) : [] -} - -const seedCart = async (items: unknown[], key = 'cart_items') => - StorageServiceCasual.setItem(key, JSON.stringify(items)) - -const line = (over: Record = {}) => ({ - id: 1, - skuId: SKU_IN_STOCK, - quantity: 1, - slotId: SLOT_A, - addedAt: new Date().toISOString(), - ...over, -}) - -const wrapper = ({ children }: { children?: React.ReactNode }) => ( - {children} -) - -const renderGetCart = (cartType: 'regular' | 'flash' = 'regular') => - renderHook(() => useGetCart({}, cartType), { wrapper }) - -describe('cart storage', () => { - beforeEach(async () => { - await resetStorage() - useCentralProductStore.setState({ products: [], productsById: {} }) - useCentralSlotStore.setState({ slots: [], productSlotsMap: {}, isSlotsLoaded: false }) - }) - - it('prices a line from the live product record, not the price at add time', async () => { - setCentral( - { [SKU_IN_STOCK]: product(SKU_IN_STOCK, 215) }, - { [SKU_IN_STOCK]: slotInfo([SLOT_A]) } - ) - await seedCart([line()]) - - const first = renderGetCart() - await waitFor(() => expect(first.result.current.totalPrice).toBe(215)) - first.unmount() - - // The catalog reprices the SKU underneath the cart; storage is untouched. - setCentral( - { [SKU_IN_STOCK]: product(SKU_IN_STOCK, 300) }, - { [SKU_IN_STOCK]: slotInfo([SLOT_A]) } - ) - expect(await readCart()).toEqual([expect.objectContaining({ quantity: 1 })]) - - const second = renderGetCart() - await waitFor(() => expect(second.result.current.totalPrice).toBe(300)) - }) - - it('multiplies price by quantity', async () => { - setCentral( - { [SKU_IN_STOCK]: product(SKU_IN_STOCK, 215) }, - { [SKU_IN_STOCK]: slotInfo([SLOT_A]) } - ) - await seedCart([line({ quantity: 3 })]) - - const { result } = renderGetCart() - await waitFor(() => expect(result.current.totalPrice).toBe(645)) - expect(result.current.cartItems).toHaveLength(1) - expect(result.current.totalItems).toBe(1) - }) - - /** - * KNOWN GAP: updateLocalCartItem writes the quantity through with no zero or - * negative guard, so a 0-qty line stays in storage and keeps counting as a - * cart row. The UI always routes deletion through removeFromCart, so this is - * only reachable from a direct call. - */ - it('persists a zero quantity with no guard', async () => { - setCentral( - { [SKU_IN_STOCK]: product(SKU_IN_STOCK, 215) }, - { [SKU_IN_STOCK]: slotInfo([SLOT_A]) } - ) - await seedCart([line()]) - - const { result } = renderHook(() => useUpdateCartItem({ showSuccessAlert: false, showErrorAlert: false }), { - wrapper, - }) - await result.current.updateCartItemAsync(1, 0) - - expect(await readCart()).toEqual([ - expect.objectContaining({ id: 1, skuId: SKU_IN_STOCK, quantity: 0 }), - ]) - }) - - /** - * KNOWN GAP: useGetCart drops any line whose skuId is missing from - * productsById or productSlotsMap. A cart written while one product was - * absent from the cache renders fewer rows than storage holds, and the - * dropped lines are never surfaced to the user. - */ - it('drops lines whose product is missing from the central stores', async () => { - setCentral( - { [SKU_IN_STOCK]: product(SKU_IN_STOCK, 215) }, - { [SKU_IN_STOCK]: slotInfo([SLOT_A]) } - ) - await seedCart([line({ id: 1 }), line({ id: 2, skuId: SKU_OTHER })]) - - const { result } = renderGetCart() - await waitFor(() => expect(result.current.cartItems).toHaveLength(1)) - expect(result.current.cartItems[0].skuId).toBe(SKU_IN_STOCK) - // The line is gone from the derived view but still on disk. - expect(await readCart()).toHaveLength(2) - }) - - it('ignores lines whose product has no slot entry', async () => { - setCentral({ [SKU_IN_STOCK]: product(SKU_IN_STOCK, 215) }, {}) - await seedCart([line()]) - - const { result } = renderGetCart() - await waitFor(() => expect(result.current.isLoading).toBe(false)) - expect(result.current.cartItems).toHaveLength(0) - }) - - /** - * KNOWN GAP: addToLocalCart is read-modify-write with no locking, so two adds - * issued in the same tick both read the pre-add cart and the second write - * erases the first. Adding two different SKUs back-to-back yields one line. - */ - it('loses the first of two concurrent adds', async () => { - setCentral( - { - [SKU_IN_STOCK]: product(SKU_IN_STOCK, 215), - [SKU_OTHER]: product(SKU_OTHER, 15), - }, - { - [SKU_IN_STOCK]: slotInfo([SLOT_A]), - [SKU_OTHER]: slotInfo([SLOT_A]), - } - ) - - const { result } = renderHook( - () => useAddToCart({ showSuccessAlert: false, showErrorAlert: false }), - { wrapper } - ) - - // Neither is awaited before the second is fired: both read the empty cart. - const first = result.current.addToCartAsync(SKU_IN_STOCK, 1, SLOT_A) - const second = result.current.addToCartAsync(SKU_OTHER, 1, SLOT_A) - await Promise.all([first, second]) - - const stored = await readCart() - expect(stored).toHaveLength(1) - expect(stored[0].skuId).toBe(SKU_OTHER) - }) - - it('keeps the flash and regular carts in separate storage keys', async () => { - setCentral( - { [SKU_IN_STOCK]: product(SKU_IN_STOCK, 215) }, - { [SKU_IN_STOCK]: slotInfo([SLOT_A]) } - ) - await seedCart([line()], 'cart_items') - await seedCart([line({ id: 1, slotId: 0 })], 'flash_cart_items') - - const regular = renderGetCart('regular') - const flash = renderGetCart('flash') - - await waitFor(() => expect(regular.result.current.cartItems).toHaveLength(1)) - await waitFor(() => expect(flash.result.current.cartItems).toHaveLength(1)) - expect(regular.result.current.cartItems[0].slotId).toBe(SLOT_A) - expect(flash.result.current.cartItems[0].slotId).toBe(0) - - await clearLocalCart('regular') - expect(await readCart('cart_items')).toEqual([]) - expect(await readCart('flash_cart_items')).toHaveLength(1) - }) -}) - -describe('useReconcileCartSlots', () => { - beforeEach(async () => { - await resetStorage() - }) - - it('re-points a line at the nearest slot when its stored slot is gone', async () => { - setCentral( - { [SKU_IN_STOCK]: product(SKU_IN_STOCK, 215) }, - { [SKU_IN_STOCK]: slotInfo([SLOT_B]) } - ) - await seedCart([line({ slotId: 9999 })]) - - renderHook(() => useReconcileCartSlots(), { wrapper }) - - await waitFor(async () => expect(await readCart()).toHaveLength(1)) - expect((await readCart())[0].slotId).toBe(SLOT_B) - }) - - it('leaves a line alone when its stored slot is still valid', async () => { - setCentral( - { [SKU_IN_STOCK]: product(SKU_IN_STOCK, 215) }, - { [SKU_IN_STOCK]: slotInfo([SLOT_A, SLOT_B]) } - ) - await seedCart([line({ slotId: SLOT_B })]) - - renderHook(() => useReconcileCartSlots(), { wrapper }) - - await waitFor(async () => expect(await readCart()).toHaveLength(1)) - expect((await readCart())[0].slotId).toBe(SLOT_B) - }) - - /** - * A line whose product has no slots can't be re-pointed, but it must not be - * deleted: it stays on disk (and is hidden from the derived view) so the user - * can still act on it once slots return. - */ - it('keeps a line whose product has no slots instead of deleting it', async () => { - setCentral( - { - [SKU_IN_STOCK]: product(SKU_IN_STOCK, 215), - [SKU_OTHER]: product(SKU_OTHER, 15), - }, - { - [SKU_IN_STOCK]: slotInfo([SLOT_B]), - [SKU_OTHER]: slotInfo([]), - } - ) - await seedCart([line({ id: 1, slotId: 9999 }), line({ id: 2, skuId: SKU_OTHER, slotId: 9999 })]) - - renderHook(() => useReconcileCartSlots(), { wrapper }) - - await waitFor(async () => { - const stored = await readCart() - expect(stored.find((i: { id: number }) => i.id === 1).slotId).toBe(SLOT_B) - }) - - const stored = await readCart() - expect(stored).toHaveLength(2) - // SKU_OTHER is kept untouched rather than dropped from storage. - expect(stored.find((i: { id: number }) => i.id === 2).skuId).toBe(SKU_OTHER) - expect(stored.find((i: { id: number }) => i.id === 2).slotId).toBe(9999) - }) - - /** - * The reconciler re-runs whenever productSlotsMap changes, so a line left - * pointing at an expired slot is repaired on the next slot refresh. - */ - it('re-reconciles when the slots map changes', async () => { - setCentral( - { [SKU_IN_STOCK]: product(SKU_IN_STOCK, 215) }, - { [SKU_IN_STOCK]: slotInfo([SLOT_B]) } - ) - await seedCart([line({ slotId: 9999 })]) - - const { rerender } = renderHook(() => useReconcileCartSlots(), { wrapper }) - await waitFor(async () => expect((await readCart())[0].slotId).toBe(SLOT_B)) - - // The cart is left pointing at a stale slot again, then slots change. - await seedCart([line({ id: 1, slotId: 7777 })]) - setCentral( - { [SKU_IN_STOCK]: product(SKU_IN_STOCK, 215) }, - { [SKU_IN_STOCK]: slotInfo([SLOT_A]) } - ) - rerender(undefined) - - await waitFor(async () => expect((await readCart())[0].slotId).toBe(SLOT_A)) - }) -}) diff --git a/apps/user-ui/tests/hooks/prominent-api-hooks.test.tsx b/apps/user-ui/tests/hooks/prominent-api-hooks.test.tsx deleted file mode 100644 index 4017a8c..0000000 --- a/apps/user-ui/tests/hooks/prominent-api-hooks.test.tsx +++ /dev/null @@ -1,95 +0,0 @@ -/** - * src/hooks/prominent-api-hooks.ts — CDN cache layer. - * Verifies URL derivation from essentialConsts, the availability merge, the - * store-detail fetch and error propagation. - */ - -import React from 'react' -import { renderHook, waitFor } from '@testing-library/react-native' - -import { - useAllProducts, - useGetEssentialConsts, - useSlots, - useStores, - useStoreWithProducts, -} from '@/src/hooks/prominent-api-hooks' -import { - AVAILABILITY_URL, - PRODUCTS_URL, - SLOTS_URL, - STORES_URL, - resetEssentialConsts, - resetStorage, - setupApiMocks, - storeDetailUrl, -} from '../mocks/api' -import { Providers } from '../helpers/render' - -const wrapper = ({ children }: { children?: React.ReactNode }) => ( - {children} -) - -const axiosCalledWith = ( - mock: { mock: { calls: unknown[][] } }, - needle: string -) => mock.mock.calls.some(([url]) => String(url).includes(needle)) - -describe('prominent-api-hooks', () => { - beforeEach(async () => { - await resetEssentialConsts() - await resetStorage() - }) - - it('exposes essentialConsts from the trpc procedure', async () => { - setupApiMocks() - const { result } = renderHook(() => useGetEssentialConsts(), { wrapper }) - - await waitFor(() => expect(result.current.data?.freeDeliveryThreshold).toBe(249)) - }) - - it('derives the products cache url and merges availability', async () => { - const api = setupApiMocks() - const { result } = renderHook(() => useAllProducts(), { wrapper }) - - await waitFor(() => expect(result.current.data?.products.length).toBeGreaterThan(0)) - expect(axiosCalledWith(api.axiosGet, PRODUCTS_URL)).toBe(true) - expect(axiosCalledWith(api.axiosGet, AVAILABILITY_URL)).toBe(true) - - const chicken = result.current.data?.products.find((p) => p.id === 2) - expect(chicken?.price).toBe(215) - expect(chicken?.marketPrice).toBe(220) - }) - - it('derives the stores cache url', async () => { - const api = setupApiMocks() - const { result } = renderHook(() => useStores(), { wrapper }) - - await waitFor(() => expect(result.current.data?.stores.length).toBeGreaterThan(0)) - expect(axiosCalledWith(api.axiosGet, STORES_URL)).toBe(true) - }) - - it('derives the slots cache url', async () => { - const api = setupApiMocks() - const { result } = renderHook(() => useSlots(), { wrapper }) - - await waitFor(() => expect(result.current.data?.slots.length).toBeGreaterThan(0)) - expect(axiosCalledWith(api.axiosGet, SLOTS_URL)).toBe(true) - }) - - it('fetches a single store detail', async () => { - const api = setupApiMocks() - const { result } = renderHook(() => useStoreWithProducts(1), { wrapper }) - - await waitFor(() => expect(result.current.data).toBeTruthy()) - expect(axiosCalledWith(api.axiosGet, storeDetailUrl(1))).toBe(true) - expect(result.current.data?.store.id).toBe(1) - }) - - it('propagates a products fetch error', async () => { - setupApiMocks({ failProducts: true }) - const { result } = renderHook(() => useAllProducts(), { wrapper }) - - await waitFor(() => expect(result.current.error).toBeTruthy()) - }) -}) diff --git a/apps/user-ui/tests/hooks/useAuthenticatedRoute.test.tsx b/apps/user-ui/tests/hooks/useAuthenticatedRoute.test.tsx deleted file mode 100644 index d88e464..0000000 --- a/apps/user-ui/tests/hooks/useAuthenticatedRoute.test.tsx +++ /dev/null @@ -1,42 +0,0 @@ -/** - * hooks/useAuthenticatedRoute.ts — redirects unauthenticated users to login. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import { renderHook, waitFor } from '@testing-library/react-native' - -import { useAuthenticatedRoute } from '@/hooks/useAuthenticatedRoute' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { authMock, resetAuthMock } from '../mocks/auth' -import { routerMock } from '../mocks/router' - -describe('useAuthenticatedRoute', () => { - beforeEach(async () => { - resetAuthMock() - await resetStorage() - setupApiMocks() - }) - - it('redirects an unauthenticated user to login', async () => { - renderHook(() => useAuthenticatedRoute({ targetUrl: '/(drawer)/(tabs)/me' })) - - await waitFor(() => expect(routerMock.push).toHaveBeenCalledWith('/(auth)/login')) - }) - - it('does not redirect an authenticated user', async () => { - authMock.user = { id: 1 } - renderHook(() => useAuthenticatedRoute()) - - await waitFor(() => expect(authMock.user).toBeTruthy()) - expect(routerMock.push).not.toHaveBeenCalled() - }) - - it('does not redirect while auth is still loading', async () => { - authMock.isLoading = true - renderHook(() => useAuthenticatedRoute()) - - await waitFor(() => expect(authMock.isLoading).toBe(true)) - expect(routerMock.push).not.toHaveBeenCalled() - }) -}) diff --git a/apps/user-ui/tests/hooks/useColorScheme.test.tsx b/apps/user-ui/tests/hooks/useColorScheme.test.tsx deleted file mode 100644 index 46ac099..0000000 --- a/apps/user-ui/tests/hooks/useColorScheme.test.tsx +++ /dev/null @@ -1,15 +0,0 @@ -/** - * hooks/useColorScheme.ts — passthrough to React Native's colour scheme. - */ - -import { renderHook } from '@testing-library/react-native' - -import { useColorScheme } from '@/hooks/useColorScheme' - -describe('useColorScheme', () => { - it('returns the platform colour scheme', () => { - const { result } = renderHook(() => useColorScheme()) - - expect([null, 'light', 'dark']).toContain(result.current as unknown) - }) -}) diff --git a/apps/user-ui/tests/hooks/useHideTabNav.test.tsx b/apps/user-ui/tests/hooks/useHideTabNav.test.tsx deleted file mode 100644 index 3672772..0000000 --- a/apps/user-ui/tests/hooks/useHideTabNav.test.tsx +++ /dev/null @@ -1,26 +0,0 @@ -/** - * hooks/useHideTabNav.ts — hides the tab bar for a caller via appStore. - */ - -import { renderHook } from '@testing-library/react-native' - -import { useHideTabNav } from '@/src/hooks/useHideTabNav' -import { useAppStore } from '@/src/store/appStore' - -describe('useHideTabNav', () => { - it('marks the tab bar hidden for the caller key on focus', () => { - useAppStore.setState({ hideTabsNav: {} }) - - renderHook(() => useHideTabNav('cart')) - - expect(useAppStore.getState().hideTabsNav.cart).toBe(true) - }) - - it('defaults the caller key when none is given', () => { - useAppStore.setState({ hideTabsNav: {} }) - - renderHook(() => useHideTabNav()) - - expect(useAppStore.getState().hideTabsNav.default).toBe(true) - }) -}) diff --git a/apps/user-ui/tests/hooks/useJWT.test.ts b/apps/user-ui/tests/hooks/useJWT.test.ts deleted file mode 100644 index fa0c011..0000000 --- a/apps/user-ui/tests/hooks/useJWT.test.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * hooks/useJWT.ts — token / userId persistence over the secure StorageService. - */ - -import { - AUTH_TOKEN_KEY, - USER_ID_KEY, - deleteAuthToken, - getAuthToken, - getUserId, - saveAuthToken, - saveUserId, -} from '@/hooks/useJWT' - -describe('useJWT', () => { - it('stores, reads and deletes the auth token', async () => { - await saveAuthToken('token-123') - expect(await getAuthToken()).toBe('token-123') - - await deleteAuthToken() - expect(await getAuthToken()).toBeNull() - }) - - it('stores and reads the user id', async () => { - await saveUserId('42') - expect(await getUserId()).toBe('42') - }) - - it('exposes the storage keys', () => { - expect(AUTH_TOKEN_KEY).toBe('authToken') - expect(USER_ID_KEY).toBe('userId') - }) -}) diff --git a/apps/user-ui/tests/hooks/useProductSlotIdentifier.test.tsx b/apps/user-ui/tests/hooks/useProductSlotIdentifier.test.tsx deleted file mode 100644 index 85f4b64..0000000 --- a/apps/user-ui/tests/hooks/useProductSlotIdentifier.test.tsx +++ /dev/null @@ -1,77 +0,0 @@ -/** - * hooks/useProductSlotIdentifier.ts — getQuickestSlot over the central slot store. - */ - -import { renderHook } from '@testing-library/react-native' -import dayjs from 'dayjs' - -import { useProductSlotIdentifier } from '@/hooks/useProductSlotIdentifier' -import { useCentralSlotStore } from '@/src/store/centralSlotStore' - -const slotInfo = (slots: unknown[]) => - ({ - slots, - isOutOfStock: false, - isFlashAvailable: true, - isSuspended: false, - }) as never - -const slot = (id: number, hoursFromNow: number) => ({ - id, - deliveryTime: dayjs().add(hoursFromNow, 'hour').toISOString(), - freezeTime: dayjs().add(hoursFromNow - 1, 'hour').toISOString(), -}) - -describe('useProductSlotIdentifier', () => { - it('returns the id of the earliest upcoming slot for a product', () => { - useCentralSlotStore.setState({ - slots: [slot(10, 5), slot(11, 2), slot(12, 9)] as never, - productSlotsMap: { 2: slotInfo([slot(10, 5), slot(11, 2), slot(12, 9)]) } as never, - }) - - const { result } = renderHook(() => useProductSlotIdentifier()) - - expect(result.current.getQuickestSlot(2)).toBe(11) - }) - - it('ignores slots whose delivery is already past', () => { - useCentralSlotStore.setState({ - slots: [slot(1, -3), slot(2, 4)] as never, - productSlotsMap: { 2: slotInfo([slot(1, -3), slot(2, 4)]) } as never, - }) - - const { result } = renderHook(() => useProductSlotIdentifier()) - - expect(result.current.getQuickestSlot(2)).toBe(2) - }) - - it('returns null when the product has no slots', () => { - useCentralSlotStore.setState({ - slots: [slot(1, 4)] as never, - productSlotsMap: {} as never, - }) - - const { result } = renderHook(() => useProductSlotIdentifier()) - - expect(result.current.getQuickestSlot(2)).toBeNull() - }) - - it('returns null when there are no slots at all', () => { - useCentralSlotStore.setState({ slots: [] as never, productSlotsMap: {} as never }) - - const { result } = renderHook(() => useProductSlotIdentifier()) - - expect(result.current.getQuickestSlot(2)).toBeNull() - }) - - it('returns null when every slot for the product is in the past', () => { - useCentralSlotStore.setState({ - slots: [slot(1, -5)] as never, - productSlotsMap: { 2: slotInfo([slot(1, -5)]) } as never, - }) - - const { result } = renderHook(() => useProductSlotIdentifier()) - - expect(result.current.getQuickestSlot(2)).toBeNull() - }) -}) diff --git a/apps/user-ui/tests/hooks/useUploadToObjectStore.test.tsx b/apps/user-ui/tests/hooks/useUploadToObjectStore.test.tsx deleted file mode 100644 index b7973e7..0000000 --- a/apps/user-ui/tests/hooks/useUploadToObjectStore.test.tsx +++ /dev/null @@ -1,120 +0,0 @@ -/** - * hooks/useUploadToObjectStore.ts — presigned-URL upload. - * Asserts common.generateUploadUrls and the direct PUT to each presigned URL. - * - * httpBatchLink flushes on a timer, so each act() advances the fake clock. - */ - -import React from 'react' -import { act, renderHook, waitFor } from '@testing-library/react-native' - -import { useUploadToObjectStorage } from '@/hooks/useUploadToObjectStore' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { lastProcedureInput } from '../mocks/procedures' -import { Providers } from '../helpers/render' - -const wrapper = ({ children }: { children?: React.ReactNode }) => ( - {children} -) - -type UploadResultLike = { keys: string[]; presignedUrls: string[] } - -/** Run the upload; waitFor drives the tRPC batch timer to flush. */ -const runUpload = async ( - result: { current: ReturnType }, - input: Parameters['upload']>[0] -) => { - let value: UploadResultLike | undefined - let failure: unknown - - act(() => { - result.current.upload(input).then( - (settled) => { - value = settled as UploadResultLike - }, - (error) => { - failure = error - } - ) - }) - - await waitFor(() => { - if (!value && !failure) throw new Error('upload still pending') - }) - - return { value, failure } -} - -describe('useUploadToObjectStorage', () => { - beforeEach(async () => { - await resetStorage() - }) - - it('requests presigned urls and PUTs every image', async () => { - const api = setupApiMocks({ - procedures: { - 'common.generateUploadUrls': { - uploadUrls: [ - 'https://bucket.test/complaint/k1', - 'https://bucket.test/complaint/k2', - ], - }, - }, - }) - const { result } = renderHook(() => useUploadToObjectStorage(), { wrapper }) - - const { value } = await runUpload(result, { - images: [ - { blob: {} as Blob, mimeType: 'image/jpeg' }, - { blob: {} as Blob, mimeType: 'image/png' }, - ], - contextString: 'complaint', - }) - - expect(value).toEqual({ - keys: ['k1', 'k2'], - presignedUrls: [ - 'https://bucket.test/complaint/k1', - 'https://bucket.test/complaint/k2', - ], - }) - expect(lastProcedureInput(api.fetchMock, 'common.generateUploadUrls')).toEqual({ - contextString: 'complaint', - mimeTypes: ['image/jpeg', 'image/png'], - }) - - const puts = api.fetchMock.mock.calls.filter( - ([, options]) => (options as { method?: string })?.method === 'PUT' - ) - expect(puts).toHaveLength(2) - }) - - it('short-circuits when there are no images', async () => { - const api = setupApiMocks() - const { result } = renderHook(() => useUploadToObjectStorage(), { wrapper }) - - const { value } = await runUpload(result, { - images: [], - contextString: 'complaint', - }) - - expect(value).toEqual({ keys: [], presignedUrls: [] }) - expect( - api.fetchMock.mock.calls.some(([u]) => String(u).includes('generateUploadUrls')) - ).toBe(false) - }) - - it('fails when the URL count does not match the image count', async () => { - setupApiMocks({ - procedures: { 'common.generateUploadUrls': { uploadUrls: [] } }, - }) - const { result } = renderHook(() => useUploadToObjectStorage(), { wrapper }) - - const { failure } = await runUpload(result, { - images: [{ blob: {} as Blob, mimeType: 'image/jpeg' }], - contextString: 'complaint', - }) - - expect((failure as Error)?.message).toMatch(/Expected 1 URLs, got 0/) - }) -}) diff --git a/apps/user-ui/tests/jest-env.d.ts b/apps/user-ui/tests/jest-env.d.ts deleted file mode 100644 index 044ff29..0000000 --- a/apps/user-ui/tests/jest-env.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/// - -// Declares the Jest globals (describe, it, expect, jest, ...) for the tests in -// this folder. @types/jest is a devDependency, but making the reference explicit -// means the globals are declared by a file inside the project rather than -// relying on ambient @types auto-inclusion, so editors resolve them even when a -// file falls back to an inferred project. diff --git a/apps/user-ui/tests/jest.config.js b/apps/user-ui/tests/jest.config.js deleted file mode 100644 index e4e2883..0000000 --- a/apps/user-ui/tests/jest.config.js +++ /dev/null @@ -1,56 +0,0 @@ -const path = require('path') - -const appRoot = path.resolve(__dirname, '..') - -/** - * Jest project for apps/user-ui integration tests. - * - * Kept out of the app build three ways: - * 1. .easignore (tests/ never uploaded to EAS) - * 2. metro.config.js resolver.blockList (never bundled) - * 3. tsconfig.json exclude + tests/tsconfig.json (separate typecheck scope) - */ -module.exports = { - preset: 'jest-expo', - rootDir: appRoot, - roots: ['/tests'], - testMatch: ['/tests/**/*.test.ts', '/tests/**/*.test.tsx'], - setupFiles: ['/tests/setup.ts'], - clearMocks: true, - moduleNameMapper: { - '^@/(.*)$': '/$1', - '^@backend/(.*)$': '/../backend/src/$1', - '^shared-types$': '/../shared-types', - '^@packages/shared$': '/../../packages/shared', - '^@packages/shared/(.*)$': '/../../packages/shared/$1', - '^global-shared$': '/../../packages/shared', - '^global-shared/(.*)$': '/../../packages/shared/$1', - '^common-ui$': '/../../packages/ui', - '^common-ui/(.*)$': '/../../packages/ui/$1', - }, - transformIgnorePatterns: [ - 'node_modules/(?!(?:.pnpm/)?(' + - [ - '(jest-)?react-native', - '@react-native(-community)?', - 'expo(nent)?', - '@expo(nent)?/.*', - '@expo-google-fonts/.*', - 'react-navigation', - '@react-navigation/.*', - '@sentry/react-native', - 'native-base', - 'react-native-svg', - 'react-native-gesture-handler', - 'react-native-reanimated', - 'react-native-safe-area-context', - 'react-native-screens', - '@trpc/.*', - '@tanstack/.*', - 'twrnc', - 'zod', - '@testing-library/react-native', - ].join('|') + - '))', - ], -} diff --git a/apps/user-ui/tests/lib/force-logout.test.tsx b/apps/user-ui/tests/lib/force-logout.test.tsx deleted file mode 100644 index 954416b..0000000 --- a/apps/user-ui/tests/lib/force-logout.test.tsx +++ /dev/null @@ -1,138 +0,0 @@ -/** - * 401 -> force-logout wiring (src/trpc-client.ts + the app shell). - * - * trpc-client emits FORCE_LOGOUT_EVENT when a response is a 401 whose error - * message is "UNAUTHORIZED". The missing half is a subscriber: nothing in - * user-ui listens for that event, so a signed-in session survives a 401. - * - * The last test pins that gap — it asserts the session is NOT cleared and will - * fail once a listener is wired up. See tests/KNOWN-GAPS.md. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) -jest.unmock('@/src/contexts/AuthContext') - -import React from 'react' -import { Text } from 'react-native' -import { DeviceEventEmitter } from 'react-native' -import { screen, waitFor } from '@testing-library/react-native' -import { FORCE_LOGOUT_EVENT } from 'common-ui/src/lib/const-strs' -import { StorageService } from 'common-ui/src/services/StorageService' - -import { AuthProvider, useAuth } from '@/src/contexts/AuthContext' -import { trpcClient } from '@/src/trpc-client' -import { getAuthToken } from '@/hooks/useJWT' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { renderWithProviders } from '../helpers/render' - -const USER = { - id: 5, - name: 'Test User', - email: 'test@example.com', - mobile: '9876543210', - profileImage: '', - createdAt: '', -} - -const jwtFor = (payload: Record) => { - const enc = (obj: unknown) => - Buffer.from(JSON.stringify(obj)).toString('base64url') - return `${enc({ alg: 'HS256', typ: 'JWT' })}.${enc(payload)}.sig` -} - -const Probe = () => { - const auth = useAuth() - return ( - - {`${auth.isAuthenticated}|${auth.isLoading}|${auth.user?.id ?? 'none'}`} - - ) -} - -/** A tRPC response shaped like the batch error envelope the client inspects. */ -const responseWith = (status: number, message: string) => { - const body = [{ error: { message } }] - return { - ok: status < 400, - status, - statusText: 'status', - headers: new Map(), - url: '', - json: async () => body, - text: async () => JSON.stringify(body), - clone: () => ({ json: async () => body }), - } -} - -/** Fire a query through the real client and wait for it to settle. */ -const callAndSettle = async (status: number, message: string) => { - ;(global as unknown as { fetch: unknown }).fetch = jest.fn(async () => - responseWith(status, message) - ) - - let settled = false - const promise = trpcClient.common.healthCheck - .query() - .catch(() => undefined) - .then(() => { - settled = true - }) - - await waitFor(() => expect(settled).toBe(true)) - await promise -} - -describe('401 force-logout', () => { - beforeEach(async () => { - await resetStorage() - await StorageService.clearAll(['authToken', 'userId']) - }) - - it('emits FORCE_LOGOUT_EVENT for a 401 UNAUTHORIZED', async () => { - const emit = jest.spyOn(DeviceEventEmitter, 'emit') - - await callAndSettle(401, 'UNAUTHORIZED') - - expect(emit).toHaveBeenCalledWith(FORCE_LOGOUT_EVENT) - }) - - it('does not emit for a 401 with another message', async () => { - const emit = jest.spyOn(DeviceEventEmitter, 'emit') - - await callAndSettle(401, 'TOKEN_EXPIRED') - - expect(emit).not.toHaveBeenCalledWith(FORCE_LOGOUT_EVENT) - }) - - /** - * KNOWN GAP: the event is emitted but no component subscribes, so an - * authenticated session is left in place after the server has rejected its - * token. The next screen the user opens will fail again instead of being - * sent to login. - * - * This pins the gap: it asserts the session survives. It must be rewritten - * to assert the redirect once a FORCE_LOGOUT_EVENT listener exists. - */ - it('leaves the signed-in session untouched (no subscriber for the event)', async () => { - await StorageService.setItem('authToken', jwtFor({ id: USER.id })) - await StorageService.setItem('userId', String(USER.id)) - - setupApiMocks({ - procedures: { 'user.user.getSelfData': { data: { user: USER } } }, - }) - renderWithProviders( - - - , - { centralStores: false } - ) - - await waitFor(() => expect(screen.getByTestId('state')).toHaveTextContent('true|false|5')) - - await callAndSettle(401, 'UNAUTHORIZED') - - // Nothing listens for FORCE_LOGOUT_EVENT: the session is not torn down. - await waitFor(() => expect(screen.getByTestId('state')).toHaveTextContent('true|false|5')) - expect(await getAuthToken()).not.toBeNull() - }) -}) diff --git a/apps/user-ui/tests/lib/pending-address.test.ts b/apps/user-ui/tests/lib/pending-address.test.ts deleted file mode 100644 index d849076..0000000 --- a/apps/user-ui/tests/lib/pending-address.test.ts +++ /dev/null @@ -1,50 +0,0 @@ -/** - * pending-address (src/lib/pending-address.ts). - * - * A delivery address a signed-out user filled in is kept in casual storage and - * posted after authentication (see PendingAddressSync). - */ - -import { - clearPendingAddress, - getPendingAddress, - savePendingAddress, -} from '@/src/lib/pending-address' - -const ADDRESS = { - regionId: 1, - name: 'Home', - phone: '9876543210', - addressLine1: '12 Main Road', - city: 'Mahabubnagar', - state: 'Telangana', - latitude: 16.7488, - longitude: 77.9851, -} - -describe('pending address', () => { - beforeEach(async () => { - await clearPendingAddress() - }) - - it('round-trips a signed-out draft', async () => { - await savePendingAddress(ADDRESS) - expect(await getPendingAddress()).toEqual(ADDRESS) - }) - - it('returns null when there is no draft', async () => { - expect(await getPendingAddress()).toBeNull() - }) - - it('clears the draft', async () => { - await savePendingAddress(ADDRESS) - await clearPendingAddress() - expect(await getPendingAddress()).toBeNull() - }) - - it('returns null for corrupt stored JSON', async () => { - const { StorageServiceCasual } = require('common-ui/src/services/StorageServiceCasual') - await StorageServiceCasual.setItem('freshyo_pending_address', '{not json') - expect(await getPendingAddress()).toBeNull() - }) -}) diff --git a/apps/user-ui/tests/lib/query-invalidation-keys.test.tsx b/apps/user-ui/tests/lib/query-invalidation-keys.test.tsx deleted file mode 100644 index 1b06786..0000000 --- a/apps/user-ui/tests/lib/query-invalidation-keys.test.tsx +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Query-key shape — why `invalidateQueries({ queryKey: ['a.b.c'] })` silently does nothing. - * - * tRPC v11 stores keys as `[pathArray, { input?, type? }]` (see getQueryKeyInternal in - * @trpc/react-query). TanStack matches a filter against the stored key with partialMatchKey, - * which rejects a string where the key has an array — so the dotted form matches zero queries - * and the mutation's data stays stale. - * - * This is the regression guard for that class: CheckoutAddressSelector was invalidating - * `['user.address.getUserAddresses']` and never refreshing the addresses it renders. - * - * The assertions use getQueryCache().findAll(), which runs the same matcher invalidateQueries - * uses, so no network round trip is involved. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Text } from 'react-native' -import { screen, waitFor } from '@testing-library/react-native' - -import { trpc } from '@/src/trpc-client' -import { setupApiMocks } from '../mocks/api' -import { createQueryClient, renderWithProviders } from '../helpers/render' - -const PROCEDURE = 'user.address.getUserAddresses' - -const Probe = () => { - const q = trpc.user.address.getUserAddresses.useQuery() - return {q.isSuccess ? 'ok' : 'pending'} -} - -describe('query key shape', () => { - it('matches the array path form and ignores the dotted string form', async () => { - setupApiMocks({ procedures: { [PROCEDURE]: { data: [] } } }) - const client = createQueryClient() - - renderWithProviders(, { centralStores: false, queryClient: client }) - await waitFor(() => expect(screen.getByTestId('state')).toHaveTextContent('ok')) - - // The key tRPC really produced for this hook. - const stored = client.getQueryCache().getAll()[0] - expect(stored.queryKey[0]).toEqual(['user', 'address', 'getUserAddresses']) - - // The old, dotted form: matches nothing, so the invalidation was a no-op. - expect( - client.getQueryCache().findAll({ queryKey: ['user.address.getUserAddresses'] }) - ).toHaveLength(0) - - // The form tRPC's own utils.X.invalidate() builds: matches. - expect( - client.getQueryCache().findAll({ queryKey: [['user', 'address', 'getUserAddresses']] }) - ).toHaveLength(1) - }) -}) diff --git a/apps/user-ui/tests/lib/string-manipulators.test.ts b/apps/user-ui/tests/lib/string-manipulators.test.ts deleted file mode 100644 index 4dcbaab..0000000 --- a/apps/user-ui/tests/lib/string-manipulators.test.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * lib/string-manipulators.ts — orderStatusManipulator. - */ - -import { orderStatusManipulator } from '@/src/lib/string-manipulators' - -describe('orderStatusManipulator', () => { - it('maps pending to the user-facing "Confirmed"', () => { - expect(orderStatusManipulator('pending')).toBe('Confirmed') - }) - - it('is case-insensitive', () => { - expect(orderStatusManipulator('PENDING')).toBe('Confirmed') - expect(orderStatusManipulator('Pending')).toBe('Confirmed') - }) - - it('passes every other status through unchanged', () => { - expect(orderStatusManipulator('packaged')).toBe('packaged') - expect(orderStatusManipulator('success')).toBe('success') - expect(orderStatusManipulator('cancelled')).toBe('cancelled') - expect(orderStatusManipulator('')).toBe('') - }) -}) diff --git a/apps/user-ui/tests/lib/trpc-client.test.ts b/apps/user-ui/tests/lib/trpc-client.test.ts deleted file mode 100644 index 7637295..0000000 --- a/apps/user-ui/tests/lib/trpc-client.test.ts +++ /dev/null @@ -1,62 +0,0 @@ -/** - * src/trpc-client.ts — a 401 UNAUTHORIZED response must emit the force-logout - * event so the app can clear the session. - * - * httpBatchLink flushes on a timer, so waitFor drives the request to completion. - */ - -import { DeviceEventEmitter } from 'react-native' -import { waitFor } from '@testing-library/react-native' -import { FORCE_LOGOUT_EVENT } from 'common-ui/src/lib/const-strs' - -import { trpcClient } from '@/src/trpc-client' - -const responseWith = (status: number, message: string) => { - const body = [{ error: { message } }] - return { - ok: status < 400, - status, - statusText: 'status', - headers: new Map(), - url: '', - json: async () => body, - text: async () => JSON.stringify(body), - clone: () => ({ json: async () => body }), - } -} - -/** Fire a tRPC call and wait for it to settle, advancing the batch timer. */ -const callAndSettle = async (status: number, message: string) => { - ;(global as unknown as { fetch: unknown }).fetch = jest.fn(async () => - responseWith(status, message) - ) - - let settled = false - const promise = trpcClient.common.healthCheck - .query() - .catch(() => undefined) - .then(() => { - settled = true - }) - - await waitFor(() => expect(settled).toBe(true)) - await promise -} - -describe('trpc-client', () => { - it('emits the force-logout event on a 401 UNAUTHORIZED response', async () => { - const emit = jest.spyOn(DeviceEventEmitter, 'emit') - - await callAndSettle(401, 'UNAUTHORIZED') - - expect(emit).toHaveBeenCalledWith(FORCE_LOGOUT_EVENT) - }) - - it('does not emit the force-logout event on a 500 response', async () => { - const emit = jest.spyOn(DeviceEventEmitter, 'emit') - - await callAndSettle(500, 'Internal Server Error') - - expect(emit).not.toHaveBeenCalledWith(FORCE_LOGOUT_EVENT) - }) -}) diff --git a/apps/user-ui/tests/mocks/api.ts b/apps/user-ui/tests/mocks/api.ts deleted file mode 100644 index cf45c59..0000000 --- a/apps/user-ui/tests/mocks/api.ts +++ /dev/null @@ -1,366 +0,0 @@ -/** - * Network-layer mocks for the user-ui tests. - * - * Everything the home page fetches goes through one of two doors: - * - tRPC -> global.fetch (common.essentialConsts, user.order.getOrders, ...) - * - axios -> the assets CDN (products.json, stores.json, slots.json, availability.json) - * - * Both are stubbed here and both fail loudly on an unmocked URL, so a new - * dependency introduced by app code surfaces as a test failure instead of a - * silent empty render. - * - * The tRPC URL is matched on the procedure path rather than the host, because - * BASE_API_URL (@packages/shared) is a local address during development. - * `jest.mock('axios')` lives in tests/setup.ts so it is registered before any - * app module imports axios. - * - * Fixtures are imported as JSON rather than read with `fs`: importing a Node - * builtin pulls @types/node into the typecheck program, which flips - * `setTimeout` from `number` to `NodeJS.Timeout` and breaks unrelated app types. - * - * NOTE: mock-slots-response.json is a snapshot of one real day, so its dates are - * rebased relative to the frozen clock below rather than used as-is. - */ - -import essentialConsts from '../__fixtures__/essentialConsts.json' -import availability from './mock-availability-response.json' -import products from './mock-products-response.json' -import slotsRaw from './mock-slots-response.json' -import storeProducts from './mock-store-products-response.json' -import stores from './mock-stores-response.json' -import { StorageServiceCasual } from 'common-ui/src/services/StorageServiceCasual' -import { parseTrpcUrl } from './procedures' - -/** The payload the common.essentialConsts procedure resolves to (unwrapped). */ -export const ESSENTIAL_CONSTS_DATA = essentialConsts[0].result.data - -/** essentialConsts with flash delivery switched on (flash-option tests). */ -export const FLASH_ENABLED_CONSTS = { - ...ESSENTIAL_CONSTS_DATA, - isFlashDeliveryEnabled: true, -} - -/** products.json with no tags and no products (empty-state tests). */ -export const EMPTY_PRODUCTS = { products: [], tags: [] } - -/** Region fixtures returned by common.listRegions (region 1 / Mahabubnagar). */ -export const MOCK_REGIONS = [ - { id: 1, name: 'Mahabubnagar', description: null, effectiveBoundId: 1 }, -] - -/** - * Default address fixture. Coordinates are mandatory now and the region/bound - * are derived from them; returned by user.address.getDefaultAddress and (as a - * one-item list) user.address.getUserAddresses when a test doesn't override. - */ -export const MOCK_ADDRESS = { - id: 1, - regionId: 1, - boundId: 1, - name: 'Home', - phone: '9876543210', - addressLine1: '12 Main Road', - addressLine2: null, - city: 'Mahabubnagar', - state: 'Telangana', - isDefault: true, - latitude: 16.7488, - longitude: 77.9851, -} - -/** A dashboard tag that points at no products (empty-tag-grid test). */ -export const EMPTY_TAG = { - id: 9999, - tagName: 'Empty', - tagDescription: null, - imageUrl: null, - isDashboardTag: true, - productIds: [], -} - -/** - * The mocked StorageServiceCasual keeps its map at module scope, so the cart - * survives from one test to the next. Call from beforeEach. - * - * `essential_consts` is deliberately NOT cleared here: when it is persisted, - * useGetEssentialConsts gets placeholderData synchronously, which - * tests/home-page/navigation.test.tsx (real router) relies on. A file that - * overrides the constants must clear it itself via resetEssentialConsts(). - */ -export async function resetStorage() { - await StorageServiceCasual.clearAll(['cart_items', 'flash_cart_items']) -} - -/** Clears the persisted essentialConsts so the next render refetches them. */ -export async function resetEssentialConsts() { - await StorageServiceCasual.clearAll(['essential_consts']) -} - -/** - * The slot fixture is a snapshot of a real day. The home page drops slots whose - * deliveryTime is not after `dayjs()`, so the fixture would silently expire. - * Shift every slot by the same delta so the earliest lands FIRST_SLOT_LEAD_MS - * ahead of now, keeping the relative spacing and the freeze-before-delivery - * offset intact. Ids and per-slot product lists are untouched. - */ -const FIRST_SLOT_LEAD_MS = 2 * 60 * 60 * 1000 - -/** How far in the past the synthetic expired slots freeze. */ -const EXPIRED_FREEZE_MS = 2 * 60 * 1000 -export const EXPIRED_HOME_SLOT_ID = 9001 -export const EXPIRED_DIALOG_SLOT_ID = 9002 - -const rebaseSlots = (raw: typeof slotsRaw) => { - const offset = - Date.now() + - FIRST_SLOT_LEAD_MS - - new Date(raw.slots[0].deliveryTime).getTime() - - return { - ...raw, - slots: raw.slots.map((slot) => ({ - ...slot, - deliveryTime: new Date( - new Date(slot.deliveryTime).getTime() + offset - ).toISOString(), - freezeTime: new Date( - new Date(slot.freezeTime).getTime() + offset - ).toISOString(), - })), - } -} - -/** Slots as the app will receive them (rebased), for building expectations. */ -export const mockSlots = (() => { const rebased = rebaseSlots(slotsRaw) - const now = Date.now() - - // Slots whose freezeTime has passed but whose delivery is still upcoming. - // The backend filters these out (scaffoldSlotsWithProducts) and the cart - // dialog filters them out too; these exist so the home strip can be shown to - // do the same. Delivery times are picked deliberately: - // 9001 earliest -> an unfiltered slot would sort first and fail loudly - // instead of hiding beyond the 5-item slice - // 9002 latest -> getQuickestSlot (which ignores freezeTime) still - // resolves product 23 to its real, earlier slot - const expiredSlot = (id: number, deliveryLeadMs: number, productIds: number[]) => ({ - id, - deliveryTime: new Date(now + deliveryLeadMs).toISOString(), - freezeTime: new Date(now - EXPIRED_FREEZE_MS).toISOString(), - products: productIds.map((productId) => ({ - id: productId, - images: [] as string[], - })), - }) - - return { - ...rebased, - slots: [ - ...rebased.slots, - expiredSlot(EXPIRED_HOME_SLOT_ID, 60 * 60 * 1000, []), - expiredSlot(EXPIRED_DIALOG_SLOT_ID, 20 * 60 * 60 * 1000, [23]), - ], - } -})() - -const productsInAnySlot = new Set() -mockSlots.slots.forEach((slot) => - slot.products.forEach((p) => productsInAnySlot.add(p.id)) -) - -const flaggedOutOfStock = new Set( - availability.availability.filter((a) => a.isOutOfStock).map((a) => a.id) -) - -/** - * The products the UI should treat as unavailable: flagged out of stock by the - * availability cache, or present in no upcoming slot. Mirrors - * displayIsOutOfStock / productsByTagId in the page. Combo-only SKUs are - * dropped because useAllProducts filters them out. - */ -export const outOfStockIds = new Set( - products.products - .filter((p) => !p.isComboOnly) - .map((p) => p.id) - .filter((id) => flaggedOutOfStock.has(id) || !productsInAnySlot.has(id)) -) - -export const ESSENTIAL_CONSTS_URL = - 'https://worker.freshyo.in/api/trpc/common.essentialConsts?batch=1&input=%7B%220%22%3A%7B%22json%22%3Anull%2C%22meta%22%3A%7B%22values%22%3A%5B%22undefined%22%5D%7D%7D%7D' - -// Derived by useCacheUrl / useAvailabilityCacheUrl / useSlotsCacheUrl from the -// essentialConsts payload above (assetsDomain, apiCacheKey, cacheVersion, -// availabilityVersionNum, slotsVersionNum). Cache files are region-owned, so -// each URL carries the browsing region (1 = Mahabubnagar in these fixtures). -export const PRODUCTS_URL = - 'https://assets.freshyo.in/api-cache/regions/1/v-755/products.json' -export const AVAILABILITY_URL = - 'https://assets.freshyo.in/regions/1/av-72/availability.json' -export const STORES_URL = 'https://assets.freshyo.in/api-cache/regions/1/v-755/stores.json' -export const SLOTS_URL = 'https://assets.freshyo.in/regions/1/slots/v-401/slots.json?v=123' - -/** useStoreWithProducts URL for a given store id. */ -export const storeDetailUrl = (storeId: number | string) => - `https://assets.freshyo.in/api-cache/regions/1/v-755/stores/${storeId}.json` - -const jsonResponse = (body: unknown) => ({ - ok: true, - status: 200, - statusText: 'OK', - headers: new Map(), - url: '', - json: async () => body, - text: async () => JSON.stringify(body), -}) - -const errorResponse = (status: number, message: string) => ({ - ok: false, - status, - statusText: message, - headers: new Map(), - url: '', - json: async () => ({ message }), - text: async () => message, -}) - -export interface ApiMockOptions { - /** Replace the products.json body entirely (e.g. EMPTY_PRODUCTS). */ - products?: unknown - /** Append tags to the products.json body's `tags` (empty-tag-grid test). */ - extraTags?: unknown[] - /** Override the stores.json body. */ - stores?: unknown - /** Override the stores/.json body (useStoreWithProducts). */ - storeProducts?: unknown - /** Override the essentialConsts payload (unwrapped procedure data). */ - consts?: unknown - /** user.order.getOrders data (NextOrderGlimpse). */ - orders?: unknown[] - /** - * tRPC procedure registry: name -> data, or (input) => data. Merged over the - * built-in essentials (common.essentialConsts, user.order.getOrders/orders). - * An unknown procedure throws, so a new dependency surfaces loudly. - */ - procedures?: Record unknown)> - /** axios.get(products.json) rejects -> the products query errors. */ - failProducts?: boolean - /** axios.get(stores.json) rejects -> the stores query errors. */ - failStores?: boolean - /** axios.get(slots.json) rejects -> the slots query errors. */ - failSlots?: boolean - /** The essentialConsts fetch resolves non-ok -> the consts query errors. */ - failConsts?: boolean - /** axios.get(products.json) never resolves -> the products query stays loading. */ - pendingProducts?: boolean - /** axios.get(slots.json) never resolves -> the slots query stays loading. */ - pendingSlots?: boolean -} - -/** - * Install the fetch + axios stubs and return the handles for assertions. - * Call from beforeEach so each test starts from a clean call history. - */ -export function setupApiMocks(opts: ApiMockOptions = {}) { - const axios = require('axios') - - const constsData = opts.consts ?? ESSENTIAL_CONSTS_DATA - const orders = opts.orders ?? [] - - const baseProducts = (opts.products ?? products) as { tags?: unknown[] } - const productsBody = opts.extraTags?.length - ? { ...baseProducts, tags: [...(baseProducts.tags ?? []), ...opts.extraTags] } - : baseProducts - - /** Route a CDN file name to its mock response. */ - const mockForCacheFile = (url: string): unknown => { - if (url.includes('products.json')) return productsBody - if (/stores\/\d+\.json/.test(url)) return opts.storeProducts ?? storeProducts - if (url.includes('stores.json')) return opts.stores ?? stores - if (url.includes('slots.json')) return mockSlots - if (url.includes('availability.json')) return availability - throw new Error(`[tests] unmocked assets request: ${url}`) - } - - axios.get.mockImplementation(async (url: string) => { - const target = String(url) - - if (target.includes('products.json')) { - if (opts.pendingProducts) return new Promise(() => {}) - if (opts.failProducts) throw new Error('products request failed') - } - - if (opts.failStores && target.includes('stores')) { - throw new Error('stores request failed') - } - - if (target.includes('slots.json')) { - if (opts.pendingSlots) return new Promise(() => {}) - if (opts.failSlots) throw new Error('slots request failed') - } - - return { - data: mockForCacheFile(target), - status: 200, - statusText: 'OK', - headers: {}, - config: {}, - } - }) - - /** Resolve one procedure name from a (possibly batched) tRPC request. */ - const resolveProcedure = (name: string, input: unknown): unknown => { - const override = opts.procedures?.[name] - if (override !== undefined) { - return typeof override === 'function' - ? (override as (value: unknown) => unknown)(input) - : override - } - - if (name === 'common.essentialConsts') return constsData - if (name === 'user.order.getOrders' && opts.orders !== undefined) { - return { data: orders } - } - - // Region/location plumbing used by useRegion, the region gate and the - // address form. Tests can still override any of these via `procedures`. - if (name === 'common.listRegions') return MOCK_REGIONS - if (name === 'common.activeBound') return { boundId: 1 } - if (name === 'common.resolveRegionByLocation') { - return { region: MOCK_REGIONS[0], bound: { id: 1 } } - } - if (name === 'common.resolveBound') return { boundId: 1 } - if (name === 'user.address.getDefaultAddress') return { data: MOCK_ADDRESS } - if (name === 'user.address.getUserAddresses') return { data: [MOCK_ADDRESS] } - - throw new Error( - `[tests] unmocked trpc procedure: ${name} (add it to setupApiMocks({ procedures }))` - ) - } - - const fetchMock = jest.fn( - async (url: string, options?: { method?: string; body?: unknown }) => { - const target = String(url) - - if (opts.failConsts && target.includes('common.essentialConsts')) { - return errorResponse(500, 'consts request failed') - } - - // The path after /api/trpc/ is a comma-separated list of procedure names - // (httpBatchLink batches every operation issued in the same tick). - const calls = parseTrpcUrl(target, options?.body) - if (calls.length === 0) { - // Presigned S3 uploads (useUploadToObjectStorage) PUT straight to a URL. - if (options?.method === 'PUT') return jsonResponse({}) - throw new Error(`[tests] unmocked fetch: ${url}`) - } - - const batch = calls.map(({ name, input }) => ({ - result: { data: resolveProcedure(name, input) }, - })) - return jsonResponse(batch) - } - ) - - ;(global as unknown as { fetch: unknown }).fetch = fetchMock - - return { fetchMock, axiosGet: axios.get } -} diff --git a/apps/user-ui/tests/mocks/auth.ts b/apps/user-ui/tests/mocks/auth.ts deleted file mode 100644 index ed0b4ce..0000000 --- a/apps/user-ui/tests/mocks/auth.ts +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Overridable AuthContext mock with spies. - * - * tests/setup.ts stubs @/src/contexts/AuthContext with this factory so a test - * can flip the signed-in shape and assert that a button called login/register/ - * logout. Auth is otherwise out of scope: the real provider would drag in - * secure-store, the tRPC login flow and redirect handling. - * - * Mutate the state fields in a beforeEach and reset with resetAuthMock(). - * The jest.fn spies are cleared automatically by `clearMocks: true`. - */ - -import type { ReactNode } from 'react' - -export interface AuthMockState { - user: unknown - userDetails: unknown - isLoading: boolean - token: unknown - loginWithToken: jest.Mock - login: jest.Mock - register: jest.Mock - logout: jest.Mock - updateUserDetails: jest.Mock -} - -export const authMock: AuthMockState = { - user: null, - userDetails: null, - isLoading: false, - token: null, - loginWithToken: jest.fn(), - login: jest.fn(), - register: jest.fn(), - logout: jest.fn(), - updateUserDetails: jest.fn(), -} - -export function resetAuthMock() { - authMock.user = null - authMock.userDetails = null - authMock.isLoading = false - authMock.token = null -} - -export function authContextMock() { - return { - AuthProvider: ({ children }: { children?: ReactNode }) => children ?? null, - useAuth: () => ({ - user: authMock.user, - userDetails: authMock.userDetails, - isAuthenticated: !!authMock.user, - isLoading: authMock.isLoading, - token: authMock.token, - loginWithToken: authMock.loginWithToken, - login: authMock.login, - register: authMock.register, - logout: authMock.logout, - updateUserDetails: authMock.updateUserDetails, - }), - useUserDetails: () => authMock.userDetails, - } -} diff --git a/apps/user-ui/tests/mocks/mock-availability-response.json b/apps/user-ui/tests/mocks/mock-availability-response.json deleted file mode 100644 index 97d5a7a..0000000 --- a/apps/user-ui/tests/mocks/mock-availability-response.json +++ /dev/null @@ -1,1346 +0,0 @@ -{ - "availability": [ - { - "id": 1, - "price": 99, - "marketPrice": 110, - "flashPrice": null, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 2, - "price": 215, - "marketPrice": 220, - "flashPrice": 215, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 3, - "price": 99, - "marketPrice": 120, - "flashPrice": 120, - "isFlashAvailable": false, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 4, - "price": 839, - "marketPrice": 860, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 5, - "price": 15, - "marketPrice": 19, - "flashPrice": 15, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 6, - "price": 109, - "marketPrice": 120, - "flashPrice": null, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 7, - "price": 69, - "marketPrice": 79, - "flashPrice": 69, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 8, - "price": 129, - "marketPrice": 139, - "flashPrice": 129, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 9, - "price": 296, - "marketPrice": 340, - "flashPrice": 320, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 10, - "price": 269, - "marketPrice": 299, - "flashPrice": 269, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 11, - "price": 119, - "marketPrice": 150, - "flashPrice": 150, - "isFlashAvailable": true, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 12, - "price": 850, - "marketPrice": 870, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 13, - "price": 79, - "marketPrice": 89, - "flashPrice": 79, - "isFlashAvailable": false, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 14, - "price": 419, - "marketPrice": 450, - "flashPrice": 430, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 15, - "price": 210, - "marketPrice": 250, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 16, - "price": 16, - "marketPrice": 20, - "flashPrice": 16, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 17, - "price": 28, - "marketPrice": 35, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 18, - "price": 59, - "marketPrice": 69, - "flashPrice": 65, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 19, - "price": 15, - "marketPrice": 19, - "flashPrice": 19, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 20, - "price": 379, - "marketPrice": 400, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 21, - "price": 499, - "marketPrice": 519, - "flashPrice": 499, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 22, - "price": 649, - "marketPrice": 799, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 23, - "price": 129, - "marketPrice": 135, - "flashPrice": 129, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 24, - "price": 215, - "marketPrice": 230, - "flashPrice": 215, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 25, - "price": 119, - "marketPrice": 130, - "flashPrice": null, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 26, - "price": 78, - "marketPrice": 94, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 27, - "price": 13, - "marketPrice": 19, - "flashPrice": 13, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 28, - "price": 729, - "marketPrice": 799, - "flashPrice": 729, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 29, - "price": 29, - "marketPrice": 32, - "flashPrice": null, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 30, - "price": 17, - "marketPrice": 20, - "flashPrice": 17, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 31, - "price": 13, - "marketPrice": 16, - "flashPrice": 13, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 32, - "price": 19, - "marketPrice": 25, - "flashPrice": 19, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 33, - "price": 15, - "marketPrice": 20, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 34, - "price": 362, - "marketPrice": 399, - "flashPrice": 362, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 35, - "price": 429, - "marketPrice": 450, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 36, - "price": 269, - "marketPrice": 289, - "flashPrice": 269, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 37, - "price": 49, - "marketPrice": 59, - "flashPrice": 49, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 38, - "price": 76, - "marketPrice": 85, - "flashPrice": null, - "isFlashAvailable": true, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 39, - "price": 119, - "marketPrice": 140, - "flashPrice": 129, - "isFlashAvailable": true, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 40, - "price": 129, - "marketPrice": 135, - "flashPrice": 129, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 41, - "price": 215, - "marketPrice": 230, - "flashPrice": 215, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 42, - "price": 119, - "marketPrice": 129, - "flashPrice": 119, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 43, - "price": 135, - "marketPrice": 160, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 44, - "price": 159, - "marketPrice": 170, - "flashPrice": 159, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 45, - "price": 15, - "marketPrice": 16, - "flashPrice": 15, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 46, - "price": 109, - "marketPrice": 130, - "flashPrice": null, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 47, - "price": 119, - "marketPrice": 130, - "flashPrice": null, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 48, - "price": 59, - "marketPrice": 68, - "flashPrice": 59, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 49, - "price": 159, - "marketPrice": 179, - "flashPrice": 159, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 50, - "price": 119, - "marketPrice": 128, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 51, - "price": 169, - "marketPrice": 180, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 52, - "price": 29, - "marketPrice": 40, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 53, - "price": 89, - "marketPrice": 109, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 54, - "price": 280, - "marketPrice": 310, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 55, - "price": 69, - "marketPrice": 80, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 56, - "price": 67, - "marketPrice": 72, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 57, - "price": 59, - "marketPrice": 69, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 58, - "price": 59, - "marketPrice": 75, - "flashPrice": 59, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 59, - "price": 120, - "marketPrice": 130, - "flashPrice": 120, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 60, - "price": 79, - "marketPrice": 89, - "flashPrice": 79, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 61, - "price": 109, - "marketPrice": 119, - "flashPrice": 119, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 62, - "price": 99, - "marketPrice": 110, - "flashPrice": null, - "isFlashAvailable": true, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 63, - "price": 269, - "marketPrice": 289, - "flashPrice": null, - "isFlashAvailable": true, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 64, - "price": 69, - "marketPrice": 76, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 65, - "price": 16, - "marketPrice": 20, - "flashPrice": 17, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 66, - "price": 29, - "marketPrice": 35, - "flashPrice": 30, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 67, - "price": 35, - "marketPrice": 39, - "flashPrice": 35, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 68, - "price": 32, - "marketPrice": 34, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 69, - "price": 15, - "marketPrice": 19, - "flashPrice": 19, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 70, - "price": 19, - "marketPrice": 25, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 71, - "price": 15, - "marketPrice": 22, - "flashPrice": null, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 72, - "price": 15, - "marketPrice": 20, - "flashPrice": 15, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 73, - "price": 59, - "marketPrice": 70, - "flashPrice": null, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 74, - "price": 29, - "marketPrice": 35, - "flashPrice": 29, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 75, - "price": 529, - "marketPrice": 599, - "flashPrice": 529, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 76, - "price": 29, - "marketPrice": 39, - "flashPrice": 39, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 77, - "price": 15, - "marketPrice": 20, - "flashPrice": 15, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 78, - "price": 15, - "marketPrice": 19, - "flashPrice": 15, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 79, - "price": 39, - "marketPrice": 47, - "flashPrice": null, - "isFlashAvailable": true, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 80, - "price": 799, - "marketPrice": 569, - "flashPrice": 819, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 81, - "price": 569, - "marketPrice": 599, - "flashPrice": 569, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 82, - "price": 389, - "marketPrice": 419, - "flashPrice": 420, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 83, - "price": 210, - "marketPrice": 230, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 84, - "price": 129, - "marketPrice": 149, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 85, - "price": 259, - "marketPrice": 270, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 86, - "price": 439, - "marketPrice": 440, - "flashPrice": 439, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 87, - "price": 259, - "marketPrice": 300, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 88, - "price": 99, - "marketPrice": 110, - "flashPrice": null, - "isFlashAvailable": true, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 89, - "price": 13, - "marketPrice": 16, - "flashPrice": 13, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 90, - "price": 27, - "marketPrice": 29, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 91, - "price": 39, - "marketPrice": 44, - "flashPrice": null, - "isFlashAvailable": true, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 92, - "price": 35, - "marketPrice": 39, - "flashPrice": 39, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 93, - "price": 89, - "marketPrice": 96, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 94, - "price": 15, - "marketPrice": 19, - "flashPrice": 15, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 95, - "price": 15, - "marketPrice": 19, - "flashPrice": 15, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 96, - "price": 109, - "marketPrice": 120, - "flashPrice": null, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 97, - "price": 19, - "marketPrice": 25, - "flashPrice": null, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 98, - "price": 419, - "marketPrice": 449, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 99, - "price": 635, - "marketPrice": 660, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 100, - "price": 109, - "marketPrice": 119, - "flashPrice": 109, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 101, - "price": 19, - "marketPrice": 23, - "flashPrice": 20, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 102, - "price": 498, - "marketPrice": 520, - "flashPrice": 499, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 103, - "price": 29, - "marketPrice": 35, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 104, - "price": 49, - "marketPrice": 59, - "flashPrice": null, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 105, - "price": 59, - "marketPrice": 65, - "flashPrice": 59, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 106, - "price": 49, - "marketPrice": 59, - "flashPrice": 49, - "isFlashAvailable": true, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 107, - "price": 49, - "marketPrice": 59, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 108, - "price": 39, - "marketPrice": 49, - "flashPrice": null, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 109, - "price": 49, - "marketPrice": 59, - "flashPrice": 49, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 110, - "price": 49, - "marketPrice": 59, - "flashPrice": null, - "isFlashAvailable": true, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 111, - "price": 29, - "marketPrice": 39, - "flashPrice": null, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 112, - "price": 109, - "marketPrice": 120, - "flashPrice": 110, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 113, - "price": 39, - "marketPrice": 49, - "flashPrice": null, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 114, - "price": 49, - "marketPrice": 56, - "flashPrice": null, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 115, - "price": 99, - "marketPrice": 109, - "flashPrice": null, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 116, - "price": 29, - "marketPrice": 39, - "flashPrice": null, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 117, - "price": 59, - "marketPrice": 69, - "flashPrice": null, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 118, - "price": 39, - "marketPrice": 49, - "flashPrice": null, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 119, - "price": 119, - "marketPrice": 129, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 120, - "price": 119, - "marketPrice": 129, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 121, - "price": 49, - "marketPrice": 59, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 122, - "price": 59, - "marketPrice": 65, - "flashPrice": 65, - "isFlashAvailable": false, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 123, - "price": 111, - "marketPrice": 121, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 124, - "price": 69, - "marketPrice": 79, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 125, - "price": 169, - "marketPrice": 199, - "flashPrice": 169, - "isFlashAvailable": true, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 126, - "price": 169, - "marketPrice": 199, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": true, - "isSuspended": false - }, - { - "id": 127, - "price": 33, - "marketPrice": 38, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 128, - "price": 589, - "marketPrice": 799, - "flashPrice": 625, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 129, - "price": 249, - "marketPrice": 299, - "flashPrice": 249, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 130, - "price": 300, - "marketPrice": 315, - "flashPrice": 269, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 131, - "price": 149, - "marketPrice": 189, - "flashPrice": 169, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 132, - "price": 299, - "marketPrice": 329, - "flashPrice": 310, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 133, - "price": 712, - "marketPrice": 759, - "flashPrice": 720, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 134, - "price": 169, - "marketPrice": 200, - "flashPrice": 179, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 135, - "price": 375, - "marketPrice": 399, - "flashPrice": 375, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 136, - "price": 199, - "marketPrice": 319, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 137, - "price": 259, - "marketPrice": 269, - "flashPrice": 259, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 138, - "price": 339, - "marketPrice": 359, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 139, - "price": 119, - "marketPrice": 139, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 140, - "price": 129, - "marketPrice": 169, - "flashPrice": 129, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 141, - "price": 399, - "marketPrice": 429, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 142, - "price": 219, - "marketPrice": 249, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 143, - "price": 210, - "marketPrice": 229, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 144, - "price": 15, - "marketPrice": 19, - "flashPrice": 19, - "isFlashAvailable": true, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 145, - "price": 15, - "marketPrice": 19, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 146, - "price": 15, - "marketPrice": 19, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 147, - "price": 129, - "marketPrice": 149, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 148, - "price": 59, - "marketPrice": 49, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - }, - { - "id": 149, - "price": 149, - "marketPrice": 219, - "flashPrice": null, - "isFlashAvailable": false, - "isOutOfStock": false, - "isSuspended": false - } - ], - "count": 149 -} \ No newline at end of file diff --git a/apps/user-ui/tests/mocks/mock-products-response.json b/apps/user-ui/tests/mocks/mock-products-response.json deleted file mode 100644 index 6e3734d..0000000 --- a/apps/user-ui/tests/mocks/mock-products-response.json +++ /dev/null @@ -1,3537 +0,0 @@ -{ - "products": [ - { - "id": 1, - "name": "Chicken Liver", - "shortDescription": "Liver sourced from the farm hens.", - "unit": "0.5Kg", - "unitNotation": "0.5Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": null, - "images": [ - "https://assets.freshyo.in/product-images/1768478127128-0", - "https://assets.freshyo.in/product-images/1768478472220-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 99, - "marketPrice": 110, - "flashPrice": null, - "isFlashAvailable": true - }, - { - "id": 2, - "name": "Chicken Breast 500 g", - "shortDescription": "Farm Chicken Breast uncut and solid.", - "unit": "0.5Kg", - "unitNotation": "0.5Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768397780093-0", - "https://assets.freshyo.in/product-images/1768479562478-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 215, - "marketPrice": 220, - "flashPrice": 215, - "isFlashAvailable": true - }, - { - "id": 3, - "name": "Chicken Lollipops", - "shortDescription": "Chicken cut for lollipop starter dish", - "unit": "0.25Kg", - "unitNotation": "0.25Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": true, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768475599800-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 99, - "marketPrice": 120, - "flashPrice": 120, - "isFlashAvailable": false - }, - { - "id": 4, - "name": "Mutton", - "shortDescription": "Fresh, tender mutton cut from quality goat meat, cleaned and prepared hygienically for rich taste and authentic curries.", - "unit": "1Kg", - "unitNotation": "1Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T06:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1767636171845-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 839, - "marketPrice": 860, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 5, - "name": "Cucumber(Kheera)", - "shortDescription": "High water content, helps hydration, and keeps the body cool.", - "unit": "0.25Kg", - "unitNotation": "0.25Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768710099841-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 15, - "marketPrice": 19, - "flashPrice": 15, - "isFlashAvailable": true - }, - { - "id": 6, - "name": "Apple ( pack of 3) ", - "shortDescription": "Kashmiri Apples", - "unit": "3Pc", - "unitNotation": "3Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T06:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768640936747-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 109, - "marketPrice": 120, - "flashPrice": null, - "isFlashAvailable": true - }, - { - "id": 7, - "name": "Banana", - "shortDescription": "Fresh bananas with a naturally sweet taste and soft, creamy texture.", - "unit": "1Dz", - "unitNotation": "1Dz", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768640009078-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 69, - "marketPrice": 79, - "flashPrice": 69, - "isFlashAvailable": true - }, - { - "id": 8, - "name": "Kiwi", - "shortDescription": "Fresh kiwis with sweet-tart flavor, juicy green flesh, and edible seeds.", - "unit": "3pc", - "unitNotation": "3pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768647119198-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 129, - "marketPrice": 139, - "flashPrice": 129, - "isFlashAvailable": true - }, - { - "id": 9, - "name": "Apollo Fish", - "shortDescription": "Boneless\nFresh tuna fish, high in protein and omega-3, ideal for curries, grilling, and pan-fry.", - "unit": "0.7Kg", - "unitNotation": "0.7Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768832690994-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 296, - "marketPrice": 340, - "flashPrice": 320, - "isFlashAvailable": true - }, - { - "id": 10, - "name": "Chicken leg piece ", - "shortDescription": "6 pieces ", - "unit": "6Pc", - "unitNotation": "6Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768390245969-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 269, - "marketPrice": 299, - "flashPrice": 269, - "isFlashAvailable": true - }, - { - "id": 11, - "name": "Nagpur orange (pack 5)", - "shortDescription": "Fresh oranges with juicy, sweet-tangy flesh and a refreshing citrus taste.", - "unit": "5Pc", - "unitNotation": "5Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": true, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768641635898-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 119, - "marketPrice": 150, - "flashPrice": 150, - "isFlashAvailable": true - }, - { - "id": 12, - "name": "Lamb Mutton", - "shortDescription": "", - "unit": "1Kg", - "unitNotation": "1Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": true, - "nextDeliveryDate": null, - "images": [ - "https://assets.freshyo.in/product-images/1764500702143-0", - "https://assets.freshyo.in/product-images/1764500702144-1" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 850, - "marketPrice": 870, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 13, - "name": "Amla (Gooseberry)", - "shortDescription": "Fresh amla with a tangy, slightly sour taste and firm texture.", - "unit": "0.5Kg", - "unitNotation": "0.5Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": true, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768641988607-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 79, - "marketPrice": 89, - "flashPrice": 79, - "isFlashAvailable": false - }, - { - "id": 14, - "name": "Mutton Boti (Goat Intestines)", - "shortDescription": "Fresh mutton boti, rich in protein and iron, ideal for traditional curries and spicy dishes.", - "unit": "1Kg", - "unitNotation": "1Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T06:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768834170995-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 419, - "marketPrice": 450, - "flashPrice": 430, - "isFlashAvailable": false - }, - { - "id": 15, - "name": "Chicken Gizard", - "shortDescription": "Fresh, cleaned chicken gizzards with a rich, meaty texture-ideal for curries, fry recipes, and traditional dishes.", - "unit": "1Kg", - "unitNotation": "1Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": true, - "nextDeliveryDate": null, - "images": [ - "https://assets.freshyo.in/product-images/1768477813647-0", - "https://assets.freshyo.in/product-images/1768477813648-1" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 210, - "marketPrice": 250, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 16, - "name": "Arvi (Arbi) – Colocasia Root", - "shortDescription": "Fresh arvi with soft texture when cooked, ideal for curries, fries, and dry sabzi.", - "unit": "0.25Kg", - "unitNotation": "0.25Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1769397372526-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 16, - "marketPrice": 20, - "flashPrice": 16, - "isFlashAvailable": false - }, - { - "id": 17, - "name": "Tomato ", - "shortDescription": "Healthy, tasty, and fresh tomatoes", - "unit": "1Kg", - "unitNotation": "1Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": true, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768640233068-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 28, - "marketPrice": 35, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 18, - "name": "Onions ", - "shortDescription": "Fresh and flavorful onions for everyday cooking.", - "unit": "1Kg", - "unitNotation": "1Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1769351976737-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 59, - "marketPrice": 69, - "flashPrice": 65, - "isFlashAvailable": true - }, - { - "id": 19, - "name": "Potato", - "shortDescription": "Fresh, healthy potatoes perfect for every dish.", - "unit": "0.5Kg", - "unitNotation": "0.5Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768639707515-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 15, - "marketPrice": 19, - "flashPrice": 19, - "isFlashAvailable": true - }, - { - "id": 20, - "name": "Mutton Head", - "shortDescription": "Fresh mutton head rich in protein and collagen, ideal for traditional curries and soups.", - "unit": "1Pc", - "unitNotation": "1Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": true, - "nextDeliveryDate": null, - "images": [ - "https://assets.freshyo.in/product-images/1769353802270-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 379, - "marketPrice": 400, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 21, - "name": "Whole chicken - fresh cut", - "shortDescription": "Fresh, tender whole chicken cleaned and cut hygienically for rich taste and high protein meals.", - "unit": "2Kg", - "unitNotation": "2Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768539930897-0", - "https://assets.freshyo.in/product-images/1768539930899-1" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 499, - "marketPrice": 519, - "flashPrice": 499, - "isFlashAvailable": false - }, - { - "id": 22, - "name": "Tuna Fish boneless ", - "shortDescription": "Fresh tuna fish, high in protein and omega-3, ideal for curries, grilling, and pan-fry.", - "unit": "0.5Kg", - "unitNotation": "0.5Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": true, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768834996932-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 649, - "marketPrice": 799, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 23, - "name": "Chicken ( regular cut )- Small pieces ", - "shortDescription": "Fresh, bone-in chicken pieces ideal for making rich and flavorful curries.", - "unit": "0.5Kg", - "unitNotation": "0.5Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1767635527063-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 127, - "marketPrice": 135, - "flashPrice": 127, - "isFlashAvailable": true - }, - { - "id": 24, - "name": "Chicken boneless", - "shortDescription": "Fresh, tender boneless chicken pieces, perfectly trimmed for quick cooking. Ideal for curries, stir-fries, grills, and biryanis.", - "unit": "0.5Kg", - "unitNotation": "0.5Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768484106870-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 215, - "marketPrice": 230, - "flashPrice": 215, - "isFlashAvailable": true - }, - { - "id": 25, - "name": "White Dragon Fruit", - "shortDescription": "Fresh white dragon fruit with mild sweetness and soft, juicy flesh.", - "unit": "1Pc", - "unitNotation": "1Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768649838027-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 119, - "marketPrice": 130, - "flashPrice": null, - "isFlashAvailable": true - }, - { - "id": 26, - "name": "Fig (Anjeer)", - "shortDescription": "Fresh fig with a soft flesh and mild, naturally sweet flavor.", - "unit": "0.25Kg", - "unitNotation": "0.25Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768640645444-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 78, - "marketPrice": 94, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 27, - "name": "Brinjal ", - "shortDescription": "Fresh medium-sized brinjal, rich in fiber, low in calories, and ideal for everyday curries and fries.", - "unit": "0.25Kg", - "unitNotation": "0.25Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768639645423-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 13, - "marketPrice": 19, - "flashPrice": 13, - "isFlashAvailable": true - }, - { - "id": 28, - "name": "Mutton Boneless ", - "shortDescription": "Tender boneless mutton rich in protein, ideal for quick curries, fry, and kebabs.", - "unit": "0.5Kg", - "unitNotation": "0.5Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1769356702593-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 729, - "marketPrice": 799, - "flashPrice": 729, - "isFlashAvailable": false - }, - { - "id": 29, - "name": " Bottle Gourd (Lauki)", - "shortDescription": "Fresh medium-sized bottle gourd, low in calories, high in water content, easy to digest, and ideal for healthy everyday cooking.", - "unit": "1Pc", - "unitNotation": "1Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768823985921-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 29, - "marketPrice": 32, - "flashPrice": null, - "isFlashAvailable": true - }, - { - "id": 30, - "name": " Bitter Gourd (Karela)", - "shortDescription": "Fresh bitter gourd, known to help control blood sugar and support digestion.", - "unit": "0.25Kg", - "unitNotation": "0.25Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768726783083-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 17, - "marketPrice": 20, - "flashPrice": 17, - "isFlashAvailable": true - }, - { - "id": 31, - "name": "Lady Finger (Okra / Bhindi)", - "shortDescription": "Fresh tender lady finger, soft and non-fibrous, ideal for fries and curries.", - "unit": "0.25Kg", - "unitNotation": "0.25Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1769574792720-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 13, - "marketPrice": 16, - "flashPrice": 13, - "isFlashAvailable": true - }, - { - "id": 32, - "name": "Lemons ", - "shortDescription": "Farm-fresh lemons with high juice content and natural tangy flavor. Perfect for daily cooking, juices, and salads.", - "unit": "3Pc", - "unitNotation": "3Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1766406273176-0", - "https://assets.freshyo.in/product-images/1766406273178-1" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 19, - "marketPrice": 25, - "flashPrice": 19, - "isFlashAvailable": true - }, - { - "id": 33, - "name": "Small Methi / Baby Fenugreek Leaves", - "shortDescription": "Fresh small methi leaves with a mild bitterness, perfect for everyday cooking and quick stir-fries.", - "unit": "8Pc", - "unitNotation": "8Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1769396046557-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 15, - "marketPrice": 20, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 34, - "name": " Mutton Boneless – Mini Pack", - "shortDescription": "Tender boneless mutton, high in protein, easy to cook, ideal for quick curries and fry.", - "unit": "0.25Kg", - "unitNotation": "0.25Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": null, - "images": [ - "https://assets.freshyo.in/product-images/1769356039418-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 362, - "marketPrice": 399, - "flashPrice": 362, - "isFlashAvailable": false - }, - { - "id": 35, - "name": "Mutton kheema", - "shortDescription": "Freshly minced premium mutton, finely ground for rich flavor and juicy texture—perfect for kebabs, keema curry, cutlets, and stuffing.", - "unit": "0.5Kg", - "unitNotation": "0.5Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T06:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1767636561867-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 429, - "marketPrice": 450, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 36, - "name": "Chicken Leg With Thigh Pack of 3", - "shortDescription": "Fresh chicken leg with thigh, cut from tender, juicy chicken. Rich in flavor, naturally succulent, and ideal for frying, roasting, grilling, and curries.", - "unit": "1Kg", - "unitNotation": "1Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768413754684-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 269, - "marketPrice": 289, - "flashPrice": 269, - "isFlashAvailable": true - }, - { - "id": 37, - "name": "Drum sticks ", - "shortDescription": "Rich in fiber, vitamins, supports digestion.", - "unit": "6Pc", - "unitNotation": "6Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1766636589779-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 49, - "marketPrice": 59, - "flashPrice": 49, - "isFlashAvailable": false - }, - { - "id": 38, - "name": "Sapota (Chikoo)", - "shortDescription": "Fresh sapota with a soft texture and naturally sweet, malty flavor.", - "unit": "1Kg", - "unitNotation": "1Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": true, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768640403001-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 76, - "marketPrice": 85, - "flashPrice": null, - "isFlashAvailable": true - }, - { - "id": 39, - "name": "Mango", - "shortDescription": "Fresh seasonal mangoes with juicy flesh and natural sweetness.", - "unit": "1Kg", - "unitNotation": "1Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": true, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768650081183-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 119, - "marketPrice": 140, - "flashPrice": 129, - "isFlashAvailable": true - }, - { - "id": 40, - "name": "Chicken (regular cut) Large pieces ", - "shortDescription": "Fresh chicken curry cut with large pieces, high in protein and ideal for rich gravies and slow cooking.", - "unit": "0.5Kg", - "unitNotation": "0.5Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1767637606890-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 127, - "marketPrice": 135, - "flashPrice": 127, - "isFlashAvailable": true - }, - { - "id": 41, - "name": "Chicken mince/kheema 500 g", - "shortDescription": "Fresh, lean chicken mince made from premium chicken meat. Finely ground, high in protein, low in fat—perfect for kebabs, cutlets, burgers, curries, and wraps.", - "unit": "0.5Kg", - "unitNotation": "0.5Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768307047191-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 215, - "marketPrice": 230, - "flashPrice": 215, - "isFlashAvailable": true - }, - { - "id": 42, - "name": "Chicken Breast Boneless - Mini Pack", - "shortDescription": "Fresh boneless chicken breast mini pack. Lean, tender, and high in protein—perfect for quick meals, salads, grilling, and stir-fries.", - "unit": "0.25Kg", - "unitNotation": "0.25Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768393778962-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 119, - "marketPrice": 129, - "flashPrice": 119, - "isFlashAvailable": true - }, - { - "id": 43, - "name": "Strawberry ", - "shortDescription": "Fresh, juicy strawberries with a natural sweetness and soft bite. Handpicked for vibrant color, rich aroma, and everyday freshness.", - "unit": "0.2Kg", - "unitNotation": "0.2Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": true, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768638795991-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 135, - "marketPrice": 160, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 44, - "name": " Oranges (pack of 5)", - "shortDescription": "Fresh, juicy oranges with a natural balance of sweetness and tang. Perfect for snacking or fresh juice.", - "unit": "5Pc", - "unitNotation": "5Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768639090932-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 129, - "marketPrice": 139, - "flashPrice": 139, - "isFlashAvailable": true - }, - { - "id": 45, - "name": "Tomato\n", - "shortDescription": "Indian Tomato\n\nJuicy, tangy & ideal for all Indian curries\n500 g", - "unit": "0.5Kg", - "unitNotation": "0.5Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768639292540-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 15, - "marketPrice": 16, - "flashPrice": 15, - "isFlashAvailable": true - }, - { - "id": 46, - "name": "Pomegranate ", - "shortDescription": "Fresh pomegranate with deep red seeds and a naturally sweet-tangy taste.", - "unit": "3Pc", - "unitNotation": "3Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768639705530-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 109, - "marketPrice": 130, - "flashPrice": null, - "isFlashAvailable": true - }, - { - "id": 47, - "name": "Green Apple (pack 2) ", - "shortDescription": "Crisp green apples with a tangy-sweet taste and firm, juicy texture.", - "unit": "2Pc", - "unitNotation": "2Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768642455479-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 119, - "marketPrice": 130, - "flashPrice": null, - "isFlashAvailable": true - }, - { - "id": 48, - "name": "Guava (Jama Kaya)", - "shortDescription": "Fresh guavas with a sweet-tangy flavor and crisp, juicy texture.", - "unit": "0.5Kg", - "unitNotation": "0.5Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768642724520-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 59, - "marketPrice": 68, - "flashPrice": 59, - "isFlashAvailable": true - }, - { - "id": 49, - "name": "Pear", - "shortDescription": "Fresh pears with soft, juicy texture and a naturally sweet flavor.", - "unit": "3Pc", - "unitNotation": "3Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768643138910-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 159, - "marketPrice": 179, - "flashPrice": 159, - "isFlashAvailable": true - }, - { - "id": 50, - "name": "Alu Bukhara (Plum / Prunes)", - "shortDescription": "Fresh plums (Alu Bukhara) with a juicy, sweet‑tart flavor, perfect for snacking or making chutneys and juices.", - "unit": "0.6Kg", - "unitNotation": "0.6Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": true, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768643354251-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 119, - "marketPrice": 128, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 51, - "name": "Shahtoot (Mulberry)", - "shortDescription": "Fresh mulberries with a naturally sweet flavor and juicy, soft texture.", - "unit": "0.25Kg", - "unitNotation": "0.25Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": true, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768646295695-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 169, - "marketPrice": 180, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 52, - "name": "Sugarcane", - "shortDescription": "Fresh sugarcane stalks with natural sweetness, juicy and perfect for chewing or juice extraction.", - "unit": "2Pc", - "unitNotation": "2Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": true, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768646744949-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 29, - "marketPrice": 40, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 53, - "name": "Hass Avocado", - "shortDescription": "Creamy Hass avocados with rich, buttery texture and mild, nutty flavor.", - "unit": "1pc", - "unitNotation": "1pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768646932088-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 89, - "marketPrice": 109, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 54, - "name": "Blueberry", - "shortDescription": "Fresh blueberries with a sweet-tart flavor, juicy texture, and rich purple color.", - "unit": "0.15Kg", - "unitNotation": "0.15Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768649454994-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 280, - "marketPrice": 310, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 55, - "name": "Muscat Grapes", - "shortDescription": "Fresh seasonal mangoes with juicy flesh and natural sweetness.", - "unit": "0.25Kg", - "unitNotation": "0.25Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": true, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768650709484-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 69, - "marketPrice": 80, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 56, - "name": "Muskmelon (Kharbuja)", - "shortDescription": "For bigger-sized muskmelon, choose the 1 kg option.", - "unit": "1Kg", - "unitNotation": "1Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768651334320-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 67, - "marketPrice": 72, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 57, - "name": "Pineapple", - "shortDescription": "Note: This is a medium-size pineapple.", - "unit": "1Pc", - "unitNotation": "1Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": true, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768651774899-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 59, - "marketPrice": 69, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 58, - "name": "Papaya", - "shortDescription": "Note: This is a medium-size papaya.", - "unit": "1Pc", - "unitNotation": "1Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768652061701-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 59, - "marketPrice": 75, - "flashPrice": 59, - "isFlashAvailable": true - }, - { - "id": 59, - "name": "Watermelon", - "shortDescription": "Add 1kg if you want watermelon in big size", - "unit": "3Kg", - "unitNotation": "3Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768653009851-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 120, - "marketPrice": 130, - "flashPrice": 120, - "isFlashAvailable": true - }, - { - "id": 60, - "name": "Green Grapes", - "shortDescription": "Supports immunity, provides natural energy, and is rich in antioxidants.", - "unit": "0.5Kg", - "unitNotation": "0.5Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768653997561-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 79, - "marketPrice": 89, - "flashPrice": 79, - "isFlashAvailable": true - }, - { - "id": 61, - "name": "Red Globe Grapes", - "shortDescription": "High in antioxidants, supports immunity, and provides natural energy. Seeded", - "unit": "0.25Kg", - "unitNotation": "0.25Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768654475850-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 109, - "marketPrice": 119, - "flashPrice": 119, - "isFlashAvailable": true - }, - { - "id": 62, - "name": "Black beauty Grapes", - "shortDescription": "Supports immunity, rich in antioxidants, and provides natural energy.", - "unit": "0.25Kg", - "unitNotation": "0.25Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": true, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768654740988-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 99, - "marketPrice": 110, - "flashPrice": null, - "isFlashAvailable": true - }, - { - "id": 63, - "name": "Pink Dragon Fruit", - "shortDescription": "Boosts immunity, rich in antioxidants, supports digestion, and provides natural energy.", - "unit": "2Pc", - "unitNotation": "2Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": true, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768658094891-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 269, - "marketPrice": 289, - "flashPrice": null, - "isFlashAvailable": true - }, - { - "id": 64, - "name": "Broccoli", - "shortDescription": "Note: This is a medium-size broccoli.\nRich in fiber and vitamins, supports digestion and overall nutrition.", - "unit": "1Pc", - "unitNotation": "1Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": true, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768709567040-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 69, - "marketPrice": 76, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 65, - "name": "Beetroot", - "shortDescription": "Supports blood health, rich in fiber, and helps maintain energy levels.", - "unit": "0.25Kg", - "unitNotation": "0.25Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768710434326-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 16, - "marketPrice": 20, - "flashPrice": 17, - "isFlashAvailable": true - }, - { - "id": 66, - "name": "Cabbage(Patta Gobhi)", - "shortDescription": "Note: This is a medium-size cabbage.\nRich in fiber, supports digestion, and low in calories.", - "unit": "1Pc", - "unitNotation": "1Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768710760133-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 29, - "marketPrice": 35, - "flashPrice": 30, - "isFlashAvailable": true - }, - { - "id": 67, - "name": "Cauliflower(Phool Gobhi)", - "shortDescription": "Note: This is a medium-size cauliflower.\nHigh in fiber and vitamin C, supports digestion and immunity.", - "unit": "1Pc", - "unitNotation": "1Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768711261174-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 35, - "marketPrice": 39, - "flashPrice": 35, - "isFlashAvailable": true - }, - { - "id": 68, - "name": "Sweet Potato", - "shortDescription": "High in fiber, supports digestion, and provides natural energy.", - "unit": "0.5Kg", - "unitNotation": "0.5Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": true, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768711919135-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 32, - "marketPrice": 34, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 69, - "name": "Carrot", - "shortDescription": "Rich in vitamin A, supports eye health and immunity.", - "unit": "0.25Kg", - "unitNotation": "0.25Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768712093829-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 15, - "marketPrice": 19, - "flashPrice": 19, - "isFlashAvailable": true - }, - { - "id": 70, - "name": "White Radish(Mooli)", - "shortDescription": "Aids digestion, rich in fibre, supports gut health.", - "unit": "2Pc", - "unitNotation": "2Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768712490280-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 19, - "marketPrice": 25, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 71, - "name": "Curry Leaves(Karivepak)\n", - "shortDescription": "1 bunch\nAdds aroma, supports digestion, and enhances flavour in cooking.", - "unit": "1Pc", - "unitNotation": "1Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768713206145-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 15, - "marketPrice": 22, - "flashPrice": null, - "isFlashAvailable": true - }, - { - "id": 72, - "name": "Spinach (Palak)", - "shortDescription": "Rich in iron, supports blood health, and boosts immunity.", - "unit": "7Pc", - "unitNotation": "7Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768713537512-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 15, - "marketPrice": 20, - "flashPrice": 15, - "isFlashAvailable": true - }, - { - "id": 73, - "name": "Coconut", - "shortDescription": "Rich in natural electrolytes, supports hydration, and provides energy.", - "unit": "1Pc", - "unitNotation": "1Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768718685357-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 59, - "marketPrice": 70, - "flashPrice": null, - "isFlashAvailable": true - }, - { - "id": 74, - "name": "Fenugreek Leaves(Methi)", - "shortDescription": "Rich in vitamins, supports digestion, and enhances flavor in cooking.", - "unit": "1Pc", - "unitNotation": "1Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768713886512-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 29, - "marketPrice": 35, - "flashPrice": 29, - "isFlashAvailable": false - }, - { - "id": 75, - "name": "Murrel / Korameenu / కోరమీను - Live", - "shortDescription": "Fresh murrel fish, high in protein, known for aiding recovery and boosting strength.", - "unit": "1Kg", - "unitNotation": "1Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": null, - "images": [ - "https://assets.freshyo.in/product-images/1768817786453-0", - "https://assets.freshyo.in/product-images/1768817786455-1" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 529, - "marketPrice": 599, - "flashPrice": 529, - "isFlashAvailable": false - }, - { - "id": 76, - "name": "Coriander Leaves (Kothimeer)", - "shortDescription": "Fresh coriander leaves with a strong aroma, perfect for garnishing and cooking.", - "unit": "1Pc", - "unitNotation": "1Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768727264220-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 29, - "marketPrice": 39, - "flashPrice": 39, - "isFlashAvailable": true - }, - { - "id": 77, - "name": "Gongura (Sorrel Leaves)", - "shortDescription": "Fresh gongura leaves with a natural tangy taste, perfect for traditional Andhra dishes and chutneys.", - "unit": "8Pc", - "unitNotation": "8Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1769396724595-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 15, - "marketPrice": 20, - "flashPrice": 15, - "isFlashAvailable": false - }, - { - "id": 78, - "name": "Green Chillies", - "shortDescription": "Fresh green chillies rich in vitamin C, add heat and flavor to everyday cooking.", - "unit": "0.25Kg", - "unitNotation": "0.25Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1769241234003-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 15, - "marketPrice": 19, - "flashPrice": 15, - "isFlashAvailable": true - }, - { - "id": 79, - "name": "Red Carrot ", - "shortDescription": "Big-sized red carrots with natural sweetness, ideal for salads, juices, and cooking.", - "unit": "0.5Kg", - "unitNotation": "0.5Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": true, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1768822893380-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 39, - "marketPrice": 47, - "flashPrice": null, - "isFlashAvailable": true - }, - { - "id": 80, - "name": "Country Chicken (Desi / Natu Kodi) live .", - "shortDescription": "Fresh country chicken, high in protein and rich in natural flavor, ideal for traditional slow-cooked dishes.", - "unit": "1Kg", - "unitNotation": "1Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1769063336125-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 799, - "marketPrice": 569, - "flashPrice": 819, - "isFlashAvailable": false - }, - { - "id": 81, - "name": "Tigers prawns large ", - "shortDescription": "Premium tiger prawns rich in protein and omega-3, ideal for grilling, frying, and special dishes.", - "unit": "0.8Kg", - "unitNotation": "0.8Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1769063467386-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 569, - "marketPrice": 599, - "flashPrice": 569, - "isFlashAvailable": true - }, - { - "id": 82, - "name": "Fresh Prawns – Medium (Cleaned & Deveined)", - "shortDescription": "High in protein and omega-3, supports muscle growth and heart health.", - "unit": "0.75Kg", - "unitNotation": "0.75Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1782023099986.png" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 389, - "marketPrice": 419, - "flashPrice": 420, - "isFlashAvailable": true - }, - { - "id": 83, - "name": "Rohu- రోహు live ", - "shortDescription": "Fresh rohu fish rich in protein and omega-3, ideal for everyday curries and home cooking.", - "unit": "1Kg", - "unitNotation": "1Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": null, - "images": [ - "https://assets.freshyo.in/product-images/1769149204037-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 210, - "marketPrice": 230, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 84, - "name": "Mutton Brain (Bheja). మటన్ బ్రెయిన్ (భేజా)", - "shortDescription": "Fresh mutton brain, rich in healthy fats and protein, ideal for traditional bheja fry and curries.", - "unit": "1Pc", - "unitNotation": "1Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": null, - "images": [ - "https://assets.freshyo.in/1769149707440-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 129, - "marketPrice": 149, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 85, - "name": "Mutton Paya (Goat Trotters)", - "shortDescription": "Fresh mutton paya rich in collagen and minerals, ideal for nourishing paya soup.", - "unit": "4Pc", - "unitNotation": "4Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": null, - "images": [ - "https://assets.freshyo.in/product-images/1769150471654-0", - "https://assets.freshyo.in/product-images/1769150471655-1" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 259, - "marketPrice": 270, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 86, - "name": "Mutton Chops - మటన్ చాప్స్", - "shortDescription": "Fresh mutton chops, rich in protein and iron, ideal for curries and slow cooking.", - "unit": "0.5Kg", - "unitNotation": "0.5Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T06:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1769151216776-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 439, - "marketPrice": 440, - "flashPrice": 439, - "isFlashAvailable": false - }, - { - "id": 87, - "name": "Mutton Soup Bones -మటన్ సూప్ ఎముకలు", - "shortDescription": "Fresh mutton soup bones rich in collagen and minerals, ideal for nourishing soups and broths.", - "unit": "0.5Kg", - "unitNotation": "0.5Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": null, - "images": [ - "https://assets.freshyo.in/product-images/1769151844424-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 259, - "marketPrice": 300, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 88, - "name": "Purple Cabbage (Red Cabbage)", - "shortDescription": "Medium-sized purple cabbage\nFresh purple cabbage rich in antioxidants and fiber, supports digestion and immunity.", - "unit": "1Pc", - "unitNotation": "1Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": true, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1769394457296-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 99, - "marketPrice": 110, - "flashPrice": null, - "isFlashAvailable": true - }, - { - "id": 89, - "name": "Light Purple Brinjal", - "shortDescription": "Fresh light purple brinjal rich in fiber and antioxidants, ideal for curries and fries.", - "unit": "0.25Kg", - "unitNotation": "0.25Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1769395184980-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 13, - "marketPrice": 16, - "flashPrice": 13, - "isFlashAvailable": false - }, - { - "id": 90, - "name": "Indian Yellow Cucumber (Madras / Dosakai)", - "shortDescription": "Fresh Indian yellow cucumber, also known as Madras cucumber, mild and crisp, perfect for salads, pickles, and cooking.", - "unit": "0.5Kg", - "unitNotation": "0.5Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1769398103853-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 27, - "marketPrice": 29, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 91, - "name": "Green Peas", - "shortDescription": "Fresh green peas with natural sweetness, ideal for curries, pulao, and snacks.", - "unit": "0.5Kg", - "unitNotation": "0.5Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": true, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1769398710713-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 39, - "marketPrice": 44, - "flashPrice": null, - "isFlashAvailable": true - }, - { - "id": 92, - "name": "French Beans (Chikkudukaya)", - "shortDescription": "Fresh Benis with crisp texture, ideal for stir-fries, curries, and salads.", - "unit": "0.25Kg", - "unitNotation": "0.25Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1769399617573-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 35, - "marketPrice": 39, - "flashPrice": 39, - "isFlashAvailable": false - }, - { - "id": 93, - "name": "Red & Yellow Capsicum (Bell Peppers)", - "shortDescription": "Fresh red and yellow capsicum with crisp texture and mild sweetness, perfect for cooking and salads.", - "unit": "0.5Kg", - "unitNotation": "0.5Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": true, - "nextDeliveryDate": null, - "images": [ - "https://assets.freshyo.in/product-images/1769571126092-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 89, - "marketPrice": 96, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 94, - "name": "Gawar Beans (Cluster Beans)", - "shortDescription": "Fresh tender gawar beans, ideal for stir-fries, curries, and traditional dishes.", - "unit": "0.25Kg", - "unitNotation": "0.25Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1769571810861-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 15, - "marketPrice": 19, - "flashPrice": 15, - "isFlashAvailable": false - }, - { - "id": 95, - "name": "Dondakaya (Ivy Gourd)", - "shortDescription": "Fresh tender ivy gourd, ideal for fries, stir-fries, and curries.", - "unit": "0.25Kg", - "unitNotation": "0.25Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1769571978680-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 15, - "marketPrice": 19, - "flashPrice": 15, - "isFlashAvailable": true - }, - { - "id": 96, - "name": "Pineapple – Large", - "shortDescription": "Large-sized fresh pineapple with juicy, sweet-tangy flesh.", - "unit": "1Pc", - "unitNotation": "1Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1769576743718-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 109, - "marketPrice": 120, - "flashPrice": null, - "isFlashAvailable": true - }, - { - "id": 97, - "name": "Pudina (Mint Leaves)", - "shortDescription": "Fresh aromatic mint leaves, ideal for chutneys, curries, and drinks.", - "unit": "1Pc", - "unitNotation": "1Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1769577010969-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 19, - "marketPrice": 25, - "flashPrice": null, - "isFlashAvailable": true - }, - { - "id": 98, - "name": "Mutton Curry Cut (Regular)– 500 g", - "shortDescription": "Fresh mutton curry cut with bone, suitable for everyday curries.", - "unit": "0.5Kg", - "unitNotation": "0.5Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T06:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1770051810386-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 419, - "marketPrice": 449, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 99, - "name": "Mutton Curry Cut (Regular) – 750 g", - "shortDescription": "Fresh mutton curry cut with bone, ideal for family-sized curries.", - "unit": "0.75Kg", - "unitNotation": "0.75Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T06:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1770051959669-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 635, - "marketPrice": 660, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 100, - "name": "Irani Apple. Pack of (4)", - "shortDescription": "Fresh Irani apples with crisp texture and mildly sweet taste.", - "unit": "4Pc", - "unitNotation": "4Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1770212631435-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 109, - "marketPrice": 119, - "flashPrice": 109, - "isFlashAvailable": true - }, - { - "id": 101, - "name": "Coriander Leaves (Kothimeer) small 1 ", - "shortDescription": "", - "unit": "1Pc", - "unitNotation": "1Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1771249922306-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 19, - "marketPrice": 23, - "flashPrice": 20, - "isFlashAvailable": true - }, - { - "id": 102, - "name": " Basa Fish Fillets", - "shortDescription": null, - "unit": "0.7Kg", - "unitNotation": "0.7Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1771411526889-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 498, - "marketPrice": 520, - "flashPrice": 499, - "isFlashAvailable": true - }, - { - "id": 103, - "name": "Ridge Gourd (Turai) ..(Beerkaya)", - "shortDescription": "", - "unit": "0.5Kg", - "unitNotation": "0.5Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1771647812442-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 29, - "marketPrice": 35, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 104, - "name": "Green grape fresh juice", - "shortDescription": "Refreshing juice made from freshly crushed sweet green grapes.", - "unit": "0.2L", - "unitNotation": "0.2L", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 8, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1773126251435-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 49, - "marketPrice": 59, - "flashPrice": null, - "isFlashAvailable": true - }, - { - "id": 105, - "name": "Fresh fig juice (anjeer) ", - "shortDescription": "Naturally sweet juice made from fresh and ripe figs", - "unit": "0.2L", - "unitNotation": "0.2L", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 8, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1773126524403-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 59, - "marketPrice": 65, - "flashPrice": 59, - "isFlashAvailable": true - }, - { - "id": 106, - "name": "Chikoo (sapota)fresh juice", - "shortDescription": "Creamy and naturally sweet juice made juice from fresh ripe chikoo", - "unit": "0.2L", - "unitNotation": "0.2L", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 8, - "isOutOfStock": true, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1773127805418-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 49, - "marketPrice": 59, - "flashPrice": 49, - "isFlashAvailable": true - }, - { - "id": 107, - "name": "Fresh mango juice", - "shortDescription": "Sweet and refreshing juice made from freshly blended ripe mangoes", - "unit": "0.2L", - "unitNotation": "0.2L", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 8, - "isOutOfStock": true, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1773128056033-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 49, - "marketPrice": 59, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 108, - "name": "Fresh orange juice", - "shortDescription": "Refreshing juice made from freshly squeezed sweet oranges", - "unit": "0.2L", - "unitNotation": "0.2L", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 8, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1773128303272-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 39, - "marketPrice": 49, - "flashPrice": null, - "isFlashAvailable": true - }, - { - "id": 109, - "name": "Fresh apple juice", - "shortDescription": "Naturally sweet and refreshing juice made from fresh apples", - "unit": "0.2L", - "unitNotation": "0.2L", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 8, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1773129061191-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 49, - "marketPrice": 59, - "flashPrice": 49, - "isFlashAvailable": true - }, - { - "id": 110, - "name": "Fresh strawberry juice", - "shortDescription": "Sweet and refreshing juice made from fresh ripe strawberries", - "unit": "0.2L", - "unitNotation": "0.2L", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 8, - "isOutOfStock": true, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1773129209100-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 49, - "marketPrice": 59, - "flashPrice": null, - "isFlashAvailable": true - }, - { - "id": 111, - "name": "Fresh watermelon juice", - "shortDescription": "Cool and refreshing juice made from juicy fresh watermelon", - "unit": "0.2L", - "unitNotation": "0.2L", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 8, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1773566003997-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 29, - "marketPrice": 39, - "flashPrice": null, - "isFlashAvailable": true - }, - { - "id": 112, - "name": "Fresh avocado juice", - "shortDescription": "Creamy and nutritious juice made from fresh ripe avocados", - "unit": "0.2L", - "unitNotation": "0.2L", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 8, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1773130741608-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 109, - "marketPrice": 120, - "flashPrice": 110, - "isFlashAvailable": true - }, - { - "id": 113, - "name": "Fresh muskmelon juice", - "shortDescription": "Naturally sweet and refreshing juice made from fresh muskmelon (karbuja) ", - "unit": "0.2L", - "unitNotation": "0.2L", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 8, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1773566035297-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 39, - "marketPrice": 49, - "flashPrice": null, - "isFlashAvailable": true - }, - { - "id": 114, - "name": "Fresh papaya juice", - "shortDescription": "Naturally sweet and healthy juice made from ripe fresh papaya", - "unit": "0.2L", - "unitNotation": "0.2L", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 8, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1773566115806-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 49, - "marketPrice": 56, - "flashPrice": null, - "isFlashAvailable": true - }, - { - "id": 115, - "name": "Fresh kiwi juice", - "shortDescription": "Tangy and refreshing juice made from fresh ripe kiwi fruits", - "unit": "0.2L", - "unitNotation": "0.2L", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 8, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1773566605539-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 99, - "marketPrice": 109, - "flashPrice": null, - "isFlashAvailable": true - }, - { - "id": 116, - "name": "Fresh banana juice", - "shortDescription": "Creamy and naturally sweet juice made from fresh ripe bananas ", - "unit": "0.2L", - "unitNotation": "0.2L", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 8, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1773209103816-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 29, - "marketPrice": 39, - "flashPrice": null, - "isFlashAvailable": true - }, - { - "id": 117, - "name": "Fresh black grape juice", - "shortDescription": "Sweet and refreshing juice made from fresh black grapes", - "unit": "0.2L", - "unitNotation": "0.2L", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 8, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1773222507937-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 59, - "marketPrice": 69, - "flashPrice": null, - "isFlashAvailable": true - }, - { - "id": 118, - "name": "Fresh mosambi juice", - "shortDescription": "Refreshing and naturally sweet juice made from fresh mosambi (sweet lime) ", - "unit": "0.2L", - "unitNotation": "0.2L", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 8, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1773224238549-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 39, - "marketPrice": 49, - "flashPrice": null, - "isFlashAvailable": true - }, - { - "id": 119, - "name": "Shahtoot Malai (Mulberry Cream Dessert) ", - "shortDescription": "Rich and creamy shahtoot malai made with fresh mulberries, smooth cream and a perfect touch of sweetness-refreshing, fruity and indulgent in every bite", - "unit": "1Pc", - "unitNotation": "1Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 8, - "isOutOfStock": true, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1774961460199-0", - "https://assets.freshyo.in/product-images/1774961460203-1" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 119, - "marketPrice": 129, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 120, - "name": "Kaddu ki kheer", - "shortDescription": "Deliciously creamy kaddu ki kheer made with fresh bottle gourd(louki), rich in milk, and dry fruits-light nutritious, and perfectly sweet", - "unit": "1Pc", - "unitNotation": "1Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 8, - "isOutOfStock": true, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1774961917278-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 119, - "marketPrice": 129, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 121, - "name": "Badam milk", - "shortDescription": "Rich and refreshing badam milk made with premium almonds, milk and a hint of saffron-nutritious, creamy and delicious", - "unit": "0.2L", - "unitNotation": "0.2L", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 8, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1774967050357-0" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 49, - "marketPrice": 59, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 122, - "name": "Custard Fruit salad ", - "shortDescription": "A refreshing mix of freshly cut, juicy fruits packed with natural sweetness, vitamins and vibrant flavours- perfect for a healthy snack anytime", - "unit": "1Pc", - "unitNotation": "1Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 8, - "isOutOfStock": true, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1776166347889.png" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 59, - "marketPrice": 65, - "flashPrice": 65, - "isFlashAvailable": false - }, - { - "id": 123, - "name": "Malai fruit salad", - "shortDescription": "A rich and creamy blend of fresh fruits mixed with sweet, smooth malai-perfectly indulgent and refreshing in every bite", - "unit": "1Pc", - "unitNotation": "1Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 8, - "isOutOfStock": true, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1776166580757.png" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 111, - "marketPrice": 121, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 124, - "name": "Mango lassi", - "shortDescription": "A creamy and refreshing blend of sweet mangoes and chilled yogurt, perfectly smooth and naturally delicious", - "unit": "1Pc", - "unitNotation": "1Pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 8, - "isOutOfStock": true, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1776166786776.png", - "https://assets.freshyo.in/product-images/1776166787107.jpg" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 69, - "marketPrice": 79, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 125, - "name": "Kesari mango", - "shortDescription": "Sweet, juicy and aromatic, kesari mango is known for its saffron-colored pulp and irresistible flavor", - "unit": "1Kg", - "unitNotation": "1Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": true, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1777263925402.jpg" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 169, - "marketPrice": 199, - "flashPrice": 169, - "isFlashAvailable": true - }, - { - "id": 126, - "name": "Mallika mango", - "shortDescription": "The Mallika Mango is a premium indian hybrid mango known for its rich sweetness, juicy fiberless pulp, and strong fruity aroma. It has deep orange flesh with delicious honey, and melon like flavours, making it one of the tastiest mango varieties", - "unit": "1Kg", - "unitNotation": "1Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": true, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1778175573767.jpg" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 169, - "marketPrice": 199, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 127, - "name": "Capsicun", - "shortDescription": "Fresh green capsicum, crisp and flavorful, perfect for salads, curries, stir-fries, and snacks", - "unit": "0.25Kg", - "unitNotation": "0.25Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1781711355656.png" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 33, - "marketPrice": 38, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 128, - "name": "Country Chicken (Farm Raised) ", - "shortDescription": "This is a country chicken raised to grow like a farm chicken. Not truly 'Naatu' but much better than broiler chicken", - "unit": "1Kg", - "unitNotation": "1Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": null, - "images": [ - "https://assets.freshyo.in/product-images/1783237670627.png", - "https://assets.freshyo.in/product-images/1783237718972.jpg" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 589, - "marketPrice": 799, - "flashPrice": 625, - "isFlashAvailable": true - }, - { - "id": 129, - "name": "Cashew (kaju) ", - "shortDescription": "Premium quality kaju (cashew nuts)- fresh, crunchy, naturally rich in protein, healthy fats and essential nutrients. Perfect for snacking, cooking and desserts", - "unit": "0.25Kg", - "unitNotation": "0.25Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 9, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1784220823113.jpg" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 249, - "marketPrice": 299, - "flashPrice": 249, - "isFlashAvailable": true - }, - { - "id": 130, - "name": "Badam", - "shortDescription": "Premium Badam (Almonds) – fresh, crunchy, and naturally rich in protein, fiber, vitamin E, and healthy fats. Perfect for daily snacking and healthy living.", - "unit": "0.25Kg", - "unitNotation": "0.25Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 9, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1784698463282.jpg" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 300, - "marketPrice": 315, - "flashPrice": 269, - "isFlashAvailable": true - }, - { - "id": 131, - "name": "Raisins (kishmish) ", - "shortDescription": "Premium Kishmish (Raisins) – naturally sweet, soft, and rich in fiber, iron, and antioxidants. A healthy snack for everyday nutrition.", - "unit": "0.25Kg", - "unitNotation": "0.25Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 9, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1784221386651.jpg" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 149, - "marketPrice": 189, - "flashPrice": 169, - "isFlashAvailable": true - }, - { - "id": 132, - "name": "Dried figs (Anjeer) ", - "shortDescription": "Premium Anjeer (Dried Figs) – naturally sweet, soft, and rich in fiber, calcium, iron, and antioxidants. A delicious and nutritious snack", - "unit": "0.25Kg", - "unitNotation": "0.25Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 9, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1784221665870.jpg" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 299, - "marketPrice": 329, - "flashPrice": 310, - "isFlashAvailable": true - }, - { - "id": 133, - "name": "Pistachios (pista) ", - "shortDescription": "Premium Pista (Pistachios) – fresh, crunchy, and naturally rich in protein, fiber, healthy fats, and antioxidants. A perfect healthy snack(without shell)", - "unit": "0.25Kg", - "unitNotation": "0.25Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 9, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1784221842934.jpg" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 712, - "marketPrice": 759, - "flashPrice": 720, - "isFlashAvailable": true - }, - { - "id": 134, - "name": "black raisin ( kishmish) ", - "shortDescription": "Premium quality black raisins that are naturally sweet, soft, and packed with essential nutrients. Perfect for snacking, desserts, and healthy recipes", - "unit": "0.25Kg", - "unitNotation": "0.25Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 9, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1784222032500.jpg" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 169, - "marketPrice": 200, - "flashPrice": 179, - "isFlashAvailable": true - }, - { - "id": 135, - "name": "Walnut (Akhrot) ", - "shortDescription": "Premium quality Akhrot (Walnuts) with a rich, crunchy texture and naturally delicious taste. A wholesome snack packed with nutrition.", - "unit": "0.25Kg", - "unitNotation": "0.25Kg", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 9, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1784700581756.png" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 375, - "marketPrice": 399, - "flashPrice": 375, - "isFlashAvailable": true - }, - { - "id": 136, - "name": "15 veggies pack ", - "shortDescription": "Fresh 15-vegetable combo at just ₹219. Freshly sourced and delivered to your doorstep.", - "unit": "15 pc", - "unitNotation": "15 pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T09:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1788533822538.jpg" - ], - "productType": "combo", - "isComboOnly": false, - "isOffer": false, - "price": 199, - "marketPrice": 319, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 137, - "name": "Chicken regular cut", - "shortDescription": null, - "unit": "1kg ", - "unitNotation": "1kg ", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1787247236467.png" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 251, - "marketPrice": 260, - "flashPrice": 251, - "isFlashAvailable": true - }, - { - "id": 138, - "name": "Biryani pack ", - "shortDescription": "Everything you need for a delicious biryani, packed fresh and ready to cook.", - "unit": "7", - "unitNotation": "7", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T10:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1787247755954.jpg" - ], - "productType": "combo", - "isComboOnly": false, - "isOffer": false, - "price": 319, - "marketPrice": 359, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 139, - "name": "Curry pack ", - "shortDescription": null, - "unit": "5 pc", - "unitNotation": "5 pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T10:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1787248611495.jpg" - ], - "productType": "combo", - "isComboOnly": false, - "isOffer": false, - "price": 119, - "marketPrice": 139, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 140, - "name": "Salad pack ", - "shortDescription": "Fresh, crisp salad essentials packed together for a healthy and refreshing meal.", - "unit": "5 pc", - "unitNotation": "5 pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T10:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1787248824197.png", - "https://assets.freshyo.in/product-images/1787248824464.jpg" - ], - "productType": "combo", - "isComboOnly": false, - "isOffer": false, - "price": 129, - "marketPrice": 169, - "flashPrice": 129, - "isFlashAvailable": false - }, - { - "id": 141, - "name": "Fruit pack", - "shortDescription": null, - "unit": "4 pc ", - "unitNotation": "4 pc ", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 2, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1787249312475.jpg" - ], - "productType": "combo", - "isComboOnly": false, - "isOffer": false, - "price": 399, - "marketPrice": 429, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 142, - "name": "Calta Fish live ", - "shortDescription": "Fresh Catla fish – premium freshwater carp with soft, sweet white meat. Perfect for curries & fries. Cleaned and cut as per your choice.", - "unit": "1kg ", - "unitNotation": "1kg ", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": null, - "images": [ - "https://assets.freshyo.in/product-images/1787993797843.jpg" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 219, - "marketPrice": 249, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 143, - "name": "Tilapia Fish live ", - "shortDescription": "Fresh Tilapia Fish — Farm-fresh, whole tilapia with firm white flesh and a mild, sweet taste. Cleaned, hygienically packed on food-grade trays, and delivered fresh. Rich in protein, low in fat. Perfect for fry, curry, or grill.", - "unit": "1 kg ", - "unitNotation": "1 kg ", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": null, - "images": [ - "https://assets.freshyo.in/product-images/1787994834302.png" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 210, - "marketPrice": 229, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 144, - "name": "Amaranth(Thotakura)7 pc", - "shortDescription": "Fresh Amaranth Leaves (Thotakura) — Tender, farm-fresh green amaranth leaves, naturally grown and handpicked daily. Rich in iron, calcium, and vitamins. Perfect for dal, curries, and soups. Cleaned and hygienically packed.", - "unit": "7pc", - "unitNotation": "7pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1787996184981.jpg" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 15, - "marketPrice": 19, - "flashPrice": 19, - "isFlashAvailable": true - }, - { - "id": 145, - "name": "White Gongura 7 pc ", - "shortDescription": "Fresh White Gongura Leaves — Tender, farm-fresh white-stem gongura with a mild tangy flavour, handpicked daily from local farms. Rich in iron, vitamins, and antioxidants. Perfect for gongura pachadi, pulusu, dal, and non-veg curries. Cleaned and hygienically packed.", - "unit": "7 pc", - "unitNotation": "7 pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1787996367962.jpg" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 15, - "marketPrice": 19, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 146, - "name": "Green Sorrel(Chukka Kura) 7pc", - "shortDescription": "Fresh Green Sorrel Leaves (Chukka Kura) — Tender, tangy green sorrel leaves, handpicked fresh from local farms. Naturally rich in iron, vitamin C, and antioxidants. Perfect for chukka kura pappu (dal), pulusu, pachadi, and stir-fries. Cleaned and hygienically packed.", - "unit": "7 pc", - "unitNotation": "7 pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T12:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1787996596668.jpg" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 15, - "marketPrice": 19, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 147, - "name": "All green leaf veggies pack ", - "shortDescription": null, - "unit": "8", - "unitNotation": "8", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 4, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1788230211980.png" - ], - "productType": "combo", - "isComboOnly": false, - "isOffer": false, - "price": 129, - "marketPrice": 149, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 148, - "name": "Pomegranate juice", - "shortDescription": "Pomegranate juice is a deep ruby-red drink pressed from the jewel-like arils of the pomegranate fruit. It has a refreshing sweet-tart flavor with a slightly tangy, tannic finish. Naturally rich in vitamin C, potassium, and powerful polyphenol antioxidants, it's prized for supporting heart health and reducing inflammation. Enjoyed fresh, in mocktails and cocktails, or reduced into molasses for cooking, it has been treasured since ancient times as both a refreshment and a tonic.", - "unit": "0.2L", - "unitNotation": "0.2L", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 8, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1788767922579.png" - ], - "productType": "item", - "isComboOnly": false, - "isOffer": false, - "price": 59, - "marketPrice": 49, - "flashPrice": null, - "isFlashAvailable": false - }, - { - "id": 149, - "name": "GYM PACK ", - "shortDescription": null, - "unit": "5pc", - "unitNotation": "5pc", - "incrementStep": 1, - "productQuantity": 1, - "storeId": 1, - "isOutOfStock": false, - "nextDeliveryDate": "2026-09-16T13:30:00.000Z", - "images": [ - "https://assets.freshyo.in/product-images/1789123496246.png" - ], - "productType": "combo", - "isComboOnly": true, - "isOffer": false, - "price": 149, - "marketPrice": 219, - "flashPrice": null, - "isFlashAvailable": false - } - ], - "count": 149, - "tags": [ - { - "id": 1, - "tagName": "Chicken", - "tagDescription": "Chicken related items", - "imageUrl": "https://assets.freshyo.in/tags/1770321659633-1763869265110-e22b6d94-dac9-499f-babb-1e944d90b01a.jpeg%3FX-Amz-Algorithm%3DAWS4-HMAC-SHA256%26X-Amz-Content-Sha256%3DUNSIGNED-PAYLOAD%26X-Amz-Credential%3D8fab47503efb9547b50e4fb317e35cc7%252F20260205%252Fapac%252Fs3%252Faws4_request%26X-Amz-Date%3D20260205T195535Z%26X-Amz-Expires%3D259200%26X-Amz-Signature%3D917db15bcc60cab7ac5cd5e49d85d13a960fe77b4a5e327dd449048870494cf9%26X-Amz-SignedHeaders%3Dhost%26x-amz-checksum-mode%3DENABLED%26x-id%3DGetObject", - "isDashboardTag": true, - "relatedStores": [ - 1 - ], - "productIds": [ - 23, - 2, - 24, - 41, - 36, - 40, - 42, - 21, - 10, - 80, - 128, - 137, - 1 - ] - }, - { - "id": 2, - "tagName": "Meat", - "tagDescription": "Meat Products", - "imageUrl": "https://assets.freshyo.in/tags/1763835253683-c9c3e293-0bef-4c58-a976-dd49c050cd36.jpeg", - "isDashboardTag": true, - "relatedStores": [], - "productIds": [ - 98, - 14, - 28, - 4, - 2, - 42, - 21, - 3, - 24, - 15, - 41, - 10, - 34, - 12, - 84, - 86, - 99, - 20, - 35, - 85, - 87, - 23, - 81, - 128 - ] - }, - { - "id": 3, - "tagName": "Fruits", - "tagDescription": "Delicious fresh fruits", - "imageUrl": "https://assets.freshyo.in/tags/1763835293899-43b3fbe1-9b5b-441c-b4d4-d1691c3f02f3.webp", - "isDashboardTag": true, - "relatedStores": [ - 2 - ], - "productIds": [ - 7, - 26, - 39, - 11, - 25, - 55, - 53, - 6, - 47, - 96, - 38, - 46, - 62, - 60, - 100, - 59, - 44, - 125, - 126, - 8, - 48, - 49, - 13, - 61, - 50 - ] - }, - { - "id": 4, - "tagName": "Fish", - "tagDescription": "Types ", - "imageUrl": "https://assets.freshyo.in/tags/1770323410499-1763869436182-bf82f7b4-a1f3-4113-985b-96311b7a910e.jpeg%3FX-Amz-Algorithm%3DAWS4-HMAC-SHA256%26X-Amz-Content-Sha256%3DUNSIGNED-PAYLOAD%26X-Amz-Credential%3D8fab47503efb9547b50e4fb317e35cc7%252F20260205%252Fapac%252Fs3%252Faws4_request%26X-Amz-Date%3D20260205T202804Z%26X-Amz-Expires%3D259200%26X-Amz-Signature%3Dea436390b277935d843cae6b5cfa62aeed5799cb4a962ab31a0be4b132ca4b30%26X-Amz-SignedHeaders%3Dhost%26x-amz-checksum-mode%3DENABLED%26x-id%3DGetObject", - "isDashboardTag": true, - "relatedStores": [ - 1 - ], - "productIds": [ - 9, - 75, - 83, - 81, - 22, - 102, - 82, - 142, - 143 - ] - }, - { - "id": 5, - "tagName": "Vegetables", - "tagDescription": null, - "imageUrl": "https://assets.freshyo.in/tags/1768709725124-ebf421c5-ad52-49a9-b65c-1de008110b8a.png", - "isDashboardTag": true, - "relatedStores": [ - 4 - ], - "productIds": [ - 33, - 72, - 29, - 19, - 18, - 70, - 76, - 67, - 17, - 37, - 64, - 77, - 74, - 92, - 127, - 30, - 16, - 65, - 27, - 5, - 78, - 31, - 89, - 32, - 45, - 146, - 145, - 144, - 13, - 66, - 68, - 69, - 71, - 79, - 88, - 90, - 91, - 93, - 94, - 95, - 97, - 101, - 103 - ] - }, - { - "id": 6, - "tagName": "Mutton", - "tagDescription": "Mutton Products", - "imageUrl": "https://assets.freshyo.in/tags/1770323560823-fd0ec463-bed0-474e-aa14-dc6480ce36af.jpeg", - "isDashboardTag": true, - "relatedStores": [ - 1 - ], - "productIds": [ - 4, - 14, - 20, - 28, - 35, - 84, - 85, - 86, - 87, - 98, - 99 - ] - }, - { - "id": 7, - "tagName": "Fruits juices", - "tagDescription": null, - "imageUrl": "https://assets.freshyo.in/tags/1773132996598-1773119837289-8c93f343-2885-415e-b545-dcaa1dc88857.jpeg%3FX-Amz-Algorithm%3DAWS4-HMAC-SHA256%26X-Amz-Content-Sha256%3DUNSIGNED-PAYLOAD%26X-Amz-Credential%3D8fab47503efb9547b50e4fb317e35cc7%252F20260310%252Fapac%252Fs3%252Faws4_request%26X-Amz-Date%3D20260310T051718Z%26X-Amz-Expires%3D259200%26X-Amz-Signature%3D22358087a6f102caf7eb7a4b3cfd455df9aca13685fff8bb751d3c3d813b9d72%26X-Amz-SignedHeaders%3Dhost%26x-amz-checksum-mode%3DENABLED%26x-id%3DGetObject", - "isDashboardTag": true, - "relatedStores": [ - 8 - ], - "productIds": [ - 104, - 105, - 106, - 107, - 108, - 109, - 110, - 111, - 113, - 116, - 117, - 122, - 123, - 124 - ] - }, - { - "id": 8, - "tagName": "Dry fruits", - "tagDescription": null, - "imageUrl": "https://assets.freshyo.in/tags/1784697809481.jpg", - "isDashboardTag": false, - "relatedStores": [ - 9 - ], - "productIds": [ - 129, - 130, - 131, - 132, - 133, - 134, - 135 - ] - } - ] -} \ No newline at end of file diff --git a/apps/user-ui/tests/mocks/mock-slots-response.json b/apps/user-ui/tests/mocks/mock-slots-response.json deleted file mode 100644 index 8ee5148..0000000 --- a/apps/user-ui/tests/mocks/mock-slots-response.json +++ /dev/null @@ -1,6045 +0,0 @@ -{ - "slots": [ - { - "id": 1849, - "deliveryTime": "2026-09-18T01:30:00.000Z", - "freezeTime": "2026-09-18T01:20:00.000Z", - "products": [ - { - "id": 9, - "images": [ - "https://assets.freshyo.in/product-images/1768832690994-0" - ] - }, - { - "id": 22, - "images": [ - "https://assets.freshyo.in/product-images/1768834996932-0" - ] - }, - { - "id": 81, - "images": [ - "https://assets.freshyo.in/product-images/1769063467386-0" - ] - }, - { - "id": 82, - "images": [ - "https://assets.freshyo.in/product-images/1782023099986.png" - ] - }, - { - "id": 102, - "images": [ - "https://assets.freshyo.in/product-images/1771411526889-0" - ] - }, - { - "id": 5, - "images": [ - "https://assets.freshyo.in/product-images/1768710099841-0" - ] - }, - { - "id": 6, - "images": [ - "https://assets.freshyo.in/product-images/1768640936747-0" - ] - }, - { - "id": 13, - "images": [ - "https://assets.freshyo.in/product-images/1768641988607-0" - ] - }, - { - "id": 16, - "images": [ - "https://assets.freshyo.in/product-images/1769397372526-0" - ] - }, - { - "id": 17, - "images": [ - "https://assets.freshyo.in/product-images/1768640233068-0" - ] - }, - { - "id": 18, - "images": [ - "https://assets.freshyo.in/product-images/1769351976737-0" - ] - }, - { - "id": 19, - "images": [ - "https://assets.freshyo.in/product-images/1768639707515-0" - ] - }, - { - "id": 27, - "images": [ - "https://assets.freshyo.in/product-images/1768639645423-0" - ] - }, - { - "id": 28, - "images": [ - "https://assets.freshyo.in/product-images/1769356702593-0" - ] - }, - { - "id": 29, - "images": [ - "https://assets.freshyo.in/product-images/1768823985921-0" - ] - }, - { - "id": 30, - "images": [ - "https://assets.freshyo.in/product-images/1768726783083-0" - ] - }, - { - "id": 31, - "images": [ - "https://assets.freshyo.in/product-images/1769574792720-0" - ] - }, - { - "id": 32, - "images": [ - "https://assets.freshyo.in/product-images/1766406273176-0", - "https://assets.freshyo.in/product-images/1766406273178-1" - ] - }, - { - "id": 33, - "images": [ - "https://assets.freshyo.in/product-images/1769396046557-0" - ] - }, - { - "id": 37, - "images": [ - "https://assets.freshyo.in/product-images/1766636589779-0" - ] - }, - { - "id": 45, - "images": [ - "https://assets.freshyo.in/product-images/1768639292540-0" - ] - }, - { - "id": 64, - "images": [ - "https://assets.freshyo.in/product-images/1768709567040-0" - ] - }, - { - "id": 65, - "images": [ - "https://assets.freshyo.in/product-images/1768710434326-0" - ] - }, - { - "id": 66, - "images": [ - "https://assets.freshyo.in/product-images/1768710760133-0" - ] - }, - { - "id": 67, - "images": [ - "https://assets.freshyo.in/product-images/1768711261174-0" - ] - }, - { - "id": 68, - "images": [ - "https://assets.freshyo.in/product-images/1768711919135-0" - ] - }, - { - "id": 69, - "images": [ - "https://assets.freshyo.in/product-images/1768712093829-0" - ] - }, - { - "id": 70, - "images": [ - "https://assets.freshyo.in/product-images/1768712490280-0" - ] - }, - { - "id": 71, - "images": [ - "https://assets.freshyo.in/product-images/1768713206145-0" - ] - }, - { - "id": 72, - "images": [ - "https://assets.freshyo.in/product-images/1768713537512-0" - ] - }, - { - "id": 74, - "images": [ - "https://assets.freshyo.in/product-images/1768713886512-0" - ] - }, - { - "id": 76, - "images": [ - "https://assets.freshyo.in/product-images/1768727264220-0" - ] - }, - { - "id": 77, - "images": [ - "https://assets.freshyo.in/product-images/1769396724595-0" - ] - }, - { - "id": 78, - "images": [ - "https://assets.freshyo.in/product-images/1769241234003-0" - ] - }, - { - "id": 79, - "images": [ - "https://assets.freshyo.in/product-images/1768822893380-0" - ] - }, - { - "id": 88, - "images": [ - "https://assets.freshyo.in/product-images/1769394457296-0" - ] - }, - { - "id": 89, - "images": [ - "https://assets.freshyo.in/product-images/1769395184980-0" - ] - }, - { - "id": 90, - "images": [ - "https://assets.freshyo.in/product-images/1769398103853-0" - ] - }, - { - "id": 91, - "images": [ - "https://assets.freshyo.in/product-images/1769398710713-0" - ] - }, - { - "id": 92, - "images": [ - "https://assets.freshyo.in/product-images/1769399617573-0" - ] - }, - { - "id": 94, - "images": [ - "https://assets.freshyo.in/product-images/1769571810861-0" - ] - }, - { - "id": 95, - "images": [ - "https://assets.freshyo.in/product-images/1769571978680-0" - ] - }, - { - "id": 97, - "images": [ - "https://assets.freshyo.in/product-images/1769577010969-0" - ] - }, - { - "id": 101, - "images": [ - "https://assets.freshyo.in/product-images/1771249922306-0" - ] - }, - { - "id": 103, - "images": [ - "https://assets.freshyo.in/product-images/1771647812442-0" - ] - }, - { - "id": 127, - "images": [ - "https://assets.freshyo.in/product-images/1781711355656.png" - ] - }, - { - "id": 144, - "images": [ - "https://assets.freshyo.in/product-images/1787996184981.jpg" - ] - }, - { - "id": 145, - "images": [ - "https://assets.freshyo.in/product-images/1787996367962.jpg" - ] - }, - { - "id": 146, - "images": [ - "https://assets.freshyo.in/product-images/1787996596668.jpg" - ] - }, - { - "id": 4, - "images": [ - "https://assets.freshyo.in/product-images/1767636171845-0" - ] - }, - { - "id": 14, - "images": [ - "https://assets.freshyo.in/product-images/1768834170995-0" - ] - }, - { - "id": 35, - "images": [ - "https://assets.freshyo.in/product-images/1767636561867-0" - ] - }, - { - "id": 86, - "images": [ - "https://assets.freshyo.in/product-images/1769151216776-0" - ] - }, - { - "id": 98, - "images": [ - "https://assets.freshyo.in/product-images/1770051810386-0" - ] - }, - { - "id": 99, - "images": [ - "https://assets.freshyo.in/product-images/1770051959669-0" - ] - }, - { - "id": 2, - "images": [ - "https://assets.freshyo.in/product-images/1768397780093-0", - "https://assets.freshyo.in/product-images/1768479562478-0" - ] - }, - { - "id": 3, - "images": [ - "https://assets.freshyo.in/product-images/1768475599800-0" - ] - }, - { - "id": 10, - "images": [ - "https://assets.freshyo.in/product-images/1768390245969-0" - ] - }, - { - "id": 21, - "images": [ - "https://assets.freshyo.in/product-images/1768539930897-0", - "https://assets.freshyo.in/product-images/1768539930899-1" - ] - }, - { - "id": 23, - "images": [ - "https://assets.freshyo.in/product-images/1767635527063-0" - ] - }, - { - "id": 24, - "images": [ - "https://assets.freshyo.in/product-images/1768484106870-0" - ] - }, - { - "id": 36, - "images": [ - "https://assets.freshyo.in/product-images/1768413754684-0" - ] - }, - { - "id": 40, - "images": [ - "https://assets.freshyo.in/product-images/1767637606890-0" - ] - }, - { - "id": 41, - "images": [ - "https://assets.freshyo.in/product-images/1768307047191-0" - ] - }, - { - "id": 42, - "images": [ - "https://assets.freshyo.in/product-images/1768393778962-0" - ] - }, - { - "id": 80, - "images": [ - "https://assets.freshyo.in/product-images/1769063336125-0" - ] - }, - { - "id": 137, - "images": [ - "https://assets.freshyo.in/product-images/1787247236467.png" - ] - }, - { - "id": 149, - "images": [ - "https://assets.freshyo.in/product-images/1789123496246.png" - ] - }, - { - "id": 147, - "images": [ - "https://assets.freshyo.in/product-images/1788230211980.png" - ] - }, - { - "id": 140, - "images": [ - "https://assets.freshyo.in/product-images/1787248824197.png", - "https://assets.freshyo.in/product-images/1787248824464.jpg" - ] - }, - { - "id": 139, - "images": [ - "https://assets.freshyo.in/product-images/1787248611495.jpg" - ] - }, - { - "id": 138, - "images": [ - "https://assets.freshyo.in/product-images/1787247755954.jpg" - ] - }, - { - "id": 136, - "images": [ - "https://assets.freshyo.in/product-images/1788533822538.jpg" - ] - } - ] - }, - { - "id": 1847, - "deliveryTime": "2026-09-18T02:30:00.000Z", - "freezeTime": "2026-09-18T02:00:00.000Z", - "products": [ - { - "id": 2, - "images": [ - "https://assets.freshyo.in/product-images/1768397780093-0", - "https://assets.freshyo.in/product-images/1768479562478-0" - ] - }, - { - "id": 3, - "images": [ - "https://assets.freshyo.in/product-images/1768475599800-0" - ] - }, - { - "id": 4, - "images": [ - "https://assets.freshyo.in/product-images/1767636171845-0" - ] - }, - { - "id": 5, - "images": [ - "https://assets.freshyo.in/product-images/1768710099841-0" - ] - }, - { - "id": 6, - "images": [ - "https://assets.freshyo.in/product-images/1768640936747-0" - ] - }, - { - "id": 7, - "images": [ - "https://assets.freshyo.in/product-images/1768640009078-0" - ] - }, - { - "id": 8, - "images": [ - "https://assets.freshyo.in/product-images/1768647119198-0" - ] - }, - { - "id": 9, - "images": [ - "https://assets.freshyo.in/product-images/1768832690994-0" - ] - }, - { - "id": 10, - "images": [ - "https://assets.freshyo.in/product-images/1768390245969-0" - ] - }, - { - "id": 11, - "images": [ - "https://assets.freshyo.in/product-images/1768641635898-0" - ] - }, - { - "id": 13, - "images": [ - "https://assets.freshyo.in/product-images/1768641988607-0" - ] - }, - { - "id": 14, - "images": [ - "https://assets.freshyo.in/product-images/1768834170995-0" - ] - }, - { - "id": 16, - "images": [ - "https://assets.freshyo.in/product-images/1769397372526-0" - ] - }, - { - "id": 17, - "images": [ - "https://assets.freshyo.in/product-images/1768640233068-0" - ] - }, - { - "id": 18, - "images": [ - "https://assets.freshyo.in/product-images/1769351976737-0" - ] - }, - { - "id": 19, - "images": [ - "https://assets.freshyo.in/product-images/1768639707515-0" - ] - }, - { - "id": 21, - "images": [ - "https://assets.freshyo.in/product-images/1768539930897-0", - "https://assets.freshyo.in/product-images/1768539930899-1" - ] - }, - { - "id": 22, - "images": [ - "https://assets.freshyo.in/product-images/1768834996932-0" - ] - }, - { - "id": 23, - "images": [ - "https://assets.freshyo.in/product-images/1767635527063-0" - ] - }, - { - "id": 24, - "images": [ - "https://assets.freshyo.in/product-images/1768484106870-0" - ] - }, - { - "id": 25, - "images": [ - "https://assets.freshyo.in/product-images/1768649838027-0" - ] - }, - { - "id": 26, - "images": [ - "https://assets.freshyo.in/product-images/1768640645444-0" - ] - }, - { - "id": 27, - "images": [ - "https://assets.freshyo.in/product-images/1768639645423-0" - ] - }, - { - "id": 28, - "images": [ - "https://assets.freshyo.in/product-images/1769356702593-0" - ] - }, - { - "id": 29, - "images": [ - "https://assets.freshyo.in/product-images/1768823985921-0" - ] - }, - { - "id": 30, - "images": [ - "https://assets.freshyo.in/product-images/1768726783083-0" - ] - }, - { - "id": 31, - "images": [ - "https://assets.freshyo.in/product-images/1769574792720-0" - ] - }, - { - "id": 32, - "images": [ - "https://assets.freshyo.in/product-images/1766406273176-0", - "https://assets.freshyo.in/product-images/1766406273178-1" - ] - }, - { - "id": 33, - "images": [ - "https://assets.freshyo.in/product-images/1769396046557-0" - ] - }, - { - "id": 35, - "images": [ - "https://assets.freshyo.in/product-images/1767636561867-0" - ] - }, - { - "id": 36, - "images": [ - "https://assets.freshyo.in/product-images/1768413754684-0" - ] - }, - { - "id": 37, - "images": [ - "https://assets.freshyo.in/product-images/1766636589779-0" - ] - }, - { - "id": 38, - "images": [ - "https://assets.freshyo.in/product-images/1768640403001-0" - ] - }, - { - "id": 39, - "images": [ - "https://assets.freshyo.in/product-images/1768650081183-0" - ] - }, - { - "id": 40, - "images": [ - "https://assets.freshyo.in/product-images/1767637606890-0" - ] - }, - { - "id": 41, - "images": [ - "https://assets.freshyo.in/product-images/1768307047191-0" - ] - }, - { - "id": 42, - "images": [ - "https://assets.freshyo.in/product-images/1768393778962-0" - ] - }, - { - "id": 43, - "images": [ - "https://assets.freshyo.in/product-images/1768638795991-0" - ] - }, - { - "id": 44, - "images": [ - "https://assets.freshyo.in/product-images/1768639090932-0" - ] - }, - { - "id": 45, - "images": [ - "https://assets.freshyo.in/product-images/1768639292540-0" - ] - }, - { - "id": 46, - "images": [ - "https://assets.freshyo.in/product-images/1768639705530-0" - ] - }, - { - "id": 47, - "images": [ - "https://assets.freshyo.in/product-images/1768642455479-0" - ] - }, - { - "id": 48, - "images": [ - "https://assets.freshyo.in/product-images/1768642724520-0" - ] - }, - { - "id": 49, - "images": [ - "https://assets.freshyo.in/product-images/1768643138910-0" - ] - }, - { - "id": 50, - "images": [ - "https://assets.freshyo.in/product-images/1768643354251-0" - ] - }, - { - "id": 51, - "images": [ - "https://assets.freshyo.in/product-images/1768646295695-0" - ] - }, - { - "id": 52, - "images": [ - "https://assets.freshyo.in/product-images/1768646744949-0" - ] - }, - { - "id": 53, - "images": [ - "https://assets.freshyo.in/product-images/1768646932088-0" - ] - }, - { - "id": 54, - "images": [ - "https://assets.freshyo.in/product-images/1768649454994-0" - ] - }, - { - "id": 55, - "images": [ - "https://assets.freshyo.in/product-images/1768650709484-0" - ] - }, - { - "id": 56, - "images": [ - "https://assets.freshyo.in/product-images/1768651334320-0" - ] - }, - { - "id": 57, - "images": [ - "https://assets.freshyo.in/product-images/1768651774899-0" - ] - }, - { - "id": 58, - "images": [ - "https://assets.freshyo.in/product-images/1768652061701-0" - ] - }, - { - "id": 59, - "images": [ - "https://assets.freshyo.in/product-images/1768653009851-0" - ] - }, - { - "id": 60, - "images": [ - "https://assets.freshyo.in/product-images/1768653997561-0" - ] - }, - { - "id": 61, - "images": [ - "https://assets.freshyo.in/product-images/1768654475850-0" - ] - }, - { - "id": 62, - "images": [ - "https://assets.freshyo.in/product-images/1768654740988-0" - ] - }, - { - "id": 63, - "images": [ - "https://assets.freshyo.in/product-images/1768658094891-0" - ] - }, - { - "id": 64, - "images": [ - "https://assets.freshyo.in/product-images/1768709567040-0" - ] - }, - { - "id": 65, - "images": [ - "https://assets.freshyo.in/product-images/1768710434326-0" - ] - }, - { - "id": 66, - "images": [ - "https://assets.freshyo.in/product-images/1768710760133-0" - ] - }, - { - "id": 67, - "images": [ - "https://assets.freshyo.in/product-images/1768711261174-0" - ] - }, - { - "id": 68, - "images": [ - "https://assets.freshyo.in/product-images/1768711919135-0" - ] - }, - { - "id": 69, - "images": [ - "https://assets.freshyo.in/product-images/1768712093829-0" - ] - }, - { - "id": 70, - "images": [ - "https://assets.freshyo.in/product-images/1768712490280-0" - ] - }, - { - "id": 71, - "images": [ - "https://assets.freshyo.in/product-images/1768713206145-0" - ] - }, - { - "id": 72, - "images": [ - "https://assets.freshyo.in/product-images/1768713537512-0" - ] - }, - { - "id": 73, - "images": [ - "https://assets.freshyo.in/product-images/1768718685357-0" - ] - }, - { - "id": 74, - "images": [ - "https://assets.freshyo.in/product-images/1768713886512-0" - ] - }, - { - "id": 76, - "images": [ - "https://assets.freshyo.in/product-images/1768727264220-0" - ] - }, - { - "id": 77, - "images": [ - "https://assets.freshyo.in/product-images/1769396724595-0" - ] - }, - { - "id": 78, - "images": [ - "https://assets.freshyo.in/product-images/1769241234003-0" - ] - }, - { - "id": 79, - "images": [ - "https://assets.freshyo.in/product-images/1768822893380-0" - ] - }, - { - "id": 80, - "images": [ - "https://assets.freshyo.in/product-images/1769063336125-0" - ] - }, - { - "id": 81, - "images": [ - "https://assets.freshyo.in/product-images/1769063467386-0" - ] - }, - { - "id": 82, - "images": [ - "https://assets.freshyo.in/product-images/1782023099986.png" - ] - }, - { - "id": 86, - "images": [ - "https://assets.freshyo.in/product-images/1769151216776-0" - ] - }, - { - "id": 88, - "images": [ - "https://assets.freshyo.in/product-images/1769394457296-0" - ] - }, - { - "id": 89, - "images": [ - "https://assets.freshyo.in/product-images/1769395184980-0" - ] - }, - { - "id": 90, - "images": [ - "https://assets.freshyo.in/product-images/1769398103853-0" - ] - }, - { - "id": 91, - "images": [ - "https://assets.freshyo.in/product-images/1769398710713-0" - ] - }, - { - "id": 92, - "images": [ - "https://assets.freshyo.in/product-images/1769399617573-0" - ] - }, - { - "id": 94, - "images": [ - "https://assets.freshyo.in/product-images/1769571810861-0" - ] - }, - { - "id": 95, - "images": [ - "https://assets.freshyo.in/product-images/1769571978680-0" - ] - }, - { - "id": 96, - "images": [ - "https://assets.freshyo.in/product-images/1769576743718-0" - ] - }, - { - "id": 97, - "images": [ - "https://assets.freshyo.in/product-images/1769577010969-0" - ] - }, - { - "id": 98, - "images": [ - "https://assets.freshyo.in/product-images/1770051810386-0" - ] - }, - { - "id": 99, - "images": [ - "https://assets.freshyo.in/product-images/1770051959669-0" - ] - }, - { - "id": 100, - "images": [ - "https://assets.freshyo.in/product-images/1770212631435-0" - ] - }, - { - "id": 101, - "images": [ - "https://assets.freshyo.in/product-images/1771249922306-0" - ] - }, - { - "id": 102, - "images": [ - "https://assets.freshyo.in/product-images/1771411526889-0" - ] - }, - { - "id": 103, - "images": [ - "https://assets.freshyo.in/product-images/1771647812442-0" - ] - }, - { - "id": 125, - "images": [ - "https://assets.freshyo.in/product-images/1777263925402.jpg" - ] - }, - { - "id": 126, - "images": [ - "https://assets.freshyo.in/product-images/1778175573767.jpg" - ] - }, - { - "id": 127, - "images": [ - "https://assets.freshyo.in/product-images/1781711355656.png" - ] - }, - { - "id": 136, - "images": [ - "https://assets.freshyo.in/product-images/1788533822538.jpg" - ] - }, - { - "id": 137, - "images": [ - "https://assets.freshyo.in/product-images/1787247236467.png" - ] - }, - { - "id": 138, - "images": [ - "https://assets.freshyo.in/product-images/1787247755954.jpg" - ] - }, - { - "id": 139, - "images": [ - "https://assets.freshyo.in/product-images/1787248611495.jpg" - ] - }, - { - "id": 140, - "images": [ - "https://assets.freshyo.in/product-images/1787248824197.png", - "https://assets.freshyo.in/product-images/1787248824464.jpg" - ] - }, - { - "id": 141, - "images": [ - "https://assets.freshyo.in/product-images/1787249312475.jpg" - ] - }, - { - "id": 144, - "images": [ - "https://assets.freshyo.in/product-images/1787996184981.jpg" - ] - }, - { - "id": 145, - "images": [ - "https://assets.freshyo.in/product-images/1787996367962.jpg" - ] - }, - { - "id": 146, - "images": [ - "https://assets.freshyo.in/product-images/1787996596668.jpg" - ] - }, - { - "id": 147, - "images": [ - "https://assets.freshyo.in/product-images/1788230211980.png" - ] - } - ] - }, - { - "id": 1848, - "deliveryTime": "2026-09-18T05:30:00.000Z", - "freezeTime": "2026-09-18T05:20:00.000Z", - "products": [ - { - "id": 129, - "images": [ - "https://assets.freshyo.in/product-images/1784220823113.jpg" - ] - }, - { - "id": 130, - "images": [ - "https://assets.freshyo.in/product-images/1784698463282.jpg" - ] - }, - { - "id": 131, - "images": [ - "https://assets.freshyo.in/product-images/1784221386651.jpg" - ] - }, - { - "id": 132, - "images": [ - "https://assets.freshyo.in/product-images/1784221665870.jpg" - ] - }, - { - "id": 133, - "images": [ - "https://assets.freshyo.in/product-images/1784221842934.jpg" - ] - }, - { - "id": 134, - "images": [ - "https://assets.freshyo.in/product-images/1784222032500.jpg" - ] - }, - { - "id": 135, - "images": [ - "https://assets.freshyo.in/product-images/1784700581756.png" - ] - }, - { - "id": 104, - "images": [ - "https://assets.freshyo.in/product-images/1773126251435-0" - ] - }, - { - "id": 105, - "images": [ - "https://assets.freshyo.in/product-images/1773126524403-0" - ] - }, - { - "id": 106, - "images": [ - "https://assets.freshyo.in/product-images/1773127805418-0" - ] - }, - { - "id": 107, - "images": [ - "https://assets.freshyo.in/product-images/1773128056033-0" - ] - }, - { - "id": 108, - "images": [ - "https://assets.freshyo.in/product-images/1773128303272-0" - ] - }, - { - "id": 109, - "images": [ - "https://assets.freshyo.in/product-images/1773129061191-0" - ] - }, - { - "id": 110, - "images": [ - "https://assets.freshyo.in/product-images/1773129209100-0" - ] - }, - { - "id": 111, - "images": [ - "https://assets.freshyo.in/product-images/1773566003997-0" - ] - }, - { - "id": 112, - "images": [ - "https://assets.freshyo.in/product-images/1773130741608-0" - ] - }, - { - "id": 113, - "images": [ - "https://assets.freshyo.in/product-images/1773566035297-0" - ] - }, - { - "id": 114, - "images": [ - "https://assets.freshyo.in/product-images/1773566115806-0" - ] - }, - { - "id": 115, - "images": [ - "https://assets.freshyo.in/product-images/1773566605539-0" - ] - }, - { - "id": 116, - "images": [ - "https://assets.freshyo.in/product-images/1773209103816-0" - ] - }, - { - "id": 117, - "images": [ - "https://assets.freshyo.in/product-images/1773222507937-0" - ] - }, - { - "id": 118, - "images": [ - "https://assets.freshyo.in/product-images/1773224238549-0" - ] - }, - { - "id": 119, - "images": [ - "https://assets.freshyo.in/product-images/1774961460199-0", - "https://assets.freshyo.in/product-images/1774961460203-1" - ] - }, - { - "id": 120, - "images": [ - "https://assets.freshyo.in/product-images/1774961917278-0" - ] - }, - { - "id": 121, - "images": [ - "https://assets.freshyo.in/product-images/1774967050357-0" - ] - }, - { - "id": 122, - "images": [ - "https://assets.freshyo.in/product-images/1776166347889.png" - ] - }, - { - "id": 123, - "images": [ - "https://assets.freshyo.in/product-images/1776166580757.png" - ] - }, - { - "id": 124, - "images": [ - "https://assets.freshyo.in/product-images/1776166786776.png", - "https://assets.freshyo.in/product-images/1776166787107.jpg" - ] - }, - { - "id": 148, - "images": [ - "https://assets.freshyo.in/product-images/1788767922579.png" - ] - }, - { - "id": 6, - "images": [ - "https://assets.freshyo.in/product-images/1768640936747-0" - ] - }, - { - "id": 7, - "images": [ - "https://assets.freshyo.in/product-images/1768640009078-0" - ] - }, - { - "id": 8, - "images": [ - "https://assets.freshyo.in/product-images/1768647119198-0" - ] - }, - { - "id": 11, - "images": [ - "https://assets.freshyo.in/product-images/1768641635898-0" - ] - }, - { - "id": 13, - "images": [ - "https://assets.freshyo.in/product-images/1768641988607-0" - ] - }, - { - "id": 25, - "images": [ - "https://assets.freshyo.in/product-images/1768649838027-0" - ] - }, - { - "id": 26, - "images": [ - "https://assets.freshyo.in/product-images/1768640645444-0" - ] - }, - { - "id": 38, - "images": [ - "https://assets.freshyo.in/product-images/1768640403001-0" - ] - }, - { - "id": 39, - "images": [ - "https://assets.freshyo.in/product-images/1768650081183-0" - ] - }, - { - "id": 43, - "images": [ - "https://assets.freshyo.in/product-images/1768638795991-0" - ] - }, - { - "id": 44, - "images": [ - "https://assets.freshyo.in/product-images/1768639090932-0" - ] - }, - { - "id": 46, - "images": [ - "https://assets.freshyo.in/product-images/1768639705530-0" - ] - }, - { - "id": 47, - "images": [ - "https://assets.freshyo.in/product-images/1768642455479-0" - ] - }, - { - "id": 48, - "images": [ - "https://assets.freshyo.in/product-images/1768642724520-0" - ] - }, - { - "id": 49, - "images": [ - "https://assets.freshyo.in/product-images/1768643138910-0" - ] - }, - { - "id": 50, - "images": [ - "https://assets.freshyo.in/product-images/1768643354251-0" - ] - }, - { - "id": 51, - "images": [ - "https://assets.freshyo.in/product-images/1768646295695-0" - ] - }, - { - "id": 52, - "images": [ - "https://assets.freshyo.in/product-images/1768646744949-0" - ] - }, - { - "id": 53, - "images": [ - "https://assets.freshyo.in/product-images/1768646932088-0" - ] - }, - { - "id": 54, - "images": [ - "https://assets.freshyo.in/product-images/1768649454994-0" - ] - }, - { - "id": 55, - "images": [ - "https://assets.freshyo.in/product-images/1768650709484-0" - ] - }, - { - "id": 56, - "images": [ - "https://assets.freshyo.in/product-images/1768651334320-0" - ] - }, - { - "id": 57, - "images": [ - "https://assets.freshyo.in/product-images/1768651774899-0" - ] - }, - { - "id": 58, - "images": [ - "https://assets.freshyo.in/product-images/1768652061701-0" - ] - }, - { - "id": 59, - "images": [ - "https://assets.freshyo.in/product-images/1768653009851-0" - ] - }, - { - "id": 60, - "images": [ - "https://assets.freshyo.in/product-images/1768653997561-0" - ] - }, - { - "id": 61, - "images": [ - "https://assets.freshyo.in/product-images/1768654475850-0" - ] - }, - { - "id": 62, - "images": [ - "https://assets.freshyo.in/product-images/1768654740988-0" - ] - }, - { - "id": 63, - "images": [ - "https://assets.freshyo.in/product-images/1768658094891-0" - ] - }, - { - "id": 73, - "images": [ - "https://assets.freshyo.in/product-images/1768718685357-0" - ] - }, - { - "id": 96, - "images": [ - "https://assets.freshyo.in/product-images/1769576743718-0" - ] - }, - { - "id": 100, - "images": [ - "https://assets.freshyo.in/product-images/1770212631435-0" - ] - }, - { - "id": 125, - "images": [ - "https://assets.freshyo.in/product-images/1777263925402.jpg" - ] - }, - { - "id": 126, - "images": [ - "https://assets.freshyo.in/product-images/1778175573767.jpg" - ] - }, - { - "id": 9, - "images": [ - "https://assets.freshyo.in/product-images/1768832690994-0" - ] - }, - { - "id": 22, - "images": [ - "https://assets.freshyo.in/product-images/1768834996932-0" - ] - }, - { - "id": 81, - "images": [ - "https://assets.freshyo.in/product-images/1769063467386-0" - ] - }, - { - "id": 82, - "images": [ - "https://assets.freshyo.in/product-images/1782023099986.png" - ] - }, - { - "id": 102, - "images": [ - "https://assets.freshyo.in/product-images/1771411526889-0" - ] - }, - { - "id": 5, - "images": [ - "https://assets.freshyo.in/product-images/1768710099841-0" - ] - }, - { - "id": 16, - "images": [ - "https://assets.freshyo.in/product-images/1769397372526-0" - ] - }, - { - "id": 17, - "images": [ - "https://assets.freshyo.in/product-images/1768640233068-0" - ] - }, - { - "id": 18, - "images": [ - "https://assets.freshyo.in/product-images/1769351976737-0" - ] - }, - { - "id": 19, - "images": [ - "https://assets.freshyo.in/product-images/1768639707515-0" - ] - }, - { - "id": 27, - "images": [ - "https://assets.freshyo.in/product-images/1768639645423-0" - ] - }, - { - "id": 28, - "images": [ - "https://assets.freshyo.in/product-images/1769356702593-0" - ] - }, - { - "id": 29, - "images": [ - "https://assets.freshyo.in/product-images/1768823985921-0" - ] - }, - { - "id": 30, - "images": [ - "https://assets.freshyo.in/product-images/1768726783083-0" - ] - }, - { - "id": 31, - "images": [ - "https://assets.freshyo.in/product-images/1769574792720-0" - ] - }, - { - "id": 32, - "images": [ - "https://assets.freshyo.in/product-images/1766406273176-0", - "https://assets.freshyo.in/product-images/1766406273178-1" - ] - }, - { - "id": 33, - "images": [ - "https://assets.freshyo.in/product-images/1769396046557-0" - ] - }, - { - "id": 37, - "images": [ - "https://assets.freshyo.in/product-images/1766636589779-0" - ] - }, - { - "id": 45, - "images": [ - "https://assets.freshyo.in/product-images/1768639292540-0" - ] - }, - { - "id": 64, - "images": [ - "https://assets.freshyo.in/product-images/1768709567040-0" - ] - }, - { - "id": 65, - "images": [ - "https://assets.freshyo.in/product-images/1768710434326-0" - ] - }, - { - "id": 66, - "images": [ - "https://assets.freshyo.in/product-images/1768710760133-0" - ] - }, - { - "id": 67, - "images": [ - "https://assets.freshyo.in/product-images/1768711261174-0" - ] - }, - { - "id": 68, - "images": [ - "https://assets.freshyo.in/product-images/1768711919135-0" - ] - }, - { - "id": 69, - "images": [ - "https://assets.freshyo.in/product-images/1768712093829-0" - ] - }, - { - "id": 70, - "images": [ - "https://assets.freshyo.in/product-images/1768712490280-0" - ] - }, - { - "id": 71, - "images": [ - "https://assets.freshyo.in/product-images/1768713206145-0" - ] - }, - { - "id": 72, - "images": [ - "https://assets.freshyo.in/product-images/1768713537512-0" - ] - }, - { - "id": 74, - "images": [ - "https://assets.freshyo.in/product-images/1768713886512-0" - ] - }, - { - "id": 76, - "images": [ - "https://assets.freshyo.in/product-images/1768727264220-0" - ] - }, - { - "id": 77, - "images": [ - "https://assets.freshyo.in/product-images/1769396724595-0" - ] - }, - { - "id": 78, - "images": [ - "https://assets.freshyo.in/product-images/1769241234003-0" - ] - }, - { - "id": 79, - "images": [ - "https://assets.freshyo.in/product-images/1768822893380-0" - ] - }, - { - "id": 88, - "images": [ - "https://assets.freshyo.in/product-images/1769394457296-0" - ] - }, - { - "id": 89, - "images": [ - "https://assets.freshyo.in/product-images/1769395184980-0" - ] - }, - { - "id": 90, - "images": [ - "https://assets.freshyo.in/product-images/1769398103853-0" - ] - }, - { - "id": 91, - "images": [ - "https://assets.freshyo.in/product-images/1769398710713-0" - ] - }, - { - "id": 92, - "images": [ - "https://assets.freshyo.in/product-images/1769399617573-0" - ] - }, - { - "id": 94, - "images": [ - "https://assets.freshyo.in/product-images/1769571810861-0" - ] - }, - { - "id": 95, - "images": [ - "https://assets.freshyo.in/product-images/1769571978680-0" - ] - }, - { - "id": 97, - "images": [ - "https://assets.freshyo.in/product-images/1769577010969-0" - ] - }, - { - "id": 101, - "images": [ - "https://assets.freshyo.in/product-images/1771249922306-0" - ] - }, - { - "id": 103, - "images": [ - "https://assets.freshyo.in/product-images/1771647812442-0" - ] - }, - { - "id": 127, - "images": [ - "https://assets.freshyo.in/product-images/1781711355656.png" - ] - }, - { - "id": 144, - "images": [ - "https://assets.freshyo.in/product-images/1787996184981.jpg" - ] - }, - { - "id": 145, - "images": [ - "https://assets.freshyo.in/product-images/1787996367962.jpg" - ] - }, - { - "id": 146, - "images": [ - "https://assets.freshyo.in/product-images/1787996596668.jpg" - ] - }, - { - "id": 4, - "images": [ - "https://assets.freshyo.in/product-images/1767636171845-0" - ] - }, - { - "id": 14, - "images": [ - "https://assets.freshyo.in/product-images/1768834170995-0" - ] - }, - { - "id": 35, - "images": [ - "https://assets.freshyo.in/product-images/1767636561867-0" - ] - }, - { - "id": 86, - "images": [ - "https://assets.freshyo.in/product-images/1769151216776-0" - ] - }, - { - "id": 98, - "images": [ - "https://assets.freshyo.in/product-images/1770051810386-0" - ] - }, - { - "id": 99, - "images": [ - "https://assets.freshyo.in/product-images/1770051959669-0" - ] - }, - { - "id": 2, - "images": [ - "https://assets.freshyo.in/product-images/1768397780093-0", - "https://assets.freshyo.in/product-images/1768479562478-0" - ] - }, - { - "id": 3, - "images": [ - "https://assets.freshyo.in/product-images/1768475599800-0" - ] - }, - { - "id": 10, - "images": [ - "https://assets.freshyo.in/product-images/1768390245969-0" - ] - }, - { - "id": 21, - "images": [ - "https://assets.freshyo.in/product-images/1768539930897-0", - "https://assets.freshyo.in/product-images/1768539930899-1" - ] - }, - { - "id": 23, - "images": [ - "https://assets.freshyo.in/product-images/1767635527063-0" - ] - }, - { - "id": 24, - "images": [ - "https://assets.freshyo.in/product-images/1768484106870-0" - ] - }, - { - "id": 36, - "images": [ - "https://assets.freshyo.in/product-images/1768413754684-0" - ] - }, - { - "id": 40, - "images": [ - "https://assets.freshyo.in/product-images/1767637606890-0" - ] - }, - { - "id": 41, - "images": [ - "https://assets.freshyo.in/product-images/1768307047191-0" - ] - }, - { - "id": 42, - "images": [ - "https://assets.freshyo.in/product-images/1768393778962-0" - ] - }, - { - "id": 80, - "images": [ - "https://assets.freshyo.in/product-images/1769063336125-0" - ] - }, - { - "id": 137, - "images": [ - "https://assets.freshyo.in/product-images/1787247236467.png" - ] - }, - { - "id": 149, - "images": [ - "https://assets.freshyo.in/product-images/1789123496246.png" - ] - }, - { - "id": 147, - "images": [ - "https://assets.freshyo.in/product-images/1788230211980.png" - ] - }, - { - "id": 141, - "images": [ - "https://assets.freshyo.in/product-images/1787249312475.jpg" - ] - }, - { - "id": 140, - "images": [ - "https://assets.freshyo.in/product-images/1787248824197.png", - "https://assets.freshyo.in/product-images/1787248824464.jpg" - ] - }, - { - "id": 138, - "images": [ - "https://assets.freshyo.in/product-images/1787247755954.jpg" - ] - }, - { - "id": 139, - "images": [ - "https://assets.freshyo.in/product-images/1787248611495.jpg" - ] - }, - { - "id": 136, - "images": [ - "https://assets.freshyo.in/product-images/1788533822538.jpg" - ] - } - ] - }, - { - "id": 1850, - "deliveryTime": "2026-09-18T06:30:00.000Z", - "freezeTime": "2026-09-18T06:20:00.000Z", - "products": [ - { - "id": 129, - "images": [ - "https://assets.freshyo.in/product-images/1784220823113.jpg" - ] - }, - { - "id": 130, - "images": [ - "https://assets.freshyo.in/product-images/1784698463282.jpg" - ] - }, - { - "id": 131, - "images": [ - "https://assets.freshyo.in/product-images/1784221386651.jpg" - ] - }, - { - "id": 132, - "images": [ - "https://assets.freshyo.in/product-images/1784221665870.jpg" - ] - }, - { - "id": 133, - "images": [ - "https://assets.freshyo.in/product-images/1784221842934.jpg" - ] - }, - { - "id": 134, - "images": [ - "https://assets.freshyo.in/product-images/1784222032500.jpg" - ] - }, - { - "id": 135, - "images": [ - "https://assets.freshyo.in/product-images/1784700581756.png" - ] - }, - { - "id": 104, - "images": [ - "https://assets.freshyo.in/product-images/1773126251435-0" - ] - }, - { - "id": 105, - "images": [ - "https://assets.freshyo.in/product-images/1773126524403-0" - ] - }, - { - "id": 106, - "images": [ - "https://assets.freshyo.in/product-images/1773127805418-0" - ] - }, - { - "id": 107, - "images": [ - "https://assets.freshyo.in/product-images/1773128056033-0" - ] - }, - { - "id": 108, - "images": [ - "https://assets.freshyo.in/product-images/1773128303272-0" - ] - }, - { - "id": 109, - "images": [ - "https://assets.freshyo.in/product-images/1773129061191-0" - ] - }, - { - "id": 110, - "images": [ - "https://assets.freshyo.in/product-images/1773129209100-0" - ] - }, - { - "id": 111, - "images": [ - "https://assets.freshyo.in/product-images/1773566003997-0" - ] - }, - { - "id": 112, - "images": [ - "https://assets.freshyo.in/product-images/1773130741608-0" - ] - }, - { - "id": 113, - "images": [ - "https://assets.freshyo.in/product-images/1773566035297-0" - ] - }, - { - "id": 114, - "images": [ - "https://assets.freshyo.in/product-images/1773566115806-0" - ] - }, - { - "id": 115, - "images": [ - "https://assets.freshyo.in/product-images/1773566605539-0" - ] - }, - { - "id": 116, - "images": [ - "https://assets.freshyo.in/product-images/1773209103816-0" - ] - }, - { - "id": 117, - "images": [ - "https://assets.freshyo.in/product-images/1773222507937-0" - ] - }, - { - "id": 118, - "images": [ - "https://assets.freshyo.in/product-images/1773224238549-0" - ] - }, - { - "id": 119, - "images": [ - "https://assets.freshyo.in/product-images/1774961460199-0", - "https://assets.freshyo.in/product-images/1774961460203-1" - ] - }, - { - "id": 120, - "images": [ - "https://assets.freshyo.in/product-images/1774961917278-0" - ] - }, - { - "id": 121, - "images": [ - "https://assets.freshyo.in/product-images/1774967050357-0" - ] - }, - { - "id": 122, - "images": [ - "https://assets.freshyo.in/product-images/1776166347889.png" - ] - }, - { - "id": 123, - "images": [ - "https://assets.freshyo.in/product-images/1776166580757.png" - ] - }, - { - "id": 124, - "images": [ - "https://assets.freshyo.in/product-images/1776166786776.png", - "https://assets.freshyo.in/product-images/1776166787107.jpg" - ] - }, - { - "id": 148, - "images": [ - "https://assets.freshyo.in/product-images/1788767922579.png" - ] - }, - { - "id": 6, - "images": [ - "https://assets.freshyo.in/product-images/1768640936747-0" - ] - }, - { - "id": 7, - "images": [ - "https://assets.freshyo.in/product-images/1768640009078-0" - ] - }, - { - "id": 8, - "images": [ - "https://assets.freshyo.in/product-images/1768647119198-0" - ] - }, - { - "id": 11, - "images": [ - "https://assets.freshyo.in/product-images/1768641635898-0" - ] - }, - { - "id": 13, - "images": [ - "https://assets.freshyo.in/product-images/1768641988607-0" - ] - }, - { - "id": 25, - "images": [ - "https://assets.freshyo.in/product-images/1768649838027-0" - ] - }, - { - "id": 26, - "images": [ - "https://assets.freshyo.in/product-images/1768640645444-0" - ] - }, - { - "id": 38, - "images": [ - "https://assets.freshyo.in/product-images/1768640403001-0" - ] - }, - { - "id": 39, - "images": [ - "https://assets.freshyo.in/product-images/1768650081183-0" - ] - }, - { - "id": 43, - "images": [ - "https://assets.freshyo.in/product-images/1768638795991-0" - ] - }, - { - "id": 44, - "images": [ - "https://assets.freshyo.in/product-images/1768639090932-0" - ] - }, - { - "id": 46, - "images": [ - "https://assets.freshyo.in/product-images/1768639705530-0" - ] - }, - { - "id": 47, - "images": [ - "https://assets.freshyo.in/product-images/1768642455479-0" - ] - }, - { - "id": 48, - "images": [ - "https://assets.freshyo.in/product-images/1768642724520-0" - ] - }, - { - "id": 49, - "images": [ - "https://assets.freshyo.in/product-images/1768643138910-0" - ] - }, - { - "id": 50, - "images": [ - "https://assets.freshyo.in/product-images/1768643354251-0" - ] - }, - { - "id": 51, - "images": [ - "https://assets.freshyo.in/product-images/1768646295695-0" - ] - }, - { - "id": 52, - "images": [ - "https://assets.freshyo.in/product-images/1768646744949-0" - ] - }, - { - "id": 53, - "images": [ - "https://assets.freshyo.in/product-images/1768646932088-0" - ] - }, - { - "id": 54, - "images": [ - "https://assets.freshyo.in/product-images/1768649454994-0" - ] - }, - { - "id": 55, - "images": [ - "https://assets.freshyo.in/product-images/1768650709484-0" - ] - }, - { - "id": 56, - "images": [ - "https://assets.freshyo.in/product-images/1768651334320-0" - ] - }, - { - "id": 57, - "images": [ - "https://assets.freshyo.in/product-images/1768651774899-0" - ] - }, - { - "id": 58, - "images": [ - "https://assets.freshyo.in/product-images/1768652061701-0" - ] - }, - { - "id": 59, - "images": [ - "https://assets.freshyo.in/product-images/1768653009851-0" - ] - }, - { - "id": 60, - "images": [ - "https://assets.freshyo.in/product-images/1768653997561-0" - ] - }, - { - "id": 61, - "images": [ - "https://assets.freshyo.in/product-images/1768654475850-0" - ] - }, - { - "id": 62, - "images": [ - "https://assets.freshyo.in/product-images/1768654740988-0" - ] - }, - { - "id": 63, - "images": [ - "https://assets.freshyo.in/product-images/1768658094891-0" - ] - }, - { - "id": 73, - "images": [ - "https://assets.freshyo.in/product-images/1768718685357-0" - ] - }, - { - "id": 96, - "images": [ - "https://assets.freshyo.in/product-images/1769576743718-0" - ] - }, - { - "id": 100, - "images": [ - "https://assets.freshyo.in/product-images/1770212631435-0" - ] - }, - { - "id": 125, - "images": [ - "https://assets.freshyo.in/product-images/1777263925402.jpg" - ] - }, - { - "id": 126, - "images": [ - "https://assets.freshyo.in/product-images/1778175573767.jpg" - ] - }, - { - "id": 9, - "images": [ - "https://assets.freshyo.in/product-images/1768832690994-0" - ] - }, - { - "id": 22, - "images": [ - "https://assets.freshyo.in/product-images/1768834996932-0" - ] - }, - { - "id": 81, - "images": [ - "https://assets.freshyo.in/product-images/1769063467386-0" - ] - }, - { - "id": 82, - "images": [ - "https://assets.freshyo.in/product-images/1782023099986.png" - ] - }, - { - "id": 102, - "images": [ - "https://assets.freshyo.in/product-images/1771411526889-0" - ] - }, - { - "id": 5, - "images": [ - "https://assets.freshyo.in/product-images/1768710099841-0" - ] - }, - { - "id": 16, - "images": [ - "https://assets.freshyo.in/product-images/1769397372526-0" - ] - }, - { - "id": 17, - "images": [ - "https://assets.freshyo.in/product-images/1768640233068-0" - ] - }, - { - "id": 18, - "images": [ - "https://assets.freshyo.in/product-images/1769351976737-0" - ] - }, - { - "id": 19, - "images": [ - "https://assets.freshyo.in/product-images/1768639707515-0" - ] - }, - { - "id": 27, - "images": [ - "https://assets.freshyo.in/product-images/1768639645423-0" - ] - }, - { - "id": 28, - "images": [ - "https://assets.freshyo.in/product-images/1769356702593-0" - ] - }, - { - "id": 29, - "images": [ - "https://assets.freshyo.in/product-images/1768823985921-0" - ] - }, - { - "id": 30, - "images": [ - "https://assets.freshyo.in/product-images/1768726783083-0" - ] - }, - { - "id": 31, - "images": [ - "https://assets.freshyo.in/product-images/1769574792720-0" - ] - }, - { - "id": 32, - "images": [ - "https://assets.freshyo.in/product-images/1766406273176-0", - "https://assets.freshyo.in/product-images/1766406273178-1" - ] - }, - { - "id": 33, - "images": [ - "https://assets.freshyo.in/product-images/1769396046557-0" - ] - }, - { - "id": 37, - "images": [ - "https://assets.freshyo.in/product-images/1766636589779-0" - ] - }, - { - "id": 45, - "images": [ - "https://assets.freshyo.in/product-images/1768639292540-0" - ] - }, - { - "id": 64, - "images": [ - "https://assets.freshyo.in/product-images/1768709567040-0" - ] - }, - { - "id": 65, - "images": [ - "https://assets.freshyo.in/product-images/1768710434326-0" - ] - }, - { - "id": 66, - "images": [ - "https://assets.freshyo.in/product-images/1768710760133-0" - ] - }, - { - "id": 67, - "images": [ - "https://assets.freshyo.in/product-images/1768711261174-0" - ] - }, - { - "id": 68, - "images": [ - "https://assets.freshyo.in/product-images/1768711919135-0" - ] - }, - { - "id": 69, - "images": [ - "https://assets.freshyo.in/product-images/1768712093829-0" - ] - }, - { - "id": 70, - "images": [ - "https://assets.freshyo.in/product-images/1768712490280-0" - ] - }, - { - "id": 71, - "images": [ - "https://assets.freshyo.in/product-images/1768713206145-0" - ] - }, - { - "id": 72, - "images": [ - "https://assets.freshyo.in/product-images/1768713537512-0" - ] - }, - { - "id": 74, - "images": [ - "https://assets.freshyo.in/product-images/1768713886512-0" - ] - }, - { - "id": 76, - "images": [ - "https://assets.freshyo.in/product-images/1768727264220-0" - ] - }, - { - "id": 77, - "images": [ - "https://assets.freshyo.in/product-images/1769396724595-0" - ] - }, - { - "id": 78, - "images": [ - "https://assets.freshyo.in/product-images/1769241234003-0" - ] - }, - { - "id": 79, - "images": [ - "https://assets.freshyo.in/product-images/1768822893380-0" - ] - }, - { - "id": 88, - "images": [ - "https://assets.freshyo.in/product-images/1769394457296-0" - ] - }, - { - "id": 89, - "images": [ - "https://assets.freshyo.in/product-images/1769395184980-0" - ] - }, - { - "id": 90, - "images": [ - "https://assets.freshyo.in/product-images/1769398103853-0" - ] - }, - { - "id": 91, - "images": [ - "https://assets.freshyo.in/product-images/1769398710713-0" - ] - }, - { - "id": 92, - "images": [ - "https://assets.freshyo.in/product-images/1769399617573-0" - ] - }, - { - "id": 94, - "images": [ - "https://assets.freshyo.in/product-images/1769571810861-0" - ] - }, - { - "id": 95, - "images": [ - "https://assets.freshyo.in/product-images/1769571978680-0" - ] - }, - { - "id": 97, - "images": [ - "https://assets.freshyo.in/product-images/1769577010969-0" - ] - }, - { - "id": 101, - "images": [ - "https://assets.freshyo.in/product-images/1771249922306-0" - ] - }, - { - "id": 103, - "images": [ - "https://assets.freshyo.in/product-images/1771647812442-0" - ] - }, - { - "id": 127, - "images": [ - "https://assets.freshyo.in/product-images/1781711355656.png" - ] - }, - { - "id": 144, - "images": [ - "https://assets.freshyo.in/product-images/1787996184981.jpg" - ] - }, - { - "id": 145, - "images": [ - "https://assets.freshyo.in/product-images/1787996367962.jpg" - ] - }, - { - "id": 146, - "images": [ - "https://assets.freshyo.in/product-images/1787996596668.jpg" - ] - }, - { - "id": 4, - "images": [ - "https://assets.freshyo.in/product-images/1767636171845-0" - ] - }, - { - "id": 14, - "images": [ - "https://assets.freshyo.in/product-images/1768834170995-0" - ] - }, - { - "id": 35, - "images": [ - "https://assets.freshyo.in/product-images/1767636561867-0" - ] - }, - { - "id": 86, - "images": [ - "https://assets.freshyo.in/product-images/1769151216776-0" - ] - }, - { - "id": 98, - "images": [ - "https://assets.freshyo.in/product-images/1770051810386-0" - ] - }, - { - "id": 99, - "images": [ - "https://assets.freshyo.in/product-images/1770051959669-0" - ] - }, - { - "id": 2, - "images": [ - "https://assets.freshyo.in/product-images/1768397780093-0", - "https://assets.freshyo.in/product-images/1768479562478-0" - ] - }, - { - "id": 3, - "images": [ - "https://assets.freshyo.in/product-images/1768475599800-0" - ] - }, - { - "id": 10, - "images": [ - "https://assets.freshyo.in/product-images/1768390245969-0" - ] - }, - { - "id": 21, - "images": [ - "https://assets.freshyo.in/product-images/1768539930897-0", - "https://assets.freshyo.in/product-images/1768539930899-1" - ] - }, - { - "id": 23, - "images": [ - "https://assets.freshyo.in/product-images/1767635527063-0" - ] - }, - { - "id": 24, - "images": [ - "https://assets.freshyo.in/product-images/1768484106870-0" - ] - }, - { - "id": 36, - "images": [ - "https://assets.freshyo.in/product-images/1768413754684-0" - ] - }, - { - "id": 40, - "images": [ - "https://assets.freshyo.in/product-images/1767637606890-0" - ] - }, - { - "id": 41, - "images": [ - "https://assets.freshyo.in/product-images/1768307047191-0" - ] - }, - { - "id": 42, - "images": [ - "https://assets.freshyo.in/product-images/1768393778962-0" - ] - }, - { - "id": 80, - "images": [ - "https://assets.freshyo.in/product-images/1769063336125-0" - ] - }, - { - "id": 137, - "images": [ - "https://assets.freshyo.in/product-images/1787247236467.png" - ] - }, - { - "id": 149, - "images": [ - "https://assets.freshyo.in/product-images/1789123496246.png" - ] - }, - { - "id": 147, - "images": [ - "https://assets.freshyo.in/product-images/1788230211980.png" - ] - }, - { - "id": 141, - "images": [ - "https://assets.freshyo.in/product-images/1787249312475.jpg" - ] - }, - { - "id": 140, - "images": [ - "https://assets.freshyo.in/product-images/1787248824197.png", - "https://assets.freshyo.in/product-images/1787248824464.jpg" - ] - }, - { - "id": 139, - "images": [ - "https://assets.freshyo.in/product-images/1787248611495.jpg" - ] - }, - { - "id": 138, - "images": [ - "https://assets.freshyo.in/product-images/1787247755954.jpg" - ] - }, - { - "id": 136, - "images": [ - "https://assets.freshyo.in/product-images/1788533822538.jpg" - ] - } - ] - }, - { - "id": 1851, - "deliveryTime": "2026-09-18T09:30:00.000Z", - "freezeTime": "2026-09-18T09:20:00.000Z", - "products": [ - { - "id": 129, - "images": [ - "https://assets.freshyo.in/product-images/1784220823113.jpg" - ] - }, - { - "id": 130, - "images": [ - "https://assets.freshyo.in/product-images/1784698463282.jpg" - ] - }, - { - "id": 131, - "images": [ - "https://assets.freshyo.in/product-images/1784221386651.jpg" - ] - }, - { - "id": 132, - "images": [ - "https://assets.freshyo.in/product-images/1784221665870.jpg" - ] - }, - { - "id": 133, - "images": [ - "https://assets.freshyo.in/product-images/1784221842934.jpg" - ] - }, - { - "id": 134, - "images": [ - "https://assets.freshyo.in/product-images/1784222032500.jpg" - ] - }, - { - "id": 135, - "images": [ - "https://assets.freshyo.in/product-images/1784700581756.png" - ] - }, - { - "id": 104, - "images": [ - "https://assets.freshyo.in/product-images/1773126251435-0" - ] - }, - { - "id": 105, - "images": [ - "https://assets.freshyo.in/product-images/1773126524403-0" - ] - }, - { - "id": 106, - "images": [ - "https://assets.freshyo.in/product-images/1773127805418-0" - ] - }, - { - "id": 107, - "images": [ - "https://assets.freshyo.in/product-images/1773128056033-0" - ] - }, - { - "id": 108, - "images": [ - "https://assets.freshyo.in/product-images/1773128303272-0" - ] - }, - { - "id": 109, - "images": [ - "https://assets.freshyo.in/product-images/1773129061191-0" - ] - }, - { - "id": 110, - "images": [ - "https://assets.freshyo.in/product-images/1773129209100-0" - ] - }, - { - "id": 111, - "images": [ - "https://assets.freshyo.in/product-images/1773566003997-0" - ] - }, - { - "id": 112, - "images": [ - "https://assets.freshyo.in/product-images/1773130741608-0" - ] - }, - { - "id": 113, - "images": [ - "https://assets.freshyo.in/product-images/1773566035297-0" - ] - }, - { - "id": 114, - "images": [ - "https://assets.freshyo.in/product-images/1773566115806-0" - ] - }, - { - "id": 115, - "images": [ - "https://assets.freshyo.in/product-images/1773566605539-0" - ] - }, - { - "id": 116, - "images": [ - "https://assets.freshyo.in/product-images/1773209103816-0" - ] - }, - { - "id": 117, - "images": [ - "https://assets.freshyo.in/product-images/1773222507937-0" - ] - }, - { - "id": 118, - "images": [ - "https://assets.freshyo.in/product-images/1773224238549-0" - ] - }, - { - "id": 119, - "images": [ - "https://assets.freshyo.in/product-images/1774961460199-0", - "https://assets.freshyo.in/product-images/1774961460203-1" - ] - }, - { - "id": 120, - "images": [ - "https://assets.freshyo.in/product-images/1774961917278-0" - ] - }, - { - "id": 121, - "images": [ - "https://assets.freshyo.in/product-images/1774967050357-0" - ] - }, - { - "id": 122, - "images": [ - "https://assets.freshyo.in/product-images/1776166347889.png" - ] - }, - { - "id": 123, - "images": [ - "https://assets.freshyo.in/product-images/1776166580757.png" - ] - }, - { - "id": 124, - "images": [ - "https://assets.freshyo.in/product-images/1776166786776.png", - "https://assets.freshyo.in/product-images/1776166787107.jpg" - ] - }, - { - "id": 148, - "images": [ - "https://assets.freshyo.in/product-images/1788767922579.png" - ] - }, - { - "id": 6, - "images": [ - "https://assets.freshyo.in/product-images/1768640936747-0" - ] - }, - { - "id": 7, - "images": [ - "https://assets.freshyo.in/product-images/1768640009078-0" - ] - }, - { - "id": 8, - "images": [ - "https://assets.freshyo.in/product-images/1768647119198-0" - ] - }, - { - "id": 11, - "images": [ - "https://assets.freshyo.in/product-images/1768641635898-0" - ] - }, - { - "id": 13, - "images": [ - "https://assets.freshyo.in/product-images/1768641988607-0" - ] - }, - { - "id": 25, - "images": [ - "https://assets.freshyo.in/product-images/1768649838027-0" - ] - }, - { - "id": 26, - "images": [ - "https://assets.freshyo.in/product-images/1768640645444-0" - ] - }, - { - "id": 38, - "images": [ - "https://assets.freshyo.in/product-images/1768640403001-0" - ] - }, - { - "id": 39, - "images": [ - "https://assets.freshyo.in/product-images/1768650081183-0" - ] - }, - { - "id": 43, - "images": [ - "https://assets.freshyo.in/product-images/1768638795991-0" - ] - }, - { - "id": 44, - "images": [ - "https://assets.freshyo.in/product-images/1768639090932-0" - ] - }, - { - "id": 46, - "images": [ - "https://assets.freshyo.in/product-images/1768639705530-0" - ] - }, - { - "id": 47, - "images": [ - "https://assets.freshyo.in/product-images/1768642455479-0" - ] - }, - { - "id": 48, - "images": [ - "https://assets.freshyo.in/product-images/1768642724520-0" - ] - }, - { - "id": 49, - "images": [ - "https://assets.freshyo.in/product-images/1768643138910-0" - ] - }, - { - "id": 50, - "images": [ - "https://assets.freshyo.in/product-images/1768643354251-0" - ] - }, - { - "id": 51, - "images": [ - "https://assets.freshyo.in/product-images/1768646295695-0" - ] - }, - { - "id": 52, - "images": [ - "https://assets.freshyo.in/product-images/1768646744949-0" - ] - }, - { - "id": 53, - "images": [ - "https://assets.freshyo.in/product-images/1768646932088-0" - ] - }, - { - "id": 54, - "images": [ - "https://assets.freshyo.in/product-images/1768649454994-0" - ] - }, - { - "id": 55, - "images": [ - "https://assets.freshyo.in/product-images/1768650709484-0" - ] - }, - { - "id": 56, - "images": [ - "https://assets.freshyo.in/product-images/1768651334320-0" - ] - }, - { - "id": 57, - "images": [ - "https://assets.freshyo.in/product-images/1768651774899-0" - ] - }, - { - "id": 58, - "images": [ - "https://assets.freshyo.in/product-images/1768652061701-0" - ] - }, - { - "id": 59, - "images": [ - "https://assets.freshyo.in/product-images/1768653009851-0" - ] - }, - { - "id": 60, - "images": [ - "https://assets.freshyo.in/product-images/1768653997561-0" - ] - }, - { - "id": 61, - "images": [ - "https://assets.freshyo.in/product-images/1768654475850-0" - ] - }, - { - "id": 62, - "images": [ - "https://assets.freshyo.in/product-images/1768654740988-0" - ] - }, - { - "id": 63, - "images": [ - "https://assets.freshyo.in/product-images/1768658094891-0" - ] - }, - { - "id": 73, - "images": [ - "https://assets.freshyo.in/product-images/1768718685357-0" - ] - }, - { - "id": 96, - "images": [ - "https://assets.freshyo.in/product-images/1769576743718-0" - ] - }, - { - "id": 100, - "images": [ - "https://assets.freshyo.in/product-images/1770212631435-0" - ] - }, - { - "id": 125, - "images": [ - "https://assets.freshyo.in/product-images/1777263925402.jpg" - ] - }, - { - "id": 126, - "images": [ - "https://assets.freshyo.in/product-images/1778175573767.jpg" - ] - }, - { - "id": 9, - "images": [ - "https://assets.freshyo.in/product-images/1768832690994-0" - ] - }, - { - "id": 22, - "images": [ - "https://assets.freshyo.in/product-images/1768834996932-0" - ] - }, - { - "id": 81, - "images": [ - "https://assets.freshyo.in/product-images/1769063467386-0" - ] - }, - { - "id": 82, - "images": [ - "https://assets.freshyo.in/product-images/1782023099986.png" - ] - }, - { - "id": 102, - "images": [ - "https://assets.freshyo.in/product-images/1771411526889-0" - ] - }, - { - "id": 5, - "images": [ - "https://assets.freshyo.in/product-images/1768710099841-0" - ] - }, - { - "id": 16, - "images": [ - "https://assets.freshyo.in/product-images/1769397372526-0" - ] - }, - { - "id": 17, - "images": [ - "https://assets.freshyo.in/product-images/1768640233068-0" - ] - }, - { - "id": 18, - "images": [ - "https://assets.freshyo.in/product-images/1769351976737-0" - ] - }, - { - "id": 19, - "images": [ - "https://assets.freshyo.in/product-images/1768639707515-0" - ] - }, - { - "id": 27, - "images": [ - "https://assets.freshyo.in/product-images/1768639645423-0" - ] - }, - { - "id": 28, - "images": [ - "https://assets.freshyo.in/product-images/1769356702593-0" - ] - }, - { - "id": 29, - "images": [ - "https://assets.freshyo.in/product-images/1768823985921-0" - ] - }, - { - "id": 30, - "images": [ - "https://assets.freshyo.in/product-images/1768726783083-0" - ] - }, - { - "id": 31, - "images": [ - "https://assets.freshyo.in/product-images/1769574792720-0" - ] - }, - { - "id": 32, - "images": [ - "https://assets.freshyo.in/product-images/1766406273176-0", - "https://assets.freshyo.in/product-images/1766406273178-1" - ] - }, - { - "id": 33, - "images": [ - "https://assets.freshyo.in/product-images/1769396046557-0" - ] - }, - { - "id": 37, - "images": [ - "https://assets.freshyo.in/product-images/1766636589779-0" - ] - }, - { - "id": 45, - "images": [ - "https://assets.freshyo.in/product-images/1768639292540-0" - ] - }, - { - "id": 64, - "images": [ - "https://assets.freshyo.in/product-images/1768709567040-0" - ] - }, - { - "id": 65, - "images": [ - "https://assets.freshyo.in/product-images/1768710434326-0" - ] - }, - { - "id": 66, - "images": [ - "https://assets.freshyo.in/product-images/1768710760133-0" - ] - }, - { - "id": 67, - "images": [ - "https://assets.freshyo.in/product-images/1768711261174-0" - ] - }, - { - "id": 68, - "images": [ - "https://assets.freshyo.in/product-images/1768711919135-0" - ] - }, - { - "id": 69, - "images": [ - "https://assets.freshyo.in/product-images/1768712093829-0" - ] - }, - { - "id": 70, - "images": [ - "https://assets.freshyo.in/product-images/1768712490280-0" - ] - }, - { - "id": 71, - "images": [ - "https://assets.freshyo.in/product-images/1768713206145-0" - ] - }, - { - "id": 72, - "images": [ - "https://assets.freshyo.in/product-images/1768713537512-0" - ] - }, - { - "id": 74, - "images": [ - "https://assets.freshyo.in/product-images/1768713886512-0" - ] - }, - { - "id": 76, - "images": [ - "https://assets.freshyo.in/product-images/1768727264220-0" - ] - }, - { - "id": 77, - "images": [ - "https://assets.freshyo.in/product-images/1769396724595-0" - ] - }, - { - "id": 78, - "images": [ - "https://assets.freshyo.in/product-images/1769241234003-0" - ] - }, - { - "id": 79, - "images": [ - "https://assets.freshyo.in/product-images/1768822893380-0" - ] - }, - { - "id": 88, - "images": [ - "https://assets.freshyo.in/product-images/1769394457296-0" - ] - }, - { - "id": 89, - "images": [ - "https://assets.freshyo.in/product-images/1769395184980-0" - ] - }, - { - "id": 90, - "images": [ - "https://assets.freshyo.in/product-images/1769398103853-0" - ] - }, - { - "id": 91, - "images": [ - "https://assets.freshyo.in/product-images/1769398710713-0" - ] - }, - { - "id": 92, - "images": [ - "https://assets.freshyo.in/product-images/1769399617573-0" - ] - }, - { - "id": 94, - "images": [ - "https://assets.freshyo.in/product-images/1769571810861-0" - ] - }, - { - "id": 95, - "images": [ - "https://assets.freshyo.in/product-images/1769571978680-0" - ] - }, - { - "id": 97, - "images": [ - "https://assets.freshyo.in/product-images/1769577010969-0" - ] - }, - { - "id": 101, - "images": [ - "https://assets.freshyo.in/product-images/1771249922306-0" - ] - }, - { - "id": 103, - "images": [ - "https://assets.freshyo.in/product-images/1771647812442-0" - ] - }, - { - "id": 127, - "images": [ - "https://assets.freshyo.in/product-images/1781711355656.png" - ] - }, - { - "id": 144, - "images": [ - "https://assets.freshyo.in/product-images/1787996184981.jpg" - ] - }, - { - "id": 145, - "images": [ - "https://assets.freshyo.in/product-images/1787996367962.jpg" - ] - }, - { - "id": 146, - "images": [ - "https://assets.freshyo.in/product-images/1787996596668.jpg" - ] - }, - { - "id": 2, - "images": [ - "https://assets.freshyo.in/product-images/1768397780093-0", - "https://assets.freshyo.in/product-images/1768479562478-0" - ] - }, - { - "id": 3, - "images": [ - "https://assets.freshyo.in/product-images/1768475599800-0" - ] - }, - { - "id": 10, - "images": [ - "https://assets.freshyo.in/product-images/1768390245969-0" - ] - }, - { - "id": 21, - "images": [ - "https://assets.freshyo.in/product-images/1768539930897-0", - "https://assets.freshyo.in/product-images/1768539930899-1" - ] - }, - { - "id": 23, - "images": [ - "https://assets.freshyo.in/product-images/1767635527063-0" - ] - }, - { - "id": 24, - "images": [ - "https://assets.freshyo.in/product-images/1768484106870-0" - ] - }, - { - "id": 36, - "images": [ - "https://assets.freshyo.in/product-images/1768413754684-0" - ] - }, - { - "id": 40, - "images": [ - "https://assets.freshyo.in/product-images/1767637606890-0" - ] - }, - { - "id": 41, - "images": [ - "https://assets.freshyo.in/product-images/1768307047191-0" - ] - }, - { - "id": 42, - "images": [ - "https://assets.freshyo.in/product-images/1768393778962-0" - ] - }, - { - "id": 80, - "images": [ - "https://assets.freshyo.in/product-images/1769063336125-0" - ] - }, - { - "id": 137, - "images": [ - "https://assets.freshyo.in/product-images/1787247236467.png" - ] - }, - { - "id": 149, - "images": [ - "https://assets.freshyo.in/product-images/1789123496246.png" - ] - }, - { - "id": 147, - "images": [ - "https://assets.freshyo.in/product-images/1788230211980.png" - ] - }, - { - "id": 141, - "images": [ - "https://assets.freshyo.in/product-images/1787249312475.jpg" - ] - }, - { - "id": 140, - "images": [ - "https://assets.freshyo.in/product-images/1787248824197.png", - "https://assets.freshyo.in/product-images/1787248824464.jpg" - ] - }, - { - "id": 139, - "images": [ - "https://assets.freshyo.in/product-images/1787248611495.jpg" - ] - }, - { - "id": 138, - "images": [ - "https://assets.freshyo.in/product-images/1787247755954.jpg" - ] - }, - { - "id": 136, - "images": [ - "https://assets.freshyo.in/product-images/1788533822538.jpg" - ] - } - ] - }, - { - "id": 1852, - "deliveryTime": "2026-09-18T10:30:00.000Z", - "freezeTime": "2026-09-18T10:20:00.000Z", - "products": [ - { - "id": 129, - "images": [ - "https://assets.freshyo.in/product-images/1784220823113.jpg" - ] - }, - { - "id": 130, - "images": [ - "https://assets.freshyo.in/product-images/1784698463282.jpg" - ] - }, - { - "id": 131, - "images": [ - "https://assets.freshyo.in/product-images/1784221386651.jpg" - ] - }, - { - "id": 132, - "images": [ - "https://assets.freshyo.in/product-images/1784221665870.jpg" - ] - }, - { - "id": 133, - "images": [ - "https://assets.freshyo.in/product-images/1784221842934.jpg" - ] - }, - { - "id": 134, - "images": [ - "https://assets.freshyo.in/product-images/1784222032500.jpg" - ] - }, - { - "id": 135, - "images": [ - "https://assets.freshyo.in/product-images/1784700581756.png" - ] - }, - { - "id": 104, - "images": [ - "https://assets.freshyo.in/product-images/1773126251435-0" - ] - }, - { - "id": 105, - "images": [ - "https://assets.freshyo.in/product-images/1773126524403-0" - ] - }, - { - "id": 106, - "images": [ - "https://assets.freshyo.in/product-images/1773127805418-0" - ] - }, - { - "id": 107, - "images": [ - "https://assets.freshyo.in/product-images/1773128056033-0" - ] - }, - { - "id": 108, - "images": [ - "https://assets.freshyo.in/product-images/1773128303272-0" - ] - }, - { - "id": 109, - "images": [ - "https://assets.freshyo.in/product-images/1773129061191-0" - ] - }, - { - "id": 110, - "images": [ - "https://assets.freshyo.in/product-images/1773129209100-0" - ] - }, - { - "id": 111, - "images": [ - "https://assets.freshyo.in/product-images/1773566003997-0" - ] - }, - { - "id": 112, - "images": [ - "https://assets.freshyo.in/product-images/1773130741608-0" - ] - }, - { - "id": 113, - "images": [ - "https://assets.freshyo.in/product-images/1773566035297-0" - ] - }, - { - "id": 114, - "images": [ - "https://assets.freshyo.in/product-images/1773566115806-0" - ] - }, - { - "id": 115, - "images": [ - "https://assets.freshyo.in/product-images/1773566605539-0" - ] - }, - { - "id": 116, - "images": [ - "https://assets.freshyo.in/product-images/1773209103816-0" - ] - }, - { - "id": 117, - "images": [ - "https://assets.freshyo.in/product-images/1773222507937-0" - ] - }, - { - "id": 118, - "images": [ - "https://assets.freshyo.in/product-images/1773224238549-0" - ] - }, - { - "id": 119, - "images": [ - "https://assets.freshyo.in/product-images/1774961460199-0", - "https://assets.freshyo.in/product-images/1774961460203-1" - ] - }, - { - "id": 120, - "images": [ - "https://assets.freshyo.in/product-images/1774961917278-0" - ] - }, - { - "id": 121, - "images": [ - "https://assets.freshyo.in/product-images/1774967050357-0" - ] - }, - { - "id": 122, - "images": [ - "https://assets.freshyo.in/product-images/1776166347889.png" - ] - }, - { - "id": 123, - "images": [ - "https://assets.freshyo.in/product-images/1776166580757.png" - ] - }, - { - "id": 124, - "images": [ - "https://assets.freshyo.in/product-images/1776166786776.png", - "https://assets.freshyo.in/product-images/1776166787107.jpg" - ] - }, - { - "id": 148, - "images": [ - "https://assets.freshyo.in/product-images/1788767922579.png" - ] - }, - { - "id": 7, - "images": [ - "https://assets.freshyo.in/product-images/1768640009078-0" - ] - }, - { - "id": 8, - "images": [ - "https://assets.freshyo.in/product-images/1768647119198-0" - ] - }, - { - "id": 11, - "images": [ - "https://assets.freshyo.in/product-images/1768641635898-0" - ] - }, - { - "id": 13, - "images": [ - "https://assets.freshyo.in/product-images/1768641988607-0" - ] - }, - { - "id": 25, - "images": [ - "https://assets.freshyo.in/product-images/1768649838027-0" - ] - }, - { - "id": 26, - "images": [ - "https://assets.freshyo.in/product-images/1768640645444-0" - ] - }, - { - "id": 38, - "images": [ - "https://assets.freshyo.in/product-images/1768640403001-0" - ] - }, - { - "id": 39, - "images": [ - "https://assets.freshyo.in/product-images/1768650081183-0" - ] - }, - { - "id": 43, - "images": [ - "https://assets.freshyo.in/product-images/1768638795991-0" - ] - }, - { - "id": 44, - "images": [ - "https://assets.freshyo.in/product-images/1768639090932-0" - ] - }, - { - "id": 46, - "images": [ - "https://assets.freshyo.in/product-images/1768639705530-0" - ] - }, - { - "id": 47, - "images": [ - "https://assets.freshyo.in/product-images/1768642455479-0" - ] - }, - { - "id": 48, - "images": [ - "https://assets.freshyo.in/product-images/1768642724520-0" - ] - }, - { - "id": 49, - "images": [ - "https://assets.freshyo.in/product-images/1768643138910-0" - ] - }, - { - "id": 50, - "images": [ - "https://assets.freshyo.in/product-images/1768643354251-0" - ] - }, - { - "id": 51, - "images": [ - "https://assets.freshyo.in/product-images/1768646295695-0" - ] - }, - { - "id": 52, - "images": [ - "https://assets.freshyo.in/product-images/1768646744949-0" - ] - }, - { - "id": 53, - "images": [ - "https://assets.freshyo.in/product-images/1768646932088-0" - ] - }, - { - "id": 54, - "images": [ - "https://assets.freshyo.in/product-images/1768649454994-0" - ] - }, - { - "id": 55, - "images": [ - "https://assets.freshyo.in/product-images/1768650709484-0" - ] - }, - { - "id": 56, - "images": [ - "https://assets.freshyo.in/product-images/1768651334320-0" - ] - }, - { - "id": 57, - "images": [ - "https://assets.freshyo.in/product-images/1768651774899-0" - ] - }, - { - "id": 58, - "images": [ - "https://assets.freshyo.in/product-images/1768652061701-0" - ] - }, - { - "id": 59, - "images": [ - "https://assets.freshyo.in/product-images/1768653009851-0" - ] - }, - { - "id": 60, - "images": [ - "https://assets.freshyo.in/product-images/1768653997561-0" - ] - }, - { - "id": 61, - "images": [ - "https://assets.freshyo.in/product-images/1768654475850-0" - ] - }, - { - "id": 62, - "images": [ - "https://assets.freshyo.in/product-images/1768654740988-0" - ] - }, - { - "id": 63, - "images": [ - "https://assets.freshyo.in/product-images/1768658094891-0" - ] - }, - { - "id": 73, - "images": [ - "https://assets.freshyo.in/product-images/1768718685357-0" - ] - }, - { - "id": 96, - "images": [ - "https://assets.freshyo.in/product-images/1769576743718-0" - ] - }, - { - "id": 100, - "images": [ - "https://assets.freshyo.in/product-images/1770212631435-0" - ] - }, - { - "id": 125, - "images": [ - "https://assets.freshyo.in/product-images/1777263925402.jpg" - ] - }, - { - "id": 126, - "images": [ - "https://assets.freshyo.in/product-images/1778175573767.jpg" - ] - }, - { - "id": 9, - "images": [ - "https://assets.freshyo.in/product-images/1768832690994-0" - ] - }, - { - "id": 22, - "images": [ - "https://assets.freshyo.in/product-images/1768834996932-0" - ] - }, - { - "id": 81, - "images": [ - "https://assets.freshyo.in/product-images/1769063467386-0" - ] - }, - { - "id": 82, - "images": [ - "https://assets.freshyo.in/product-images/1782023099986.png" - ] - }, - { - "id": 102, - "images": [ - "https://assets.freshyo.in/product-images/1771411526889-0" - ] - }, - { - "id": 5, - "images": [ - "https://assets.freshyo.in/product-images/1768710099841-0" - ] - }, - { - "id": 16, - "images": [ - "https://assets.freshyo.in/product-images/1769397372526-0" - ] - }, - { - "id": 17, - "images": [ - "https://assets.freshyo.in/product-images/1768640233068-0" - ] - }, - { - "id": 18, - "images": [ - "https://assets.freshyo.in/product-images/1769351976737-0" - ] - }, - { - "id": 19, - "images": [ - "https://assets.freshyo.in/product-images/1768639707515-0" - ] - }, - { - "id": 27, - "images": [ - "https://assets.freshyo.in/product-images/1768639645423-0" - ] - }, - { - "id": 28, - "images": [ - "https://assets.freshyo.in/product-images/1769356702593-0" - ] - }, - { - "id": 29, - "images": [ - "https://assets.freshyo.in/product-images/1768823985921-0" - ] - }, - { - "id": 30, - "images": [ - "https://assets.freshyo.in/product-images/1768726783083-0" - ] - }, - { - "id": 31, - "images": [ - "https://assets.freshyo.in/product-images/1769574792720-0" - ] - }, - { - "id": 32, - "images": [ - "https://assets.freshyo.in/product-images/1766406273176-0", - "https://assets.freshyo.in/product-images/1766406273178-1" - ] - }, - { - "id": 33, - "images": [ - "https://assets.freshyo.in/product-images/1769396046557-0" - ] - }, - { - "id": 37, - "images": [ - "https://assets.freshyo.in/product-images/1766636589779-0" - ] - }, - { - "id": 45, - "images": [ - "https://assets.freshyo.in/product-images/1768639292540-0" - ] - }, - { - "id": 64, - "images": [ - "https://assets.freshyo.in/product-images/1768709567040-0" - ] - }, - { - "id": 65, - "images": [ - "https://assets.freshyo.in/product-images/1768710434326-0" - ] - }, - { - "id": 66, - "images": [ - "https://assets.freshyo.in/product-images/1768710760133-0" - ] - }, - { - "id": 67, - "images": [ - "https://assets.freshyo.in/product-images/1768711261174-0" - ] - }, - { - "id": 68, - "images": [ - "https://assets.freshyo.in/product-images/1768711919135-0" - ] - }, - { - "id": 69, - "images": [ - "https://assets.freshyo.in/product-images/1768712093829-0" - ] - }, - { - "id": 70, - "images": [ - "https://assets.freshyo.in/product-images/1768712490280-0" - ] - }, - { - "id": 71, - "images": [ - "https://assets.freshyo.in/product-images/1768713206145-0" - ] - }, - { - "id": 72, - "images": [ - "https://assets.freshyo.in/product-images/1768713537512-0" - ] - }, - { - "id": 74, - "images": [ - "https://assets.freshyo.in/product-images/1768713886512-0" - ] - }, - { - "id": 76, - "images": [ - "https://assets.freshyo.in/product-images/1768727264220-0" - ] - }, - { - "id": 77, - "images": [ - "https://assets.freshyo.in/product-images/1769396724595-0" - ] - }, - { - "id": 78, - "images": [ - "https://assets.freshyo.in/product-images/1769241234003-0" - ] - }, - { - "id": 79, - "images": [ - "https://assets.freshyo.in/product-images/1768822893380-0" - ] - }, - { - "id": 88, - "images": [ - "https://assets.freshyo.in/product-images/1769394457296-0" - ] - }, - { - "id": 89, - "images": [ - "https://assets.freshyo.in/product-images/1769395184980-0" - ] - }, - { - "id": 90, - "images": [ - "https://assets.freshyo.in/product-images/1769398103853-0" - ] - }, - { - "id": 91, - "images": [ - "https://assets.freshyo.in/product-images/1769398710713-0" - ] - }, - { - "id": 92, - "images": [ - "https://assets.freshyo.in/product-images/1769399617573-0" - ] - }, - { - "id": 94, - "images": [ - "https://assets.freshyo.in/product-images/1769571810861-0" - ] - }, - { - "id": 95, - "images": [ - "https://assets.freshyo.in/product-images/1769571978680-0" - ] - }, - { - "id": 97, - "images": [ - "https://assets.freshyo.in/product-images/1769577010969-0" - ] - }, - { - "id": 101, - "images": [ - "https://assets.freshyo.in/product-images/1771249922306-0" - ] - }, - { - "id": 103, - "images": [ - "https://assets.freshyo.in/product-images/1771647812442-0" - ] - }, - { - "id": 127, - "images": [ - "https://assets.freshyo.in/product-images/1781711355656.png" - ] - }, - { - "id": 144, - "images": [ - "https://assets.freshyo.in/product-images/1787996184981.jpg" - ] - }, - { - "id": 145, - "images": [ - "https://assets.freshyo.in/product-images/1787996367962.jpg" - ] - }, - { - "id": 146, - "images": [ - "https://assets.freshyo.in/product-images/1787996596668.jpg" - ] - }, - { - "id": 2, - "images": [ - "https://assets.freshyo.in/product-images/1768397780093-0", - "https://assets.freshyo.in/product-images/1768479562478-0" - ] - }, - { - "id": 3, - "images": [ - "https://assets.freshyo.in/product-images/1768475599800-0" - ] - }, - { - "id": 10, - "images": [ - "https://assets.freshyo.in/product-images/1768390245969-0" - ] - }, - { - "id": 21, - "images": [ - "https://assets.freshyo.in/product-images/1768539930897-0", - "https://assets.freshyo.in/product-images/1768539930899-1" - ] - }, - { - "id": 23, - "images": [ - "https://assets.freshyo.in/product-images/1767635527063-0" - ] - }, - { - "id": 24, - "images": [ - "https://assets.freshyo.in/product-images/1768484106870-0" - ] - }, - { - "id": 36, - "images": [ - "https://assets.freshyo.in/product-images/1768413754684-0" - ] - }, - { - "id": 40, - "images": [ - "https://assets.freshyo.in/product-images/1767637606890-0" - ] - }, - { - "id": 41, - "images": [ - "https://assets.freshyo.in/product-images/1768307047191-0" - ] - }, - { - "id": 42, - "images": [ - "https://assets.freshyo.in/product-images/1768393778962-0" - ] - }, - { - "id": 80, - "images": [ - "https://assets.freshyo.in/product-images/1769063336125-0" - ] - }, - { - "id": 137, - "images": [ - "https://assets.freshyo.in/product-images/1787247236467.png" - ] - }, - { - "id": 149, - "images": [ - "https://assets.freshyo.in/product-images/1789123496246.png" - ] - }, - { - "id": 147, - "images": [ - "https://assets.freshyo.in/product-images/1788230211980.png" - ] - }, - { - "id": 141, - "images": [ - "https://assets.freshyo.in/product-images/1787249312475.jpg" - ] - }, - { - "id": 140, - "images": [ - "https://assets.freshyo.in/product-images/1787248824197.png", - "https://assets.freshyo.in/product-images/1787248824464.jpg" - ] - }, - { - "id": 139, - "images": [ - "https://assets.freshyo.in/product-images/1787248611495.jpg" - ] - }, - { - "id": 138, - "images": [ - "https://assets.freshyo.in/product-images/1787247755954.jpg" - ] - }, - { - "id": 136, - "images": [ - "https://assets.freshyo.in/product-images/1788533822538.jpg" - ] - } - ] - }, - { - "id": 1853, - "deliveryTime": "2026-09-18T12:30:00.000Z", - "freezeTime": "2026-09-18T12:20:00.000Z", - "products": [ - { - "id": 129, - "images": [ - "https://assets.freshyo.in/product-images/1784220823113.jpg" - ] - }, - { - "id": 130, - "images": [ - "https://assets.freshyo.in/product-images/1784698463282.jpg" - ] - }, - { - "id": 131, - "images": [ - "https://assets.freshyo.in/product-images/1784221386651.jpg" - ] - }, - { - "id": 132, - "images": [ - "https://assets.freshyo.in/product-images/1784221665870.jpg" - ] - }, - { - "id": 133, - "images": [ - "https://assets.freshyo.in/product-images/1784221842934.jpg" - ] - }, - { - "id": 134, - "images": [ - "https://assets.freshyo.in/product-images/1784222032500.jpg" - ] - }, - { - "id": 135, - "images": [ - "https://assets.freshyo.in/product-images/1784700581756.png" - ] - }, - { - "id": 104, - "images": [ - "https://assets.freshyo.in/product-images/1773126251435-0" - ] - }, - { - "id": 105, - "images": [ - "https://assets.freshyo.in/product-images/1773126524403-0" - ] - }, - { - "id": 106, - "images": [ - "https://assets.freshyo.in/product-images/1773127805418-0" - ] - }, - { - "id": 107, - "images": [ - "https://assets.freshyo.in/product-images/1773128056033-0" - ] - }, - { - "id": 108, - "images": [ - "https://assets.freshyo.in/product-images/1773128303272-0" - ] - }, - { - "id": 109, - "images": [ - "https://assets.freshyo.in/product-images/1773129061191-0" - ] - }, - { - "id": 110, - "images": [ - "https://assets.freshyo.in/product-images/1773129209100-0" - ] - }, - { - "id": 111, - "images": [ - "https://assets.freshyo.in/product-images/1773566003997-0" - ] - }, - { - "id": 112, - "images": [ - "https://assets.freshyo.in/product-images/1773130741608-0" - ] - }, - { - "id": 113, - "images": [ - "https://assets.freshyo.in/product-images/1773566035297-0" - ] - }, - { - "id": 114, - "images": [ - "https://assets.freshyo.in/product-images/1773566115806-0" - ] - }, - { - "id": 115, - "images": [ - "https://assets.freshyo.in/product-images/1773566605539-0" - ] - }, - { - "id": 116, - "images": [ - "https://assets.freshyo.in/product-images/1773209103816-0" - ] - }, - { - "id": 117, - "images": [ - "https://assets.freshyo.in/product-images/1773222507937-0" - ] - }, - { - "id": 118, - "images": [ - "https://assets.freshyo.in/product-images/1773224238549-0" - ] - }, - { - "id": 119, - "images": [ - "https://assets.freshyo.in/product-images/1774961460199-0", - "https://assets.freshyo.in/product-images/1774961460203-1" - ] - }, - { - "id": 120, - "images": [ - "https://assets.freshyo.in/product-images/1774961917278-0" - ] - }, - { - "id": 121, - "images": [ - "https://assets.freshyo.in/product-images/1774967050357-0" - ] - }, - { - "id": 122, - "images": [ - "https://assets.freshyo.in/product-images/1776166347889.png" - ] - }, - { - "id": 123, - "images": [ - "https://assets.freshyo.in/product-images/1776166580757.png" - ] - }, - { - "id": 124, - "images": [ - "https://assets.freshyo.in/product-images/1776166786776.png", - "https://assets.freshyo.in/product-images/1776166787107.jpg" - ] - }, - { - "id": 148, - "images": [ - "https://assets.freshyo.in/product-images/1788767922579.png" - ] - }, - { - "id": 6, - "images": [ - "https://assets.freshyo.in/product-images/1768640936747-0" - ] - }, - { - "id": 7, - "images": [ - "https://assets.freshyo.in/product-images/1768640009078-0" - ] - }, - { - "id": 8, - "images": [ - "https://assets.freshyo.in/product-images/1768647119198-0" - ] - }, - { - "id": 11, - "images": [ - "https://assets.freshyo.in/product-images/1768641635898-0" - ] - }, - { - "id": 13, - "images": [ - "https://assets.freshyo.in/product-images/1768641988607-0" - ] - }, - { - "id": 25, - "images": [ - "https://assets.freshyo.in/product-images/1768649838027-0" - ] - }, - { - "id": 26, - "images": [ - "https://assets.freshyo.in/product-images/1768640645444-0" - ] - }, - { - "id": 38, - "images": [ - "https://assets.freshyo.in/product-images/1768640403001-0" - ] - }, - { - "id": 39, - "images": [ - "https://assets.freshyo.in/product-images/1768650081183-0" - ] - }, - { - "id": 43, - "images": [ - "https://assets.freshyo.in/product-images/1768638795991-0" - ] - }, - { - "id": 44, - "images": [ - "https://assets.freshyo.in/product-images/1768639090932-0" - ] - }, - { - "id": 46, - "images": [ - "https://assets.freshyo.in/product-images/1768639705530-0" - ] - }, - { - "id": 47, - "images": [ - "https://assets.freshyo.in/product-images/1768642455479-0" - ] - }, - { - "id": 48, - "images": [ - "https://assets.freshyo.in/product-images/1768642724520-0" - ] - }, - { - "id": 49, - "images": [ - "https://assets.freshyo.in/product-images/1768643138910-0" - ] - }, - { - "id": 50, - "images": [ - "https://assets.freshyo.in/product-images/1768643354251-0" - ] - }, - { - "id": 51, - "images": [ - "https://assets.freshyo.in/product-images/1768646295695-0" - ] - }, - { - "id": 52, - "images": [ - "https://assets.freshyo.in/product-images/1768646744949-0" - ] - }, - { - "id": 53, - "images": [ - "https://assets.freshyo.in/product-images/1768646932088-0" - ] - }, - { - "id": 54, - "images": [ - "https://assets.freshyo.in/product-images/1768649454994-0" - ] - }, - { - "id": 55, - "images": [ - "https://assets.freshyo.in/product-images/1768650709484-0" - ] - }, - { - "id": 56, - "images": [ - "https://assets.freshyo.in/product-images/1768651334320-0" - ] - }, - { - "id": 57, - "images": [ - "https://assets.freshyo.in/product-images/1768651774899-0" - ] - }, - { - "id": 58, - "images": [ - "https://assets.freshyo.in/product-images/1768652061701-0" - ] - }, - { - "id": 59, - "images": [ - "https://assets.freshyo.in/product-images/1768653009851-0" - ] - }, - { - "id": 60, - "images": [ - "https://assets.freshyo.in/product-images/1768653997561-0" - ] - }, - { - "id": 61, - "images": [ - "https://assets.freshyo.in/product-images/1768654475850-0" - ] - }, - { - "id": 62, - "images": [ - "https://assets.freshyo.in/product-images/1768654740988-0" - ] - }, - { - "id": 63, - "images": [ - "https://assets.freshyo.in/product-images/1768658094891-0" - ] - }, - { - "id": 73, - "images": [ - "https://assets.freshyo.in/product-images/1768718685357-0" - ] - }, - { - "id": 96, - "images": [ - "https://assets.freshyo.in/product-images/1769576743718-0" - ] - }, - { - "id": 100, - "images": [ - "https://assets.freshyo.in/product-images/1770212631435-0" - ] - }, - { - "id": 125, - "images": [ - "https://assets.freshyo.in/product-images/1777263925402.jpg" - ] - }, - { - "id": 126, - "images": [ - "https://assets.freshyo.in/product-images/1778175573767.jpg" - ] - }, - { - "id": 9, - "images": [ - "https://assets.freshyo.in/product-images/1768832690994-0" - ] - }, - { - "id": 22, - "images": [ - "https://assets.freshyo.in/product-images/1768834996932-0" - ] - }, - { - "id": 81, - "images": [ - "https://assets.freshyo.in/product-images/1769063467386-0" - ] - }, - { - "id": 82, - "images": [ - "https://assets.freshyo.in/product-images/1782023099986.png" - ] - }, - { - "id": 102, - "images": [ - "https://assets.freshyo.in/product-images/1771411526889-0" - ] - }, - { - "id": 2, - "images": [ - "https://assets.freshyo.in/product-images/1768397780093-0", - "https://assets.freshyo.in/product-images/1768479562478-0" - ] - }, - { - "id": 3, - "images": [ - "https://assets.freshyo.in/product-images/1768475599800-0" - ] - }, - { - "id": 10, - "images": [ - "https://assets.freshyo.in/product-images/1768390245969-0" - ] - }, - { - "id": 21, - "images": [ - "https://assets.freshyo.in/product-images/1768539930897-0", - "https://assets.freshyo.in/product-images/1768539930899-1" - ] - }, - { - "id": 23, - "images": [ - "https://assets.freshyo.in/product-images/1767635527063-0" - ] - }, - { - "id": 24, - "images": [ - "https://assets.freshyo.in/product-images/1768484106870-0" - ] - }, - { - "id": 36, - "images": [ - "https://assets.freshyo.in/product-images/1768413754684-0" - ] - }, - { - "id": 40, - "images": [ - "https://assets.freshyo.in/product-images/1767637606890-0" - ] - }, - { - "id": 41, - "images": [ - "https://assets.freshyo.in/product-images/1768307047191-0" - ] - }, - { - "id": 42, - "images": [ - "https://assets.freshyo.in/product-images/1768393778962-0" - ] - }, - { - "id": 80, - "images": [ - "https://assets.freshyo.in/product-images/1769063336125-0" - ] - }, - { - "id": 137, - "images": [ - "https://assets.freshyo.in/product-images/1787247236467.png" - ] - }, - { - "id": 141, - "images": [ - "https://assets.freshyo.in/product-images/1787249312475.jpg" - ] - } - ] - }, - { - "id": 1846, - "deliveryTime": "2026-09-18T13:30:00.000Z", - "freezeTime": "2026-09-18T13:00:00.000Z", - "products": [ - { - "id": 2, - "images": [ - "https://assets.freshyo.in/product-images/1768397780093-0", - "https://assets.freshyo.in/product-images/1768479562478-0" - ] - }, - { - "id": 3, - "images": [ - "https://assets.freshyo.in/product-images/1768475599800-0" - ] - }, - { - "id": 4, - "images": [ - "https://assets.freshyo.in/product-images/1767636171845-0" - ] - }, - { - "id": 5, - "images": [ - "https://assets.freshyo.in/product-images/1768710099841-0" - ] - }, - { - "id": 6, - "images": [ - "https://assets.freshyo.in/product-images/1768640936747-0" - ] - }, - { - "id": 7, - "images": [ - "https://assets.freshyo.in/product-images/1768640009078-0" - ] - }, - { - "id": 8, - "images": [ - "https://assets.freshyo.in/product-images/1768647119198-0" - ] - }, - { - "id": 9, - "images": [ - "https://assets.freshyo.in/product-images/1768832690994-0" - ] - }, - { - "id": 10, - "images": [ - "https://assets.freshyo.in/product-images/1768390245969-0" - ] - }, - { - "id": 11, - "images": [ - "https://assets.freshyo.in/product-images/1768641635898-0" - ] - }, - { - "id": 13, - "images": [ - "https://assets.freshyo.in/product-images/1768641988607-0" - ] - }, - { - "id": 14, - "images": [ - "https://assets.freshyo.in/product-images/1768834170995-0" - ] - }, - { - "id": 16, - "images": [ - "https://assets.freshyo.in/product-images/1769397372526-0" - ] - }, - { - "id": 17, - "images": [ - "https://assets.freshyo.in/product-images/1768640233068-0" - ] - }, - { - "id": 18, - "images": [ - "https://assets.freshyo.in/product-images/1769351976737-0" - ] - }, - { - "id": 19, - "images": [ - "https://assets.freshyo.in/product-images/1768639707515-0" - ] - }, - { - "id": 21, - "images": [ - "https://assets.freshyo.in/product-images/1768539930897-0", - "https://assets.freshyo.in/product-images/1768539930899-1" - ] - }, - { - "id": 22, - "images": [ - "https://assets.freshyo.in/product-images/1768834996932-0" - ] - }, - { - "id": 23, - "images": [ - "https://assets.freshyo.in/product-images/1767635527063-0" - ] - }, - { - "id": 24, - "images": [ - "https://assets.freshyo.in/product-images/1768484106870-0" - ] - }, - { - "id": 25, - "images": [ - "https://assets.freshyo.in/product-images/1768649838027-0" - ] - }, - { - "id": 26, - "images": [ - "https://assets.freshyo.in/product-images/1768640645444-0" - ] - }, - { - "id": 27, - "images": [ - "https://assets.freshyo.in/product-images/1768639645423-0" - ] - }, - { - "id": 28, - "images": [ - "https://assets.freshyo.in/product-images/1769356702593-0" - ] - }, - { - "id": 29, - "images": [ - "https://assets.freshyo.in/product-images/1768823985921-0" - ] - }, - { - "id": 30, - "images": [ - "https://assets.freshyo.in/product-images/1768726783083-0" - ] - }, - { - "id": 31, - "images": [ - "https://assets.freshyo.in/product-images/1769574792720-0" - ] - }, - { - "id": 32, - "images": [ - "https://assets.freshyo.in/product-images/1766406273176-0", - "https://assets.freshyo.in/product-images/1766406273178-1" - ] - }, - { - "id": 33, - "images": [ - "https://assets.freshyo.in/product-images/1769396046557-0" - ] - }, - { - "id": 35, - "images": [ - "https://assets.freshyo.in/product-images/1767636561867-0" - ] - }, - { - "id": 36, - "images": [ - "https://assets.freshyo.in/product-images/1768413754684-0" - ] - }, - { - "id": 37, - "images": [ - "https://assets.freshyo.in/product-images/1766636589779-0" - ] - }, - { - "id": 38, - "images": [ - "https://assets.freshyo.in/product-images/1768640403001-0" - ] - }, - { - "id": 39, - "images": [ - "https://assets.freshyo.in/product-images/1768650081183-0" - ] - }, - { - "id": 40, - "images": [ - "https://assets.freshyo.in/product-images/1767637606890-0" - ] - }, - { - "id": 41, - "images": [ - "https://assets.freshyo.in/product-images/1768307047191-0" - ] - }, - { - "id": 42, - "images": [ - "https://assets.freshyo.in/product-images/1768393778962-0" - ] - }, - { - "id": 43, - "images": [ - "https://assets.freshyo.in/product-images/1768638795991-0" - ] - }, - { - "id": 44, - "images": [ - "https://assets.freshyo.in/product-images/1768639090932-0" - ] - }, - { - "id": 45, - "images": [ - "https://assets.freshyo.in/product-images/1768639292540-0" - ] - }, - { - "id": 46, - "images": [ - "https://assets.freshyo.in/product-images/1768639705530-0" - ] - }, - { - "id": 47, - "images": [ - "https://assets.freshyo.in/product-images/1768642455479-0" - ] - }, - { - "id": 48, - "images": [ - "https://assets.freshyo.in/product-images/1768642724520-0" - ] - }, - { - "id": 49, - "images": [ - "https://assets.freshyo.in/product-images/1768643138910-0" - ] - }, - { - "id": 50, - "images": [ - "https://assets.freshyo.in/product-images/1768643354251-0" - ] - }, - { - "id": 51, - "images": [ - "https://assets.freshyo.in/product-images/1768646295695-0" - ] - }, - { - "id": 52, - "images": [ - "https://assets.freshyo.in/product-images/1768646744949-0" - ] - }, - { - "id": 53, - "images": [ - "https://assets.freshyo.in/product-images/1768646932088-0" - ] - }, - { - "id": 54, - "images": [ - "https://assets.freshyo.in/product-images/1768649454994-0" - ] - }, - { - "id": 55, - "images": [ - "https://assets.freshyo.in/product-images/1768650709484-0" - ] - }, - { - "id": 56, - "images": [ - "https://assets.freshyo.in/product-images/1768651334320-0" - ] - }, - { - "id": 57, - "images": [ - "https://assets.freshyo.in/product-images/1768651774899-0" - ] - }, - { - "id": 58, - "images": [ - "https://assets.freshyo.in/product-images/1768652061701-0" - ] - }, - { - "id": 59, - "images": [ - "https://assets.freshyo.in/product-images/1768653009851-0" - ] - }, - { - "id": 60, - "images": [ - "https://assets.freshyo.in/product-images/1768653997561-0" - ] - }, - { - "id": 61, - "images": [ - "https://assets.freshyo.in/product-images/1768654475850-0" - ] - }, - { - "id": 62, - "images": [ - "https://assets.freshyo.in/product-images/1768654740988-0" - ] - }, - { - "id": 63, - "images": [ - "https://assets.freshyo.in/product-images/1768658094891-0" - ] - }, - { - "id": 64, - "images": [ - "https://assets.freshyo.in/product-images/1768709567040-0" - ] - }, - { - "id": 65, - "images": [ - "https://assets.freshyo.in/product-images/1768710434326-0" - ] - }, - { - "id": 66, - "images": [ - "https://assets.freshyo.in/product-images/1768710760133-0" - ] - }, - { - "id": 67, - "images": [ - "https://assets.freshyo.in/product-images/1768711261174-0" - ] - }, - { - "id": 68, - "images": [ - "https://assets.freshyo.in/product-images/1768711919135-0" - ] - }, - { - "id": 69, - "images": [ - "https://assets.freshyo.in/product-images/1768712093829-0" - ] - }, - { - "id": 70, - "images": [ - "https://assets.freshyo.in/product-images/1768712490280-0" - ] - }, - { - "id": 71, - "images": [ - "https://assets.freshyo.in/product-images/1768713206145-0" - ] - }, - { - "id": 72, - "images": [ - "https://assets.freshyo.in/product-images/1768713537512-0" - ] - }, - { - "id": 73, - "images": [ - "https://assets.freshyo.in/product-images/1768718685357-0" - ] - }, - { - "id": 74, - "images": [ - "https://assets.freshyo.in/product-images/1768713886512-0" - ] - }, - { - "id": 76, - "images": [ - "https://assets.freshyo.in/product-images/1768727264220-0" - ] - }, - { - "id": 77, - "images": [ - "https://assets.freshyo.in/product-images/1769396724595-0" - ] - }, - { - "id": 78, - "images": [ - "https://assets.freshyo.in/product-images/1769241234003-0" - ] - }, - { - "id": 79, - "images": [ - "https://assets.freshyo.in/product-images/1768822893380-0" - ] - }, - { - "id": 80, - "images": [ - "https://assets.freshyo.in/product-images/1769063336125-0" - ] - }, - { - "id": 81, - "images": [ - "https://assets.freshyo.in/product-images/1769063467386-0" - ] - }, - { - "id": 82, - "images": [ - "https://assets.freshyo.in/product-images/1782023099986.png" - ] - }, - { - "id": 86, - "images": [ - "https://assets.freshyo.in/product-images/1769151216776-0" - ] - }, - { - "id": 88, - "images": [ - "https://assets.freshyo.in/product-images/1769394457296-0" - ] - }, - { - "id": 89, - "images": [ - "https://assets.freshyo.in/product-images/1769395184980-0" - ] - }, - { - "id": 90, - "images": [ - "https://assets.freshyo.in/product-images/1769398103853-0" - ] - }, - { - "id": 91, - "images": [ - "https://assets.freshyo.in/product-images/1769398710713-0" - ] - }, - { - "id": 92, - "images": [ - "https://assets.freshyo.in/product-images/1769399617573-0" - ] - }, - { - "id": 94, - "images": [ - "https://assets.freshyo.in/product-images/1769571810861-0" - ] - }, - { - "id": 95, - "images": [ - "https://assets.freshyo.in/product-images/1769571978680-0" - ] - }, - { - "id": 96, - "images": [ - "https://assets.freshyo.in/product-images/1769576743718-0" - ] - }, - { - "id": 97, - "images": [ - "https://assets.freshyo.in/product-images/1769577010969-0" - ] - }, - { - "id": 98, - "images": [ - "https://assets.freshyo.in/product-images/1770051810386-0" - ] - }, - { - "id": 99, - "images": [ - "https://assets.freshyo.in/product-images/1770051959669-0" - ] - }, - { - "id": 100, - "images": [ - "https://assets.freshyo.in/product-images/1770212631435-0" - ] - }, - { - "id": 101, - "images": [ - "https://assets.freshyo.in/product-images/1771249922306-0" - ] - }, - { - "id": 102, - "images": [ - "https://assets.freshyo.in/product-images/1771411526889-0" - ] - }, - { - "id": 103, - "images": [ - "https://assets.freshyo.in/product-images/1771647812442-0" - ] - }, - { - "id": 125, - "images": [ - "https://assets.freshyo.in/product-images/1777263925402.jpg" - ] - }, - { - "id": 126, - "images": [ - "https://assets.freshyo.in/product-images/1778175573767.jpg" - ] - }, - { - "id": 127, - "images": [ - "https://assets.freshyo.in/product-images/1781711355656.png" - ] - }, - { - "id": 137, - "images": [ - "https://assets.freshyo.in/product-images/1787247236467.png" - ] - }, - { - "id": 144, - "images": [ - "https://assets.freshyo.in/product-images/1787996184981.jpg" - ] - }, - { - "id": 145, - "images": [ - "https://assets.freshyo.in/product-images/1787996367962.jpg" - ] - }, - { - "id": 146, - "images": [ - "https://assets.freshyo.in/product-images/1787996596668.jpg" - ] - }, - { - "id": 147, - "images": [ - "https://assets.freshyo.in/product-images/1788230211980.png" - ] - }, - { - "id": 141, - "images": [ - "https://assets.freshyo.in/product-images/1787249312475.jpg" - ] - }, - { - "id": 139, - "images": [ - "https://assets.freshyo.in/product-images/1787248611495.jpg" - ] - }, - { - "id": 140, - "images": [ - "https://assets.freshyo.in/product-images/1787248824197.png", - "https://assets.freshyo.in/product-images/1787248824464.jpg" - ] - }, - { - "id": 138, - "images": [ - "https://assets.freshyo.in/product-images/1787247755954.jpg" - ] - }, - { - "id": 136, - "images": [ - "https://assets.freshyo.in/product-images/1788533822538.jpg" - ] - } - ] - } - ], - "productAvailability": [ - { - "id": 1, - "isOutOfStock": false - }, - { - "id": 2, - "isOutOfStock": false - }, - { - "id": 3, - "isOutOfStock": true - }, - { - "id": 4, - "isOutOfStock": false - }, - { - "id": 5, - "isOutOfStock": false - }, - { - "id": 6, - "isOutOfStock": false - }, - { - "id": 7, - "isOutOfStock": false - }, - { - "id": 8, - "isOutOfStock": false - }, - { - "id": 9, - "isOutOfStock": false - }, - { - "id": 10, - "isOutOfStock": false - }, - { - "id": 11, - "isOutOfStock": true - }, - { - "id": 12, - "isOutOfStock": true - }, - { - "id": 13, - "isOutOfStock": true - }, - { - "id": 14, - "isOutOfStock": false - }, - { - "id": 15, - "isOutOfStock": true - }, - { - "id": 16, - "isOutOfStock": false - }, - { - "id": 17, - "isOutOfStock": true - }, - { - "id": 18, - "isOutOfStock": false - }, - { - "id": 19, - "isOutOfStock": false - }, - { - "id": 20, - "isOutOfStock": true - }, - { - "id": 21, - "isOutOfStock": false - }, - { - "id": 22, - "isOutOfStock": true - }, - { - "id": 23, - "isOutOfStock": false - }, - { - "id": 24, - "isOutOfStock": false - }, - { - "id": 25, - "isOutOfStock": false - }, - { - "id": 26, - "isOutOfStock": false - }, - { - "id": 27, - "isOutOfStock": false - }, - { - "id": 28, - "isOutOfStock": false - }, - { - "id": 29, - "isOutOfStock": false - }, - { - "id": 30, - "isOutOfStock": false - }, - { - "id": 31, - "isOutOfStock": false - }, - { - "id": 32, - "isOutOfStock": false - }, - { - "id": 33, - "isOutOfStock": false - }, - { - "id": 34, - "isOutOfStock": false - }, - { - "id": 35, - "isOutOfStock": false - }, - { - "id": 36, - "isOutOfStock": false - }, - { - "id": 37, - "isOutOfStock": false - }, - { - "id": 38, - "isOutOfStock": true - }, - { - "id": 39, - "isOutOfStock": true - }, - { - "id": 40, - "isOutOfStock": false - }, - { - "id": 41, - "isOutOfStock": false - }, - { - "id": 42, - "isOutOfStock": false - }, - { - "id": 43, - "isOutOfStock": true - }, - { - "id": 44, - "isOutOfStock": false - }, - { - "id": 45, - "isOutOfStock": false - }, - { - "id": 46, - "isOutOfStock": false - }, - { - "id": 47, - "isOutOfStock": false - }, - { - "id": 48, - "isOutOfStock": false - }, - { - "id": 49, - "isOutOfStock": false - }, - { - "id": 50, - "isOutOfStock": true - }, - { - "id": 51, - "isOutOfStock": true - }, - { - "id": 52, - "isOutOfStock": true - }, - { - "id": 53, - "isOutOfStock": false - }, - { - "id": 54, - "isOutOfStock": false - }, - { - "id": 55, - "isOutOfStock": true - }, - { - "id": 56, - "isOutOfStock": false - }, - { - "id": 57, - "isOutOfStock": true - }, - { - "id": 58, - "isOutOfStock": false - }, - { - "id": 59, - "isOutOfStock": false - }, - { - "id": 60, - "isOutOfStock": false - }, - { - "id": 61, - "isOutOfStock": false - }, - { - "id": 62, - "isOutOfStock": true - }, - { - "id": 63, - "isOutOfStock": true - }, - { - "id": 64, - "isOutOfStock": true - }, - { - "id": 65, - "isOutOfStock": false - }, - { - "id": 66, - "isOutOfStock": false - }, - { - "id": 67, - "isOutOfStock": false - }, - { - "id": 68, - "isOutOfStock": true - }, - { - "id": 69, - "isOutOfStock": false - }, - { - "id": 70, - "isOutOfStock": false - }, - { - "id": 71, - "isOutOfStock": false - }, - { - "id": 72, - "isOutOfStock": false - }, - { - "id": 73, - "isOutOfStock": false - }, - { - "id": 74, - "isOutOfStock": false - }, - { - "id": 75, - "isOutOfStock": false - }, - { - "id": 76, - "isOutOfStock": false - }, - { - "id": 77, - "isOutOfStock": false - }, - { - "id": 78, - "isOutOfStock": false - }, - { - "id": 79, - "isOutOfStock": true - }, - { - "id": 80, - "isOutOfStock": false - }, - { - "id": 81, - "isOutOfStock": false - }, - { - "id": 82, - "isOutOfStock": false - }, - { - "id": 83, - "isOutOfStock": false - }, - { - "id": 84, - "isOutOfStock": false - }, - { - "id": 85, - "isOutOfStock": false - }, - { - "id": 86, - "isOutOfStock": false - }, - { - "id": 87, - "isOutOfStock": false - }, - { - "id": 88, - "isOutOfStock": true - }, - { - "id": 89, - "isOutOfStock": false - }, - { - "id": 90, - "isOutOfStock": false - }, - { - "id": 91, - "isOutOfStock": true - }, - { - "id": 92, - "isOutOfStock": false - }, - { - "id": 93, - "isOutOfStock": true - }, - { - "id": 94, - "isOutOfStock": false - }, - { - "id": 95, - "isOutOfStock": false - }, - { - "id": 96, - "isOutOfStock": false - }, - { - "id": 97, - "isOutOfStock": false - }, - { - "id": 98, - "isOutOfStock": false - }, - { - "id": 99, - "isOutOfStock": false - }, - { - "id": 100, - "isOutOfStock": false - }, - { - "id": 101, - "isOutOfStock": false - }, - { - "id": 102, - "isOutOfStock": false - }, - { - "id": 103, - "isOutOfStock": false - }, - { - "id": 104, - "isOutOfStock": false - }, - { - "id": 105, - "isOutOfStock": false - }, - { - "id": 106, - "isOutOfStock": true - }, - { - "id": 107, - "isOutOfStock": true - }, - { - "id": 108, - "isOutOfStock": false - }, - { - "id": 109, - "isOutOfStock": false - }, - { - "id": 110, - "isOutOfStock": true - }, - { - "id": 111, - "isOutOfStock": false - }, - { - "id": 112, - "isOutOfStock": false - }, - { - "id": 113, - "isOutOfStock": false - }, - { - "id": 114, - "isOutOfStock": false - }, - { - "id": 115, - "isOutOfStock": false - }, - { - "id": 116, - "isOutOfStock": false - }, - { - "id": 117, - "isOutOfStock": false - }, - { - "id": 118, - "isOutOfStock": false - }, - { - "id": 119, - "isOutOfStock": true - }, - { - "id": 120, - "isOutOfStock": true - }, - { - "id": 121, - "isOutOfStock": false - }, - { - "id": 122, - "isOutOfStock": true - }, - { - "id": 123, - "isOutOfStock": true - }, - { - "id": 124, - "isOutOfStock": true - }, - { - "id": 125, - "isOutOfStock": true - }, - { - "id": 126, - "isOutOfStock": true - }, - { - "id": 127, - "isOutOfStock": false - }, - { - "id": 128, - "isOutOfStock": false - }, - { - "id": 129, - "isOutOfStock": false - }, - { - "id": 130, - "isOutOfStock": false - }, - { - "id": 131, - "isOutOfStock": false - }, - { - "id": 132, - "isOutOfStock": false - }, - { - "id": 133, - "isOutOfStock": false - }, - { - "id": 134, - "isOutOfStock": false - }, - { - "id": 135, - "isOutOfStock": false - }, - { - "id": 136, - "isOutOfStock": false - }, - { - "id": 137, - "isOutOfStock": false - }, - { - "id": 138, - "isOutOfStock": false - }, - { - "id": 139, - "isOutOfStock": false - }, - { - "id": 140, - "isOutOfStock": false - }, - { - "id": 141, - "isOutOfStock": false - }, - { - "id": 142, - "isOutOfStock": false - }, - { - "id": 143, - "isOutOfStock": false - }, - { - "id": 144, - "isOutOfStock": false - }, - { - "id": 145, - "isOutOfStock": false - }, - { - "id": 146, - "isOutOfStock": false - }, - { - "id": 147, - "isOutOfStock": false - }, - { - "id": 148, - "isOutOfStock": false - }, - { - "id": 149, - "isOutOfStock": false - } - ], - "count": 8 -} \ No newline at end of file diff --git a/apps/user-ui/tests/mocks/mock-store-products-response.json b/apps/user-ui/tests/mocks/mock-store-products-response.json deleted file mode 100644 index 9a2f116..0000000 --- a/apps/user-ui/tests/mocks/mock-store-products-response.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "store": { - "id": 1, - "name": "Meat Store", - "description": "Fresh, high-quality meat sourced from trusted suppliers.", - "signedImageUrl": "https://assets.freshyo.in/store-images/1766052073748.png" - }, - "products": [ - { - "id": 1, - "name": "Chicken Liver", - "shortDescription": "Liver sourced from the farm hens.", - "price": 99, - "marketPrice": 110, - "incrementStep": 1, - "unit": "0.5Kg", - "unitNotation": "0.5Kg", - "images": ["https://assets.freshyo.in/product-images/1768478127128-0"], - "isOutOfStock": false, - "productQuantity": 1 - }, - { - "id": 2, - "name": "Chicken Breast 500 g", - "shortDescription": "Farm Chicken Breast uncut and solid.", - "price": 215, - "marketPrice": 220, - "incrementStep": 1, - "unit": "0.5Kg", - "unitNotation": "0.5Kg", - "images": ["https://assets.freshyo.in/product-images/1768397780093-0"], - "isOutOfStock": false, - "productQuantity": 1 - }, - { - "id": 3, - "name": "Chicken Lollipops", - "shortDescription": "Chicken cut for lollipop starter dish", - "price": 99, - "marketPrice": 120, - "incrementStep": 1, - "unit": "0.25Kg", - "unitNotation": "0.25Kg", - "images": ["https://assets.freshyo.in/product-images/1768475599800-0"], - "isOutOfStock": true, - "productQuantity": 1 - } - ], - "tags": [ - { - "id": 1, - "tagName": "Chicken", - "tagDescription": "Chicken related items", - "imageUrl": null, - "productIds": [1, 2, 3] - } - ] -} diff --git a/apps/user-ui/tests/mocks/mock-stores-response.json b/apps/user-ui/tests/mocks/mock-stores-response.json deleted file mode 100644 index 19dc4da..0000000 --- a/apps/user-ui/tests/mocks/mock-stores-response.json +++ /dev/null @@ -1,124 +0,0 @@ -{ - "stores": [ - { - "id": 1, - "name": "Meat Store", - "description": "\"Fresh, high-quality meat sourced from trusted suppliers and hygienically processed. Cut fresh, packed safely, and delivered to your doorstep.\"", - "signedImageUrl": "https://assets.freshyo.in/store-images/1766052073748.png", - "productCount": 39, - "sampleProducts": [ - { - "id": 1, - "name": "Chicken Liver", - "signedImageUrl": "https://assets.freshyo.in/product-images/1768478127128-0" - }, - { - "id": 2, - "name": "Chicken Breast 500 g", - "signedImageUrl": "https://assets.freshyo.in/product-images/1768397780093-0" - }, - { - "id": 3, - "name": "Chicken Lollipops", - "signedImageUrl": "https://assets.freshyo.in/product-images/1768475599800-0" - } - ] - }, - { - "id": 2, - "name": "The Fruit Store", - "description": "\"Fresh, juicy fruits handpicked for quality and taste. Naturally ripened, carefully packed, and delivered fresh to your home.\"", - "signedImageUrl": "https://assets.freshyo.in/store-images/1766053828604.png", - "productCount": 35, - "sampleProducts": [ - { - "id": 6, - "name": "Apple ( pack of 3) ", - "signedImageUrl": "https://assets.freshyo.in/product-images/1768640936747-0" - }, - { - "id": 7, - "name": "Banana", - "signedImageUrl": "https://assets.freshyo.in/product-images/1768640009078-0" - }, - { - "id": 8, - "name": "Kiwi", - "signedImageUrl": "https://assets.freshyo.in/product-images/1768647119198-0" - } - ] - }, - { - "id": 4, - "name": "Vegetables", - "description": "Fresh, handpicked vegetables delivered straight from trusted farms to your home. Enjoy clean, high-quality sabzi every day-healthy, natural, and full of freshness.", - "signedImageUrl": "https://assets.freshyo.in/store-images/1766051618139.png", - "productCount": 46, - "sampleProducts": [ - { - "id": 5, - "name": "Cucumber(Kheera)", - "signedImageUrl": "https://assets.freshyo.in/product-images/1768710099841-0" - }, - { - "id": 16, - "name": "Arvi (Arbi) – Colocasia Root", - "signedImageUrl": "https://assets.freshyo.in/product-images/1769397372526-0" - }, - { - "id": 17, - "name": "Tomato ", - "signedImageUrl": "https://assets.freshyo.in/product-images/1768640233068-0" - } - ] - }, - { - "id": 8, - "name": "Fruits Juices ", - "description": "", - "signedImageUrl": "https://assets.freshyo.in/store-images/1773121148038.png", - "productCount": 22, - "sampleProducts": [ - { - "id": 104, - "name": "Green grape fresh juice", - "signedImageUrl": "https://assets.freshyo.in/product-images/1773126251435-0" - }, - { - "id": 105, - "name": "Fresh fig juice (anjeer) ", - "signedImageUrl": "https://assets.freshyo.in/product-images/1773126524403-0" - }, - { - "id": 106, - "name": "Chikoo (sapota)fresh juice", - "signedImageUrl": "https://assets.freshyo.in/product-images/1773127805418-0" - } - ] - }, - { - "id": 9, - "name": "Dry Fruits store ", - "description": "", - "signedImageUrl": "https://assets.freshyo.in/store-images/1784697413573.jpg", - "productCount": 7, - "sampleProducts": [ - { - "id": 129, - "name": "Cashew (kaju) ", - "signedImageUrl": "https://assets.freshyo.in/product-images/1784220823113.jpg" - }, - { - "id": 130, - "name": "Badam", - "signedImageUrl": "https://assets.freshyo.in/product-images/1784698463282.jpg" - }, - { - "id": 131, - "name": "Raisins (kishmish) ", - "signedImageUrl": "https://assets.freshyo.in/product-images/1784221386651.jpg" - } - ] - } - ] -} \ No newline at end of file diff --git a/apps/user-ui/tests/mocks/native.ts b/apps/user-ui/tests/mocks/native.ts deleted file mode 100644 index 829548b..0000000 --- a/apps/user-ui/tests/mocks/native.ts +++ /dev/null @@ -1,109 +0,0 @@ -/** - * Module stubs for native / third-party packages that cannot run under jest. - * - * Registered in tests/setup.ts via jest.mock factories. Each factory returns the - * module shape the app expects (default export and/or named exports). - * - * These are deliberately permissive: tests that need to assert behaviour should - * spy on the returned functions (e.g. `Linking.openURL`) or override the module - * themselves. - */ - -import React from 'react' -import { View } from 'react-native' - -/** react-native-webview: render a plain View carrying the source html. */ -export function webviewMock() { - const WebView = ({ source }: { source?: { html?: string } }) => - React.createElement(View, { testID: 'mock-webview', accessibilityLabel: source?.html }) - - return { __esModule: true, WebView, default: WebView } -} - -/** expo-updates: no update available by default (UpdateChecker). */ -export function updatesMock() { - return { - __esModule: true, - checkForUpdateAsync: jest.fn(async () => ({ isAvailable: false })), - fetchUpdateAsync: jest.fn(async () => ({})), - reloadAsync: jest.fn(async () => {}), - isEnabled: true, - } -} - -/** expo-linking. */ -export function linkingMock() { - return { - __esModule: true, - openURL: jest.fn(async () => true), - canOpenURL: jest.fn(async () => true), - createURL: (path: string) => path, - getInitialURL: jest.fn(async () => null), - addEventListener: jest.fn(() => ({ remove: jest.fn() })), - } -} - -/** expo-location: permissions granted, a fixed position, empty geocode. */ -export function locationMock() { - return { - __esModule: true, - Accuracy: { Lowest: 1, Low: 2, Balanced: 3, High: 4, Highest: 5 }, - requestForegroundPermissionsAsync: jest.fn(async () => ({ - status: 'granted', - granted: true, - })), - getForegroundPermissionsAsync: jest.fn(async () => ({ - status: 'granted', - granted: true, - })), - hasServicesEnabledAsync: jest.fn(async () => true), - getCurrentPositionAsync: jest.fn(async () => ({ - coords: { latitude: 17.385, longitude: 78.4867, accuracy: 5 }, - timestamp: Date.now(), - })), - reverseGeocodeAsync: jest.fn(async () => [ - { street: 'Test Street', city: 'Hyderabad', region: 'Telangana', postalCode: '500001' }, - ]), - } -} - -/** expo-notifications: benign no-ops so the provider mounts. */ -export function notificationsMock() { - return { - __esModule: true, - setNotificationHandler: jest.fn(), - getPermissionsAsync: jest.fn(async () => ({ status: 'granted', granted: true })), - requestPermissionsAsync: jest.fn(async () => ({ status: 'granted', granted: true })), - getExpoPushTokenAsync: jest.fn(async () => ({ data: 'ExponentPushToken[test]' })), - getDevicePushTokenAsync: jest.fn(async () => ({ data: 'test' })), - setNotificationChannelAsync: jest.fn(async () => null), - getLastNotificationResponseAsync: jest.fn(async () => null), - addNotificationReceivedListener: jest.fn(() => ({ remove: jest.fn() })), - addNotificationResponseReceivedListener: jest.fn(() => ({ remove: jest.fn() })), - AndroidImportance: { MAX: 5, HIGH: 4, DEFAULT: 3 }, - } -} - -/** expo-secure-store: in-memory backing for common-ui's StorageService. */ -export function secureStoreMock() { - const store = new Map() - - return { - __esModule: true, - isAvailableAsync: jest.fn(async () => true), - getItemAsync: jest.fn(async (key: string) => store.get(key) ?? null), - setItemAsync: jest.fn(async (key: string, value: string) => { - store.set(key, value) - }), - deleteItemAsync: jest.fn(async (key: string) => { - store.delete(key) - }), - getItem: jest.fn((key: string) => store.get(key) ?? null), - setItem: jest.fn((key: string, value: string) => { - store.set(key, value) - }), - deleteItem: jest.fn((key: string) => { - store.delete(key) - }), - } -} diff --git a/apps/user-ui/tests/mocks/procedures.ts b/apps/user-ui/tests/mocks/procedures.ts deleted file mode 100644 index 86c3042..0000000 --- a/apps/user-ui/tests/mocks/procedures.ts +++ /dev/null @@ -1,131 +0,0 @@ -/** - * Assert which tRPC procedures a screen called, and with what input. - * - * Every tRPC call goes through `global.fetch` (httpBatchLink), whose URL is - * `/api/trpc/[,...]?batch=1&input=`. The input param is an - * object keyed by the batch index: `{ "0": { json: }, ... }`. - * - * `tests/mocks/api.ts` installs the fetch stub; pass its returned `fetchMock` - * to these helpers. They are structural (the mock is a jest.fn), so no jest - * types leak into call sites. - */ - -export interface ProcedureCall { - name: string - input: unknown -} - -/** The fetch mock shape these helpers need. */ -export interface FetchMockLike { - mock: { calls: unknown[][] } -} - -const MARKER = '/api/trpc/' - -/** Parse the batch input envelope (`{ "0": { json } }`) from a string. */ -const parseInputEnvelope = (raw: string | undefined) => { - if (!raw) return {} as Record - try { - return JSON.parse(raw) as Record - } catch { - return {} as Record - } -} - -/** - * The batch input map is `{ "0": }`. If a transformer is configured the - * value is a superjson envelope (`{ json, meta }`); this project sends the raw - * input, so fall back to the value itself. - */ -const unwrapInput = (entry: unknown): unknown => { - if ( - entry != null && - typeof entry === 'object' && - 'json' in entry && - 'meta' in entry - ) { - return (entry as { json: unknown }).json - } - return entry -} - -/** - * Split a tRPC request URL into one entry per batched procedure. - * Queries carry the input in the query string; mutations (POST) carry it in the - * request body, so the body is accepted too. - */ -export function parseTrpcUrl(url: string, body?: unknown): ProcedureCall[] { - const target = String(url) - const at = target.indexOf(MARKER) - if (at === -1) return [] - - const rest = target.slice(at + MARKER.length) - const queryAt = rest.indexOf('?') - const path = queryAt === -1 ? rest : rest.slice(0, queryAt) - const query = queryAt === -1 ? '' : rest.slice(queryAt + 1) - - const names = path.split(',').filter(Boolean) - - let inputsByIndex: Record = {} - const match = /(?:^|&)input=([^&]*)/.exec(query) - if (match) { - inputsByIndex = parseInputEnvelope(decodeURIComponent(match[1])) - } else if (typeof body === 'string') { - inputsByIndex = parseInputEnvelope(body) - } - - return names.map((name, index) => ({ - name, - input: unwrapInput(inputsByIndex[String(index)]), - })) -} - -/** Every procedure call recorded by the fetch mock, in order. */ -export function calledProcedures(fetchMock: FetchMockLike): ProcedureCall[] { - return fetchMock.mock.calls.flatMap(([url, options]) => { - const body = (options as { body?: unknown } | undefined)?.body - return parseTrpcUrl(String(url), body) - }) -} - -/** Calls to one procedure. */ -export function procedureCalls( - fetchMock: FetchMockLike, - name: string -): ProcedureCall[] { - return calledProcedures(fetchMock).filter((call) => call.name === name) -} - -/** Assert a procedure was called (optionally exactly `times`). */ -export function expectProcedureCalled( - fetchMock: FetchMockLike, - name: string, - options: { times?: number } = {} -): ProcedureCall[] { - const calls = procedureCalls(fetchMock, name) - - if (options.times != null) { - expect(calls).toHaveLength(options.times) - } else { - expect(calls.length).toBeGreaterThan(0) - } - - return calls -} - -/** Input of the most recent call to a procedure (undefined if never called). */ -export function lastProcedureInput( - fetchMock: FetchMockLike, - name: string -): unknown { - const calls = procedureCalls(fetchMock, name) - return calls.length === 0 ? undefined : calls[calls.length - 1].input -} - -/** Convenience: the single input when a procedure is called exactly once. */ -export function procedureInput( - fetchMock: FetchMockLike, - name: string -): unknown { - return lastProcedureInput(fetchMock, name) -} diff --git a/apps/user-ui/tests/mocks/refresh.ts b/apps/user-ui/tests/mocks/refresh.ts deleted file mode 100644 index 0580a06..0000000 --- a/apps/user-ui/tests/mocks/refresh.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Capture for the refresh hooks. - * - * tests/setup.ts mocks common-ui/hooks/useManualRefresh and useMarkDataFetchers. - * Their real implementations need a navigation container and are irrelevant to - * most assertions, but the home page funnels its pull-to-refresh through them. - * The mocks record the latest callback here so a test can invoke the page's - * handleRefresh directly. - * - * The callbacks are re-registered on every render, so read them only after the - * page has mounted. - */ - -export interface RefreshHooks { - manualRefresh: (() => void) | null - markDataFetchers: (() => void) | null -} - -export const refreshHooks: RefreshHooks = { - manualRefresh: null, - markDataFetchers: null, -} - -export function resetRefreshHooks() { - refreshHooks.manualRefresh = null - refreshHooks.markDataFetchers = null -} diff --git a/apps/user-ui/tests/mocks/router.ts b/apps/user-ui/tests/mocks/router.ts deleted file mode 100644 index de4fb44..0000000 --- a/apps/user-ui/tests/mocks/router.ts +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Shared spies for the mocked expo-router. - * - * The mock lives in each test file rather than in tests/setup.ts: a global mock - * would also apply to tests/home-page/navigation.test.tsx, which needs the real - * router (expo-router/testing-library). Any test file that renders a router - * consumer and is not using the real router must add: - * - * jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - * - * `clearMocks: true` in jest.config.js clears these between tests, but zustand - * stores are not mocks - reset them explicitly where they matter. - */ - -import React from 'react' - -export const routerMock = { - push: jest.fn(), - replace: jest.fn(), - back: jest.fn(), - navigate: jest.fn(), - canGoBack: jest.fn(() => false), - dismissTo: jest.fn(), - dismissAll: jest.fn(), - setParams: jest.fn(), -} - -export function resetRouterMock() { - routerMock.push.mockClear() - routerMock.replace.mockClear() - routerMock.back.mockClear() - routerMock.navigate.mockClear() -} - -/** - * Local search params returned by the mocked router. Tests set - * `searchParamsMock.current` before rendering to simulate a route's params. - */ -export const searchParamsMock: { current: Record } = { - current: {}, -} - -/** Factory for jest.mock('expo-router', ...). */ -export function expoRouterMock() { - return { - useRouter: () => routerMock, - router: routerMock, - usePathname: () => '/', - useLocalSearchParams: () => searchParamsMock.current, - useGlobalSearchParams: () => searchParamsMock.current, - // Run the focus callback once on mount so focus-driven effects (deep-nav - // from home, guards) are exercisable without a real navigator. - useFocusEffect: (callback: () => void | (() => void)) => { - const ran = React.useRef(false) - React.useEffect(() => { - if (ran.current) return - ran.current = true - return callback() - }, []) - }, - Link: ({ children }: { children?: unknown }) => children ?? null, - // Layout primitives used by the route files; render children through. - Slot: ({ children }: { children?: unknown }) => children ?? null, - Stack: ({ children }: { children?: unknown }) => children ?? null, - Tabs: ({ children }: { children?: unknown }) => children ?? null, - Redirect: () => null, - } -} diff --git a/apps/user-ui/tests/screens/auth.test.tsx b/apps/user-ui/tests/screens/auth.test.tsx deleted file mode 100644 index d9a25f2..0000000 --- a/apps/user-ui/tests/screens/auth.test.tsx +++ /dev/null @@ -1,170 +0,0 @@ -/** - * Login + Register (app/(auth)/login.tsx, register.tsx). - * - * AuthContext is the mocked one (tests/mocks/auth.ts) so loginWithToken/register - * are spies; the tRPC mutations go through the fetch mock and are asserted with - * expectProcedureCalled. - * - * login flow: mobile -> (sendOtp) -> otp -> (verifyOtp) -> loginWithToken. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert, ActivityIndicator, TextInput } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import Login from '@/app/(auth)/login' -import Register from '@/app/(auth)/register' -import AuthLayout from '@/app/(auth)/_layout' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { authMock, resetAuthMock } from '../mocks/auth' -import { expectProcedureCalled } from '../mocks/procedures' -import { routerMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const OTP_SUCCESS = { success: true, message: 'OTP sent' } -const VERIFY_SUCCESS = { success: true, token: 'tok', user: { id: 1, mobile: '9876543210' } } -const LOGIN_SUCCESS = { data: { token: 'tok', user: { id: 1 } } } - -async function renderLogin(extraProcedures: Record = {}) { - const api = setupApiMocks({ - procedures: { - 'user.auth.sendOtp': OTP_SUCCESS, - 'user.auth.verifyOtp': VERIFY_SUCCESS, - 'user.auth.login': LOGIN_SUCCESS, - ...extraProcedures, - }, - }) - renderWithProviders(, { centralStores: false }) - await waitFor(() => expect(screen.getByText('Welcome')).toBeVisible()) - return api -} - -describe('Login', () => { - beforeEach(async () => { - resetAuthMock() - await resetStorage() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('renders the mobile step with the submit button', async () => { - await renderLogin() - - expect(screen.getByTestId('user-login-mobile')).toBeVisible() - expect(screen.getByTestId('user-login-submit')).toBeVisible() - }) - - it('rejects an invalid mobile number without calling the API', async () => { - const api = await renderLogin() - - fireEvent.changeText(screen.getByTestId('user-login-mobile'), '12345') - fireEvent.press(screen.getByTestId('user-login-submit')) - - await waitFor(() => - expect( - screen.getByText('Please enter a valid 10-digit mobile number') - ).toBeVisible() - ) - expect( - api.fetchMock.mock.calls.some(([url]) => - String(url).includes('user.auth.sendOtp') - ) - ).toBe(false) - }) - - it('sends an OTP and moves to the OTP step', async () => { - const api = await renderLogin() - - fireEvent.changeText(screen.getByTestId('user-login-mobile'), '9876543210') - fireEvent.press(screen.getByTestId('user-login-submit')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'user.auth.sendOtp')) - expect(await screen.findByText('Enter 4-digit OTP')).toBeVisible() - }) - - it('verifies the OTP and hands the token to the auth context', async () => { - const api = await renderLogin() - - fireEvent.changeText(screen.getByTestId('user-login-mobile'), '9876543210') - fireEvent.press(screen.getByTestId('user-login-submit')) - await waitFor(() => expectProcedureCalled(api.fetchMock, 'user.auth.sendOtp')) - await screen.findByText('Enter 4-digit OTP') - - // The four OTP cells are the only raw TextInputs on this step. - const otpInputs = screen.UNSAFE_getAllByType(TextInput) - expect(otpInputs).toHaveLength(4) - '1234'.split('').forEach((digit, index) => { - fireEvent.changeText(otpInputs[index], digit) - }) - - fireEvent.press(screen.getByTestId('user-login-submit')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'user.auth.verifyOtp')) - await waitFor(() => - expect(authMock.loginWithToken).toHaveBeenCalledWith('tok', VERIFY_SUCCESS.user) - ) - }) - - it('logs in with identifier + password via the password path', async () => { - const api = await renderLogin() - - fireEvent.press(screen.getByTestId('user-login-other-ways')) - await waitFor(() => expect(screen.getByTestId('user-login-identifier')).toBeVisible()) - - fireEvent.changeText(screen.getByTestId('user-login-identifier'), 'me@example.com') - fireEvent.changeText(screen.getByTestId('user-login-password'), 'secret123') - fireEvent.press(screen.getByTestId('user-login-submit')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'user.auth.login')) - await waitFor(() => - expect(authMock.loginWithToken).toHaveBeenCalledWith('tok', LOGIN_SUCCESS.data.user) - ) - }) - - it('opens the terms dialog from the terms link', async () => { - await renderLogin() - - fireEvent.press(screen.getByText('Terms and Conditions')) - - await waitFor(() => expect(screen.getByText('Terms & Conditions')).toBeVisible()) - }) -}) - -describe('Register', () => { - beforeEach(async () => { - resetAuthMock() - await resetStorage() - }) - - it('renders the registration form and links to sign in', async () => { - setupApiMocks() - renderWithProviders(, { centralStores: false }) - - // "Create Account" is both the screen title and the form's submit label. - expect(screen.getAllByText('Create Account').length).toBeGreaterThan(0) - - fireEvent.press(screen.getByText('Sign in')) - expect(routerMock.push).toHaveBeenCalledWith('/(auth)/login') - }) -}) - -describe('Auth layout', () => { - beforeEach(() => resetAuthMock()) - - it('shows a spinner while the session is loading', () => { - authMock.isLoading = true - setupApiMocks() - renderWithProviders(, { centralStores: false }) - - expect(screen.UNSAFE_queryByType(ActivityIndicator)).not.toBeNull() - }) - - it('renders the stack once loading finishes', () => { - authMock.isLoading = false - setupApiMocks() - renderWithProviders(, { centralStores: false }) - - expect(screen.UNSAFE_queryByType(ActivityIndicator)).toBeNull() - }) -}) diff --git a/apps/user-ui/tests/screens/cart-coupons.test.tsx b/apps/user-ui/tests/screens/cart-coupons.test.tsx deleted file mode 100644 index 6e443d2..0000000 --- a/apps/user-ui/tests/screens/cart-coupons.test.tsx +++ /dev/null @@ -1,356 +0,0 @@ -/** - * Cart screen — coupon application and the discount calculation. - * - * components/cart-page.tsx owns the coupon picker and re-derives the discount - * (percentage capped by maxValue, flat capped by maxValue / the item total) before - * the checkout URL is built. The checkout page that consumes `&coupons=` can't be - * mounted in this environment (it spins with a non-empty cart), so the maths is - * pinned here, where the numbers are rendered in the bill. - * - * Cart: 2 x product 2 @ 215 = 430. Consts: freeDeliveryThreshold 249, - * deliveryCharge 15 — the item total clears the threshold, so a large enough - * discount drops it back under and re-adds the fee. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' -import dayjs from 'dayjs' -import { StorageServiceCasual } from 'common-ui/src/services/StorageServiceCasual' - -import CartPage from '@/components/cart-page' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { authMock, resetAuthMock } from '../mocks/auth' -import { routerMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const PRODUCT_ID = 2 // Chicken Breast 500 g, price 215 -const SLOT_ID = 1849 -const TOTAL = 430 // 2 x 215 -const COUPON_ID = 77 - -const futureSlot = () => ({ - id: SLOT_ID, - deliveryTime: dayjs().add(3, 'hour').toISOString(), - freezeTime: dayjs().add(2, 'hour').toISOString(), -}) - -const coupon = (over: Record = {}) => ({ - id: COUPON_ID, - couponCode: 'SAVE10', - discountPercent: null, - flatDiscount: null, - maxValue: null, - minOrder: null, - usages: [], - maxLimitForUser: null, - exclusiveApply: false, - ...over, -}) - -const SECOND_SKU_ID = 4 // Mutton, price 839 - -/** Mount the cart with one line (2 x 215), optionally a second (1 x 839). */ -async function mountCart(coupons: unknown[], withSecondLine = false) { - setupApiMocks({ - procedures: { - 'user.cart.getCartSlots': { - [PRODUCT_ID]: [futureSlot()], - ...(withSecondLine ? { [SECOND_SKU_ID]: [futureSlot()] } : {}), - }, - 'user.coupon.getEligible': { data: coupons }, - }, - }) - - const lines = [ - { - id: 1, - skuId: PRODUCT_ID, - quantity: 2, - slotId: SLOT_ID, - addedAt: new Date().toISOString(), - }, - ] - if (withSecondLine) { - lines.push({ - id: 2, - skuId: SECOND_SKU_ID, - quantity: 1, - slotId: SLOT_ID, - addedAt: new Date().toISOString(), - }) - } - - await StorageServiceCasual.setItem('cart_items', JSON.stringify(lines)) - - renderWithProviders() - await waitFor(() => expect(screen.getByText('Chicken Breast 500 g')).toBeVisible()) - expect(screen.getByText('Offers & Coupons')).toBeVisible() -} - -/** Open the coupon dropdown and pick the single option. */ -async function selectCoupon() { - fireEvent.press(screen.getByText('Select a coupon')) - await waitFor(() => - expect(screen.getByTestId(`coupon-dropdown-option-${COUPON_ID}`)).toBeVisible() - ) - fireEvent.press(screen.getByTestId(`coupon-dropdown-option-${COUPON_ID}`)) -} - -describe('Cart coupon application', () => { - beforeEach(async () => { - resetAuthMock() - authMock.user = { id: 1 } - await resetStorage() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('shows the item total and free delivery before a coupon is applied', async () => { - await mountCart([coupon({ discountPercent: '10' })]) - - // Without a discount the cart is above the threshold, so Item Total and To Pay - // are both ₹430 and the delivery fee is waived. - expect(screen.getAllByText(`₹${TOTAL}`).length).toBeGreaterThan(0) - expect(screen.queryByText('Product Discount')).toBeNull() - expect(screen.getByText('Free')).toBeVisible() - }) - - it('offers the coupon with its computed saving', async () => { - await mountCart([coupon({ discountPercent: '10' })]) - - fireEvent.press(screen.getByText('Select a coupon')) - - // 10% of 430 = 43. - await waitFor(() => expect(screen.getAllByText(/Save ₹43/).length).toBeGreaterThan(0)) - }) - - it('applies a percentage discount and shows the applied code', async () => { - await mountCart([coupon({ discountPercent: '10' })]) - - await selectCoupon() - - expect(screen.getByText('Product Discount')).toBeVisible() - expect(screen.getByText('-₹43')).toBeVisible() - expect(screen.getByText('Coupon Applied')).toBeVisible() - expect(screen.getByText('SAVE10')).toBeVisible() - // 430 - 43 = 387, still above the threshold. - expect(screen.getByText('₹387')).toBeVisible() - }) - - it('caps a percentage discount at maxValue', async () => { - await mountCart([coupon({ discountPercent: '50', maxValue: '50' })]) - - await selectCoupon() - - // 50% of 430 = 215, capped at 50. - expect(screen.getByText('-₹50')).toBeVisible() - expect(screen.getByText('₹380')).toBeVisible() - }) - - it('applies a flat discount', async () => { - await mountCart([coupon({ flatDiscount: '100' })]) - - await selectCoupon() - - expect(screen.getByText('-₹100')).toBeVisible() - expect(screen.getByText('₹330')).toBeVisible() - }) - - it('never discounts below zero — a flat discount larger than the cart is capped at the item total', async () => { - await mountCart([coupon({ flatDiscount: '1000' })]) - - await selectCoupon() - - // min(1000, 430) = 430: the discount equals the item total, not the coupon value. - expect(screen.getByText('-₹430')).toBeVisible() - }) - - it('re-adds the delivery fee when the discount drops the total below the threshold', async () => { - await mountCart([coupon({ flatDiscount: '200' })]) - - await selectCoupon() - - // 430 - 200 = 230 < 249 -> +15 delivery. - expect(screen.getByText('-₹200')).toBeVisible() - expect(screen.getByText('₹245')).toBeVisible() - expect(screen.queryByText('Free')).toBeNull() - }) - - it('removes the coupon and the discount again', async () => { - await mountCart([coupon({ discountPercent: '10' })]) - - await selectCoupon() - expect(screen.getByText('-₹43')).toBeVisible() - - fireEvent.press(screen.getByText('Remove coupons')) - - expect(screen.queryByText('Product Discount')).toBeNull() - expect(screen.queryByText('Coupon Applied')).toBeNull() - expect(screen.getAllByText(`₹${TOTAL}`).length).toBeGreaterThan(0) - }) - - it('lists a min-order coupon as ineligible and does not apply it', async () => { - await mountCart([coupon({ discountPercent: '10', minOrder: '1000' })]) - - fireEvent.press(screen.getByText('Select a coupon')) - - await waitFor(() => - expect(screen.getAllByText(/Min order ₹1000/).length).toBeGreaterThan(0) - ) - - fireEvent.press(screen.getByTestId(`coupon-dropdown-option-${COUPON_ID}`)) - - expect(screen.queryByText('Product Discount')).toBeNull() - expect(screen.queryByText('Coupon Applied')).toBeNull() - }) - - it('expands a product-specific coupon to list the products it applies to', async () => { - // Product 2 = Chicken Breast 500 g, product 4 = Mutton (both in the fixture - // catalog, neither needs to be in the cart). - await mountCart([coupon({ discountPercent: '10', skuIds: [2, 4] })]) - - fireEvent.press(screen.getByText('Select a coupon')) - - await waitFor(() => - expect(screen.getByText('Applies to 2 products')).toBeVisible() - ) - // Collapsed by default. - expect(screen.queryByText('Mutton')).toBeNull() - - fireEvent.press(screen.getByTestId(`coupon-dropdown-option-${COUPON_ID}-detail`)) - - expect(screen.getByTestId(`coupon-dropdown-option-${COUPON_ID}-detail-list`)).toBeVisible() - expect(screen.getByText('Mutton')).toBeVisible() - // Product 2 is already rendered by the cart line above, so count the occurrences. - expect(screen.getAllByText('Chicken Breast 500 g').length).toBeGreaterThan(1) - - // Expanding must not select the coupon (the selected-coupon chip appears only - // when it is actually applied). - expect(screen.queryByTestId('coupon-chip-SAVE10')).toBeNull() - - // Pressing the trigger again collapses it. - fireEvent.press(screen.getByTestId(`coupon-dropdown-option-${COUPON_ID}-detail`)) - expect(screen.queryByText('Mutton')).toBeNull() - }) - - it('collapses the previously expanded coupon and keeps unresolved targets visible', async () => { - await mountCart([ - coupon({ id: COUPON_ID, discountPercent: '10', skuIds: [2] }), - // 999999 is not in the catalog (e.g. a suspended SKU): it still gets a row. - coupon({ id: 78, couponCode: 'MUTTON20', discountPercent: '20', skuIds: [999999] }), - ]) - - fireEvent.press(screen.getByText('Select a coupon')) - - // One product each, so both triggers read "1 product". - await waitFor(() => - expect(screen.getAllByText('Applies to 1 product').length).toBe(2) - ) - - fireEvent.press(screen.getByTestId(`coupon-dropdown-option-${COUPON_ID}-detail`)) - expect(screen.getAllByText('Chicken Breast 500 g').length).toBeGreaterThan(1) - - // Opening the second coupon's list closes the first one. - fireEvent.press(screen.getByTestId('coupon-dropdown-option-78-detail')) - expect(screen.getByText('Product unavailable · #999999')).toBeVisible() - expect(screen.queryByTestId(`coupon-dropdown-option-${COUPON_ID}-detail-list`)).toBeNull() - }) - - it('measures minOrder on the coupon-targeted items, not the whole cart', async () => { - // Cart = 430 (2 x 215) + 839 (1 x Mutton) = 1269. The coupon only targets the - // 430 line and needs 500: measured against the whole cart it would look - // eligible, which is exactly what the backend refuses at placeOrder. - await mountCart([coupon({ discountPercent: '10', skuIds: [PRODUCT_ID], minOrder: '500' })], true) - - fireEvent.press(screen.getByText('Select a coupon')) - - await waitFor(() => - expect(screen.getAllByText(/Add ₹70 more to use this coupon/).length).toBeGreaterThan(0) - ) - }) - - it('reports missing targets ahead of minOrder', async () => { - // Target set matches nothing in the cart and minOrder is above the whole cart: - // "no applicable items" is the truthful reason, not "add ₹N more". - await mountCart([coupon({ discountPercent: '10', skuIds: [999999], minOrder: '2000' })], true) - - fireEvent.press(screen.getByText('Select a coupon')) - - await waitFor(() => - expect(screen.getAllByText(/No applicable items in your cart/).length).toBeGreaterThan(0) - ) - expect(screen.queryByText(/Add ₹/)).toBeNull() - }) - - it('shows a per-product breakdown for a product-specific coupon', async () => { - // 2 x 215 (targeted) + 1 x 839 (Mutton, not targeted): the coupon is 10% of the - // 430 targeted line only, so its whole discount lands on product 2. - await mountCart([coupon({ discountPercent: '10', skuIds: [PRODUCT_ID] })], true) - - await selectCoupon() - // The bill line for the coupon: 10% of 430. - expect(screen.getByText('-₹43')).toBeVisible() - - fireEvent.press(screen.getByTestId(`coupon-breakdown-${COUPON_ID}`)) - - expect(screen.getByTestId('coupon-breakdown-dialog')).toBeVisible() - expect(screen.getByText('Product discount')).toBeVisible() - // Only the targeted product gets a row… - expect(screen.getByTestId(`coupon-breakdown-row-${PRODUCT_ID}`)).toBeVisible() - expect(screen.queryByTestId(`coupon-breakdown-row-${SECOND_SKU_ID}`)).toBeNull() - // …and its share is the coupon's whole discount, shown twice: the row and the - // "total from this coupon" line below it. - expect(screen.getAllByText('−₹43').length).toBe(2) - - fireEvent.press(screen.getByText('Close')) - expect(screen.queryByTestId('coupon-breakdown-dialog')).toBeNull() - }) - - it('offers no breakdown for a coupon that applies to the whole cart', async () => { - await mountCart([coupon({ discountPercent: '10' })], true) - - await selectCoupon() - - expect(screen.getByTestId(`coupon-chip-SAVE10`)).toBeVisible() - expect(screen.queryByTestId(`coupon-breakdown-${COUPON_ID}`)).toBeNull() - }) - - it('hides a coupon that has hit its per-user usage limit', async () => { - await mountCart([ - coupon({ discountPercent: '10', maxLimitForUser: 1, usages: [{ id: 1 }] }), - ]) - - expect(screen.getByText('No coupons available')).toBeVisible() - expect(screen.getByText('No coupons available for this order')).toBeVisible() - }) - - it('drops the discount when a quantity change takes the cart below the minOrder', async () => { - // Seeded at 2 x 215 = 430, so the minOrder-300 coupon is eligible when selected. - await mountCart([coupon({ flatDiscount: '50', minOrder: '300' })]) - - await selectCoupon() - expect(screen.getByText('-₹50')).toBeVisible() - - // Drop to 1 x 215 = 215 < 300 -> the coupon no longer qualifies. - fireEvent.press(screen.getByTestId('cart-item-1-decrement')) - - await waitFor(() => expect(screen.queryByText('Product Discount')).toBeNull()) - expect(screen.queryByText('Coupon Applied')).toBeNull() - expect(screen.getByTestId('cart-item-1-value')).toHaveTextContent('1') - }) - - it('sends the selected coupon id to checkout', async () => { - await mountCart([coupon({ discountPercent: '10' })]) - - await selectCoupon() - fireEvent.press(screen.getByTestId('checkout-button')) - - await waitFor(() => - expect(routerMock.push).toHaveBeenCalledWith( - expect.stringContaining(`&coupons=${COUPON_ID}`) - ) - ) - }) -}) diff --git a/apps/user-ui/tests/screens/cart-money.test.tsx b/apps/user-ui/tests/screens/cart-money.test.tsx deleted file mode 100644 index 539ce17..0000000 --- a/apps/user-ui/tests/screens/cart-money.test.tsx +++ /dev/null @@ -1,171 +0,0 @@ -/** - * Cart money math (components/cart-page.tsx) — the arithmetic that decides what - * the user is quoted before checkout: item total, savings, delivery charge and - * the grand total, computed over a real local cart. - * - * Coupon application and the discount formula live in - * tests/screens/cart-coupons.test.tsx. This file covers the rest of the bill. - * Known display bugs are pinned and listed in tests/KNOWN-GAPS.md. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import { screen, waitFor } from '@testing-library/react-native' -import dayjs from 'dayjs' -import { StorageServiceCasual } from 'common-ui/src/services/StorageServiceCasual' - -import CartPage from '@/components/cart-page' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { authMock, resetAuthMock } from '../mocks/auth' -import { renderWithProviders } from '../helpers/render' - -/** - * Prices and flags come from the availability cache, which the product merge - * treats as the source of truth (useAllProducts). - * SKU_BREAST 215 / market 220 in stock - * SKU_LOLLIPOP 99 / market 120 OUT OF STOCK - * SKU_MUTTON 839 in stock - * SKU_CUCUMBER 15 / market 19 in stock - * SKU_CHICKEN price 15, flashPrice 19 (flash is dearer than regular) - * SKU_LIVER price 99, flashPrice null (flash falls back to the price) - */ -const SKU_BREAST = 2 -const SKU_LOLLIPOP = 3 -const SKU_MUTTON = 4 -const SKU_CUCUMBER = 5 -const SKU_CHICKEN = 19 -const SKU_LIVER = 1 - -const SLOT_A = 1849 - -// consts fixture: freeDeliveryThreshold 249, deliveryCharge 15. - -const futureSlot = () => ({ - id: SLOT_A, - deliveryTime: dayjs().add(3, 'hour').toISOString(), - freezeTime: dayjs().add(2, 'hour').toISOString(), -}) - -const line = (id: number, skuId: number, quantity = 1) => ({ - id, - skuId, - quantity, - slotId: SLOT_A, - addedAt: new Date().toISOString(), -}) - -const seedCart = async (items: unknown[], key = 'cart_items') => - StorageServiceCasual.setItem(key, JSON.stringify(items)) - -const procedures = { - 'user.cart.getCartSlots': Object.fromEntries( - [SKU_BREAST, SKU_LOLLIPOP, SKU_MUTTON, SKU_CUCUMBER, SKU_CHICKEN, SKU_LIVER].map( - (sku) => [sku, [futureSlot()]] - ) - ), - 'user.coupon.getEligible': { data: [] }, -} - -describe('cart money math', () => { - beforeEach(async () => { - resetAuthMock() - authMock.user = { id: 1 } - await resetStorage() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('charges the delivery fee below the free threshold', async () => { - setupApiMocks({ procedures }) - await seedCart([line(1, SKU_BREAST)]) - - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Item Total')).toBeVisible()) - // 215 < 249 -> +15 delivery -> 230. 230 is unique to the To Pay row. - expect(screen.getByText('₹15')).toBeVisible() - expect(screen.getByText('₹230')).toBeVisible() - expect(screen.queryByText('₹235')).toBeNull() - }) - - it('waives the delivery fee at or above the free threshold', async () => { - setupApiMocks({ procedures }) - await seedCart([line(1, SKU_MUTTON)]) - - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Item Total')).toBeVisible()) - // 839 >= 249 -> free delivery. The line, the item total and the grand - // total all read 839. - expect(screen.getByText('Free')).toBeVisible() - expect(screen.getAllByText('₹839')).toHaveLength(3) - }) - - it('excludes out-of-stock lines from the item total and the payable amount', async () => { - setupApiMocks({ procedures }) - await seedCart([line(1, SKU_BREAST), line(2, SKU_LOLLIPOP)]) - - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Item Total')).toBeVisible()) - // The out-of-stock line is still listed and flagged, but does not count. - expect(screen.getByText('Out of Stock')).toBeVisible() - expect(screen.getByText('₹15')).toBeVisible() - expect(screen.getByText('₹230')).toBeVisible() - // 314 + 15 is what the user would have paid had the OOS line counted. - expect(screen.queryByText('₹329')).toBeNull() - }) - - it('totals several lines by price x quantity', async () => { - setupApiMocks({ procedures }) - await seedCart([line(1, SKU_BREAST), line(2, SKU_CUCUMBER, 3)]) - - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Item Total')).toBeVisible()) - // 215 + 15 * 3 = 260 >= 249 -> free delivery. Item total and grand total - // both read 260. - expect(screen.getByText('Free')).toBeVisible() - expect(screen.getAllByText('₹260')).toHaveLength(2) - }) - - it('shows the savings row from the market-price gap', async () => { - setupApiMocks({ procedures }) - // 220 - 215 = 5 saved on the one line. - await seedCart([line(1, SKU_BREAST)]) - - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Products discount')).toBeVisible()) - expect(screen.getByText('₹5')).toBeVisible() - }) - - describe('flash cart pricing', () => { - it('prices the flash cart from flashPrice, not the regular price', async () => { - setupApiMocks({ procedures }) - // SKU_CHICKEN: price 15, flashPrice 19. - await seedCart([line(1, SKU_CHICKEN, 2)], 'flash_cart_items') - - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Item Total')).toBeVisible()) - // 19 * 2 = 38, not 15 * 2 = 30. Flash also has its own free-delivery - // threshold (399), so the 39 fee applies. - expect(screen.getAllByText('₹38')).toHaveLength(2) - expect(screen.getByText('₹39')).toBeVisible() - expect(screen.getByText('₹77')).toBeVisible() - }) - - it('falls back to the regular price when flashPrice is absent', async () => { - setupApiMocks({ procedures }) - // SKU_LIVER: price 99, flashPrice null. - await seedCart([line(1, SKU_LIVER)], 'flash_cart_items') - - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Item Total')).toBeVisible()) - expect(screen.getAllByText('₹99')).toHaveLength(2) - }) - }) -}) diff --git a/apps/user-ui/tests/screens/cart-screen.test.tsx b/apps/user-ui/tests/screens/cart-screen.test.tsx deleted file mode 100644 index 9670244..0000000 --- a/apps/user-ui/tests/screens/cart-screen.test.tsx +++ /dev/null @@ -1,246 +0,0 @@ -/** - * Cart screen (components/cart-page.tsx, mounted by home/cart + flash cart). - * - * Cart data is local (StorageServiceCasual); the screen also queries - * user.cart.getCartSlots (per-product slots) and user.coupon.getEligible. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' -import dayjs from 'dayjs' -import { StorageServiceCasual } from 'common-ui/src/services/StorageServiceCasual' - -import CartPage from '@/components/cart-page' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { authMock, resetAuthMock } from '../mocks/auth' -import { expectProcedureCalled, lastProcedureInput } from '../mocks/procedures' -import { routerMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const PRODUCT_ID = 2 // Chicken Breast 500 g, price 215 (in stock, in a slot) -const OTHER_PRODUCT_ID = 40 // Chicken regular cut Large pieces (in stock) -const SLOT_ID = 1849 -const OTHER_SLOT_ID = 1850 - -const futureSlot = () => ({ - id: SLOT_ID, - deliveryTime: dayjs().add(3, 'hour').toISOString(), - freezeTime: dayjs().add(2, 'hour').toISOString(), -}) - -const otherFutureSlot = () => ({ - id: OTHER_SLOT_ID, - deliveryTime: dayjs().add(5, 'hour').toISOString(), - freezeTime: dayjs().add(4, 'hour').toISOString(), -}) - -async function seedCart(items: unknown[]) { - await StorageServiceCasual.setItem('cart_items', JSON.stringify(items)) -} - -const cartItem = (over: Record = {}) => ({ - id: 1, - skuId: PRODUCT_ID, - quantity: 1, - slotId: SLOT_ID, - addedAt: new Date().toISOString(), - ...over, -}) - -describe('Cart screen', () => { - beforeEach(async () => { - resetAuthMock() - // Signed in by default: the cart screen shows a login wall when signed out, - // and the first-address gate when the user has zero addresses. Individual - // cases flip `authMock.user` / `getUserAddresses` to exercise those. - authMock.user = { id: 1 } - await resetStorage() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('shows the empty state and Start Shopping navigates home', async () => { - setupApiMocks() - renderWithProviders(, { centralStores: true }) - - await waitFor(() => expect(screen.getByText('Your cart is empty')).toBeVisible()) - - fireEvent.press(screen.getByText('Start Shopping')) - expect(routerMock.push).toHaveBeenCalledWith('/(drawer)/(tabs)/home') - }) - - it('renders the seeded line, the bill and queries the cart slots', async () => { - const api = setupApiMocks({ - procedures: { 'user.cart.getCartSlots': { [PRODUCT_ID]: [futureSlot()] } }, - }) - await seedCart([cartItem()]) - - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Chicken Breast 500 g')).toBeVisible()) - expect(screen.getByText('Scheduled Delivery Cart')).toBeVisible() - expect(screen.getByText('To Pay')).toBeVisible() - // Item 215 < threshold 249 -> +15 delivery. - expect(screen.getByText('₹230')).toBeVisible() - - await waitFor(() => { - const calls = expectProcedureCalled(api.fetchMock, 'user.cart.getCartSlots') - expect(lastProcedureInput(api.fetchMock, 'user.cart.getCartSlots')).toEqual({ - regionId: 1, - productIds: [PRODUCT_ID], - }) - expect(calls.length).toBeGreaterThan(0) - }) - }) - - it('queries eligible coupons only when authenticated', async () => { - authMock.user = { id: 1 } - const api = setupApiMocks({ - procedures: { - 'user.cart.getCartSlots': { [PRODUCT_ID]: [futureSlot()] }, - 'user.coupon.getEligible': { data: [] }, - }, - }) - await seedCart([cartItem()]) - - renderWithProviders() - await waitFor(() => expect(screen.getByText('Chicken Breast 500 g')).toBeVisible()) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'user.coupon.getEligible')) - expect(screen.getByText('Offers & Coupons')).toBeVisible() - }) - - it('navigates to checkout with the selected slot', async () => { - setupApiMocks({ - procedures: { 'user.cart.getCartSlots': { [PRODUCT_ID]: [futureSlot()] } }, - }) - await seedCart([cartItem()]) - - renderWithProviders() - await waitFor(() => expect(screen.getByText('Chicken Breast 500 g')).toBeVisible()) - - fireEvent.press(screen.getByTestId('checkout-button')) - - await waitFor(() => - expect(routerMock.push).toHaveBeenCalledWith( - expect.stringContaining('/(drawer)/(tabs)/home/checkout') - ) - ) - }) - - it('shows an enabled merge row when every item can use the majority slot', async () => { - setupApiMocks({ - procedures: { - 'user.cart.getCartSlots': { - [PRODUCT_ID]: [futureSlot(), otherFutureSlot()], - }, - }, - }) - await seedCart([ - cartItem({ id: 1, slotId: SLOT_ID }), - cartItem({ id: 2, slotId: OTHER_SLOT_ID }), - ]) - - renderWithProviders() - await waitFor(() => - expect(screen.getAllByText('Chicken Breast 500 g').length).toBeGreaterThan(0) - ) - - await waitFor(() => expect(screen.getByTestId('delivery-slot-merge')).toBeVisible()) - expect(screen.getByText(/Deliver All items at/)).toBeVisible() - expect(screen.getByTestId('delivery-slot-merge-apply')).toBeVisible() - - fireEvent.press(screen.getByTestId('delivery-slot-merge-apply')) - - // Merging collapses to one slot, so the whole merge row is hidden. - await waitFor(() => expect(screen.queryByTestId('delivery-slot-merge')).toBeNull()) - }) - - it('hides the merge row when one item cannot use the majority slot', async () => { - setupApiMocks({ - procedures: { - 'user.cart.getCartSlots': { - [PRODUCT_ID]: [futureSlot(), otherFutureSlot()], - [OTHER_PRODUCT_ID]: [otherFutureSlot()], - }, - }, - }) - // Majority (lowest id) is SLOT_ID, which OTHER_PRODUCT_ID cannot use. - await seedCart([ - cartItem({ id: 1, slotId: SLOT_ID }), - cartItem({ id: 2, skuId: OTHER_PRODUCT_ID, slotId: OTHER_SLOT_ID }), - ]) - - renderWithProviders() - await waitFor(() => expect(screen.getByTestId('delivery-slot-summary')).toBeVisible()) - expect(screen.queryByTestId('delivery-slot-merge')).toBeNull() - expect(screen.queryByTestId('delivery-slot-merge-apply')).toBeNull() - }) - - it('hides the merge row when only one slot is selected', async () => { - setupApiMocks({ - procedures: { 'user.cart.getCartSlots': { [PRODUCT_ID]: [futureSlot()] } }, - }) - await seedCart([cartItem()]) - - renderWithProviders() - await waitFor(() => expect(screen.getByText('Chicken Breast 500 g')).toBeVisible()) - - await waitFor(() => expect(screen.getByTestId('delivery-slot-summary')).toBeVisible()) - expect(screen.queryByTestId('delivery-slot-merge')).toBeNull() - }) - - it('renders the flash cart variant without slot selection', async () => { - setupApiMocks() - await StorageServiceCasual.setItem( - 'flash_cart_items', - JSON.stringify([cartItem({ slotId: 0 })]) - ) - - renderWithProviders() - - await waitFor(() => expect(screen.getByText('1 Hr Delivery Cart')).toBeVisible()) - expect(screen.queryByText('Scheduled Delivery Cart')).toBeNull() - }) - - it('shows the login wall when signed out', async () => { - authMock.user = null - setupApiMocks() - await seedCart([cartItem()]) - - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Please log in')).toBeVisible()) - expect(screen.getByText('Log In')).toBeVisible() - expect(screen.queryByText('Chicken Breast 500 g')).toBeNull() - }) - - it('shows the add-address gate before the cart when the user has no addresses', async () => { - setupApiMocks({ - procedures: { - 'user.cart.getCartSlots': { [PRODUCT_ID]: [futureSlot()] }, - 'user.address.getUserAddresses': { data: [] }, - }, - }) - await seedCart([cartItem()]) - - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Where should we deliver?')).toBeVisible()) - expect(screen.getByTestId('cart-address-other')).toBeVisible() - expect(screen.queryByText('Chicken Breast 500 g')).toBeNull() - }) - - it('shows the add-address gate even when the cart is empty', async () => { - setupApiMocks({ - procedures: { 'user.address.getUserAddresses': { data: [] } }, - }) - - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Where should we deliver?')).toBeVisible()) - expect(screen.queryByText('Your cart is empty')).toBeNull() - }) -}) diff --git a/apps/user-ui/tests/screens/checkout-coupons.test.tsx b/apps/user-ui/tests/screens/checkout-coupons.test.tsx deleted file mode 100644 index 987e0da..0000000 --- a/apps/user-ui/tests/screens/checkout-coupons.test.tsx +++ /dev/null @@ -1,247 +0,0 @@ -/** - * Checkout page — coupon application and the discount calculation. - * - * The coupon arrives the way the cart passes it (`?coupons=`), so these cases - * exercise the real maths in components/checkout-page.tsx (discountAmount / finalTotal / - * deliveryCharge) and the bill rendered by PaymentAndOrderComponent. This branch was - * unreachable until the Rules-of-Hooks fix: the page threw - * as soon as the cart resolved to slotted items. - * - * Cart: 2 x product 2 @ 215 = 430. Consts: freeDeliveryThreshold 249, deliveryCharge 15 — - * the item total clears the threshold, so a large enough discount drops it back under and - * re-adds the fee. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' -import { StorageServiceCasual } from 'common-ui/src/services/StorageServiceCasual' - -import CheckoutPage from '@/components/checkout-page' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { authMock, resetAuthMock } from '../mocks/auth' -import { expectProcedureCalled, lastProcedureInput } from '../mocks/procedures' -import { routerMock, searchParamsMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const PRODUCT_ID = 2 // Chicken Breast 500 g, price 215 -const SLOT_ID = 1849 -const CART_ITEM_ID = 1 -const TOTAL = 430 // 2 x 215 -const COUPON_ID = 77 - -const coupon = (over: Record = {}) => ({ - id: COUPON_ID, - couponCode: 'SAVE10', - discountPercent: null, - flatDiscount: null, - maxValue: null, - minOrder: null, - usages: [], - maxLimitForUser: null, - exclusiveApply: false, - ...over, -}) - -const ADDRESSES = { - data: [ - { - id: 1, - name: 'Home', - phone: '9876543210', - addressLine1: '12 Main Road', - addressLine2: 'Apt 4', - city: 'Hyderabad', - state: 'Telangana', - isDefault: true, - }, - ], -} - -const PLACE_ORDER_OK = { data: [{ id: 99 }] } - -/** - * Mount checkout with one line (2 x 215) and the given eligible coupons. - * `couponsParam` mirrors what the cart puts in the checkout URL. - */ -async function mountCheckout(coupons: unknown[], couponsParam: number | null = COUPON_ID) { - const api = setupApiMocks({ - procedures: { - 'user.slots.getSlots': { slots: [] }, - 'user.address.getUserAddresses': ADDRESSES, - 'user.coupon.getEligible': { data: coupons }, - 'user.order.placeOrder': PLACE_ORDER_OK, - }, - }) - - await StorageServiceCasual.setItem( - 'cart_items', - JSON.stringify([ - { - id: CART_ITEM_ID, - skuId: PRODUCT_ID, - quantity: 2, - slotId: SLOT_ID, - addedAt: new Date().toISOString(), - }, - ]) - ) - - // The cart builds this as ":". - searchParamsMock.current = { - slots: `${SLOT_ID}:${CART_ITEM_ID}`, - ...(couponsParam ? { coupons: String(couponsParam) } : {}), - } - - renderWithProviders() - await waitFor(() => expect(screen.getByText('To Pay')).toBeVisible()) - // Item Total; with no discount To Pay reads the same, so match either. - expect(screen.getAllByText(`₹${TOTAL}`).length).toBeGreaterThan(0) - - return api -} - -describe('Checkout coupon discount calculation', () => { - beforeEach(async () => { - resetAuthMock() - authMock.user = { id: 1 } - await resetStorage() - searchParamsMock.current = {} - }) - - it('applies a percentage discount to the item total', async () => { - await mountCheckout([coupon({ discountPercent: '10' })]) - - // 10% of 430 = 43; 430 - 43 = 387, still above the 249 threshold -> free delivery. - expect(screen.getByText('Product Discount')).toBeVisible() - expect(screen.getByText('-₹43')).toBeVisible() - expect(screen.getByText('₹387')).toBeVisible() - expect(screen.getByText('Free')).toBeVisible() - // 43 discount + 10 market-price saving (product 2: 220 market vs 215 paid, x2) - // + the 15 delivery fee the discount earned back. - expect(screen.getByText('You saved ₹68 on this order')).toBeVisible() - }) - - it('caps a percentage discount at maxValue', async () => { - await mountCheckout([coupon({ discountPercent: '50', maxValue: '50' })]) - - // 50% of 430 = 215, capped at 50. - expect(screen.getByText('-₹50')).toBeVisible() - expect(screen.getByText('₹380')).toBeVisible() - }) - - it('applies a flat discount', async () => { - await mountCheckout([coupon({ flatDiscount: '100' })]) - - expect(screen.getByText('-₹100')).toBeVisible() - expect(screen.getByText('₹330')).toBeVisible() - }) - - it('caps a flat discount at maxValue', async () => { - await mountCheckout([coupon({ flatDiscount: '200', maxValue: '150' })]) - - expect(screen.getByText('-₹150')).toBeVisible() - expect(screen.getByText('₹280')).toBeVisible() - }) - - it('never discounts below zero — capped at the item total', async () => { - await mountCheckout([coupon({ flatDiscount: '1000' })]) - - // min(1000, 430) = 430: the discount equals the item total, not the coupon value. - // (To Pay would also read ₹15, the same as the delivery fee, so it is not asserted here.) - expect(screen.getByText('-₹430')).toBeVisible() - }) - - it('charges delivery again when the discount drops the total below the threshold', async () => { - await mountCheckout([coupon({ flatDiscount: '200' })]) - - // 430 - 200 = 230 < 249 -> +15 delivery, and the nudge asks for the remainder. - expect(screen.getByText('-₹200')).toBeVisible() - expect(screen.getByText('₹245')).toBeVisible() - expect(screen.getByText('Add products worth ₹19 for free delivery')).toBeVisible() - }) - - it('does not apply a coupon whose minOrder is not met, even from the URL', async () => { - // The id comes straight from ?coupons=, but the eligibility flag is honoured, so a - // coupon the cart cannot use is ignored rather than silently discounted. - await mountCheckout([coupon({ flatDiscount: '50', minOrder: '1000' })]) - - expect(screen.queryByText('Product Discount')).toBeNull() - expect(screen.getByText('Free')).toBeVisible() - }) - - it('ignores a coupon that has hit its per-user usage limit', async () => { - // Usage-limit coupons are filtered out of the eligible list entirely. - await mountCheckout([ - coupon({ flatDiscount: '50', maxLimitForUser: 1, usages: [{ id: 1 }] }), - ]) - - expect(screen.queryByText('Product Discount')).toBeNull() - }) - - it('shows no discount when the URL carries no coupon', async () => { - await mountCheckout([coupon({ discountPercent: '10' })], null) - - expect(screen.queryByText('Product Discount')).toBeNull() - expect(screen.getByText('Free')).toBeVisible() - }) - - it('does not apply or send a coupon whose targets are gone from the order', async () => { - // Picked in the cart (?coupons=77) but its target SKU is not in this order: - // the old code showed it as applied and still sent the id, which placeOrder - // rejects. It is now shown as not applied, with the reason, and dropped. - const api = await mountCheckout([coupon({ discountPercent: '10', skuIds: [999999] })]) - - expect(screen.queryByText('Product Discount')).toBeNull() - expect(screen.getByText('Not applied')).toBeVisible() - expect(screen.getByText('No applicable items in your cart')).toBeVisible() - expect(screen.getAllByText(`₹${TOTAL}`).length).toBeGreaterThan(0) - - fireEvent.press(screen.getByTestId('place-order-button')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'user.order.placeOrder')) - expect(lastProcedureInput(api.fetchMock, 'user.order.placeOrder')).toMatchObject({ - couponIds: undefined, - }) - }) - - it('shows the per-product split for an applied product-specific coupon', async () => { - // 2 x 215, coupon targets product 2 only: the whole 10% (43) lands on it. - await mountCheckout([coupon({ discountPercent: '10', skuIds: [PRODUCT_ID] })]) - - expect(screen.getByText('-₹43')).toBeVisible() - // The "i" only exists for product-specific coupons. - fireEvent.press(screen.getByTestId(`coupon-breakdown-${COUPON_ID}`)) - - expect(screen.getByTestId('coupon-breakdown-dialog')).toBeVisible() - expect(screen.getByTestId(`coupon-breakdown-row-${PRODUCT_ID}`)).toBeVisible() - // Row plus the "Total from this coupon" line. - expect(screen.getAllByText('−₹43').length).toBe(2) - }) - - it('offers no per-product split for a whole-cart coupon', async () => { - await mountCheckout([coupon({ discountPercent: '10' })]) - - expect(screen.getByText('-₹43')).toBeVisible() - expect(screen.queryByTestId(`coupon-breakdown-${COUPON_ID}`)).toBeNull() - }) - - it('sends the selected coupon id with the order', async () => { - const api = await mountCheckout([coupon({ discountPercent: '10' })]) - - fireEvent.press(screen.getByTestId('place-order-button')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'user.order.placeOrder')) - expect(lastProcedureInput(api.fetchMock, 'user.order.placeOrder')).toMatchObject({ - selectedItems: [{ skuId: PRODUCT_ID, quantity: 2, slotId: SLOT_ID }], - addressId: 1, - couponIds: [COUPON_ID], - }) - await waitFor(() => - expect(routerMock.replace).toHaveBeenCalledWith( - './order-success?orderId=99&totalAmount=387' - ) - ) - }) -}) diff --git a/apps/user-ui/tests/screens/checkout-crash.test.tsx b/apps/user-ui/tests/screens/checkout-crash.test.tsx deleted file mode 100644 index 19d547a..0000000 --- a/apps/user-ui/tests/screens/checkout-crash.test.tsx +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Checkout page (components/checkout-page.tsx) — the guard branches plus the - * resolved-bill path. - * - * FIXED (this crash is no longer in tests/KNOWN-GAPS.md): the file used to call - * `trpc.user.coupon.getEligible.useQuery` and four `useMemo`s AFTER its early return - * for the empty-selection case, so the hook count changed (4 -> 9) as soon as - * `useGetCart` resolved from `[]` to real lines and React threw "Rendered more hooks - * than during the previous render" — the screen could not render at all with slotted - * items. The hooks now sit above the guard; the last case asserts the bill that the - * crash used to prevent. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { screen, waitFor } from '@testing-library/react-native' -import { StorageServiceCasual } from 'common-ui/src/services/StorageServiceCasual' - -import CheckoutPage from '@/components/checkout-page' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { authMock, resetAuthMock } from '../mocks/auth' -import { searchParamsMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const SKU_BREAST = 2 // ₹215, in stock -const SKU_LOLLIPOP = 3 // isFlashAvailable: false -const SLOT_A = 1849 - -const line = (id: number, skuId: number, over: Record = {}) => ({ - id, - skuId, - quantity: 1, - slotId: SLOT_A, - addedAt: new Date().toISOString(), - ...over, -}) - -const procedures = { - 'user.address.getUserAddresses': { - data: [{ id: 1, name: 'Home', isDefault: true, addressLine1: 'A St' }], - }, - 'user.slots.getSlots': { slots: [] }, - 'user.coupon.getEligible': { data: [] }, -} - -describe('Checkout page guards', () => { - beforeEach(async () => { - resetAuthMock() - authMock.user = { id: 1 } - await resetStorage() - searchParamsMock.current = {} - setupApiMocks({ procedures }) - }) - - it('asks for delivery slots when the cart lines have none', async () => { - await StorageServiceCasual.setItem('cart_items', JSON.stringify([line(1, SKU_BREAST)])) - - renderWithProviders() - - await waitFor(() => expect(screen.getByText('No items to checkout')).toBeVisible()) - expect( - screen.getByText('Please select delivery slots for your items') - ).toBeVisible() - }) - - it('reports flash-unavailable lines on the flash checkout', async () => { - await StorageServiceCasual.setItem( - 'flash_cart_items', - JSON.stringify([line(1, SKU_LOLLIPOP, { slotId: 0 })]) - ) - - renderWithProviders() - - await waitFor(() => expect(screen.getByText('No items to checkout')).toBeVisible()) - expect( - screen.getByText('None of your cart items are available for flash delivery') - ).toBeVisible() - }) - - it('shows the empty-cart state when there is nothing to pay for', async () => { - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Your cart is empty')).toBeVisible()) - }) - - it('renders the bill once the cart resolves to slotted items', async () => { - await StorageServiceCasual.setItem('cart_items', JSON.stringify([line(1, SKU_BREAST)])) - searchParamsMock.current = { slots: `${SLOT_A}:1` } - - renderWithProviders() - - // This mount used to throw "Rendered more hooks than during the previous render." - await waitFor(() => expect(screen.getByText('To Pay')).toBeVisible()) - expect(screen.getByText('Scheduled Delivery Checkout')).toBeVisible() - expect(screen.getByText('₹215')).toBeVisible() // Item Total: 1 x 215 - expect(screen.getByText('₹230')).toBeVisible() // + 15 delivery, under the 249 threshold - expect(screen.queryByText('Product Discount')).toBeNull() - }) -}) diff --git a/apps/user-ui/tests/screens/checkout.test.tsx b/apps/user-ui/tests/screens/checkout.test.tsx deleted file mode 100644 index 9b510cf..0000000 --- a/apps/user-ui/tests/screens/checkout.test.tsx +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Checkout page (components/checkout-page.tsx) — header, guard and the - * empty-cart path. The order flow itself is covered by payment-and-order. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import CheckoutPage from '@/components/checkout-page' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { authMock, resetAuthMock } from '../mocks/auth' -import { routerMock, searchParamsMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -describe('Checkout page', () => { - beforeEach(async () => { - resetAuthMock() - authMock.user = { id: 1 } - await resetStorage() - searchParamsMock.current = {} - }) - - it('shows the empty-cart state and goes back', async () => { - setupApiMocks({ - procedures: { - 'user.address.getUserAddresses': { data: [] }, - 'user.slots.getSlots': { slots: [] }, - 'user.coupon.getEligible': { data: [] }, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Your cart is empty')).toBeVisible()) - - fireEvent.press(screen.getByText('Back to Shopping')) - expect(routerMock.back).toHaveBeenCalled() - }) - - it('redirects to login when unauthenticated', async () => { - resetAuthMock() - setupApiMocks({ - procedures: { - 'user.slots.getSlots': { slots: [] }, - }, - }) - renderWithProviders() - - await waitFor(() => expect(routerMock.push).toHaveBeenCalledWith('/(auth)/login')) - }) -}) diff --git a/apps/user-ui/tests/screens/flash-gate.test.tsx b/apps/user-ui/tests/screens/flash-gate.test.tsx deleted file mode 100644 index fccd4de..0000000 --- a/apps/user-ui/tests/screens/flash-gate.test.tsx +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Flash delivery gate (app/(drawer)/(tabs)/flash-delivery/_layout.tsx). - * - * `isFlashDeliveryEnabled` comes from essentialConsts; when false the layout - * replaces the slot content with an "Unavailable" screen. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import FlashDeliveryBaseLayout from '@/app/(drawer)/(tabs)/flash-delivery/_layout' -import { - ESSENTIAL_CONSTS_DATA, - FLASH_ENABLED_CONSTS, - resetEssentialConsts, - resetStorage, - setupApiMocks, -} from '../mocks/api' -import { procedureCalls } from '../mocks/procedures' -import { routerMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -describe('Flash delivery gate', () => { - beforeEach(async () => { - await resetEssentialConsts() - await resetStorage() - }) - - it('shows the unavailable screen and routes home when disabled', async () => { - setupApiMocks({ consts: ESSENTIAL_CONSTS_DATA }) - renderWithProviders(, { centralStores: false }) - - await waitFor(() => - expect(screen.getByText('1 Hr Delivery Unavailable')).toBeVisible() - ) - expect(screen.getByText(/not available at the moment/i)).toBeVisible() - - fireEvent.press(screen.getByText('Go to Scheduled Delivery')) - expect(routerMock.replace).toHaveBeenCalledWith('/(drawer)/(tabs)/home') - }) - - it('renders the slot content when enabled', async () => { - const api = setupApiMocks({ consts: FLASH_ENABLED_CONSTS }) - renderWithProviders(, { centralStores: false }) - - await waitFor(() => - expect( - procedureCalls(api.fetchMock, 'common.essentialConsts').length - ).toBeGreaterThan(0) - ) - expect(screen.queryByText('1 Hr Delivery Unavailable')).toBeNull() - }) -}) diff --git a/apps/user-ui/tests/screens/me-account.test.tsx b/apps/user-ui/tests/screens/me-account.test.tsx deleted file mode 100644 index cb0480b..0000000 --- a/apps/user-ui/tests/screens/me-account.test.tsx +++ /dev/null @@ -1,354 +0,0 @@ -/** - * Me account screens: addresses, coupons, complaints, edit-profile, terms. - * Each mutating button asserts its tRPC procedure. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert, Linking } from 'react-native' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' - -import Addresses from '@/app/(drawer)/(tabs)/me/addresses/index' -import Coupons from '@/app/(drawer)/(tabs)/me/coupons/index' -import Complaints from '@/app/(drawer)/(tabs)/me/complaints/index' -import EditProfile from '@/app/(drawer)/(tabs)/me/edit-profile/index' -import Terms from '@/app/(drawer)/(tabs)/me/terms/index' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { authMock, resetAuthMock } from '../mocks/auth' -import { expectProcedureCalled, lastProcedureInput, procedureCalls } from '../mocks/procedures' -import { routerMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const ADDRESS = { - id: 1, - name: 'Home', - phone: '9876543210', - addressLine1: '12 Main Road', - addressLine2: 'Apt 4', - city: 'Hyderabad', - state: 'Telangana', - isDefault: false, -} - -/** Invoke a button inside a React Native Alert from the alert spy. */ -const pressAlertButton = (label: string) => { - const calls = (Alert.alert as jest.Mock).mock.calls - for (let i = calls.length - 1; i >= 0; i -= 1) { - const buttons = calls[i][2] as { text: string; onPress?: () => void }[] | undefined - const button = buttons?.find((b) => b.text === label) - if (button?.onPress) { - act(() => button.onPress?.()) - return - } - } - throw new Error(`[tests] no alert button "${label}"`) -} - -beforeEach(async () => { - // Flush a batched tRPC request left over from the previous test while its - // fetch mock is still installed, so it cannot land in this test's mock and - // fail as an unmocked procedure. - await act(async () => { - jest.advanceTimersByTime(1) - }) -}) - -describe('Addresses screen', () => { - beforeEach(async () => { - await resetStorage() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('lists the addresses and singles out the default', async () => { - setupApiMocks({ - procedures: { 'user.address.getUserAddresses': { data: [ADDRESS] } }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Home')).toBeVisible()) - expect(screen.getByText('My Addresses')).toBeVisible() - expect(screen.getByText('Set Default')).toBeVisible() - }) - - it('shows the empty state with an Add Address action', async () => { - setupApiMocks({ - procedures: { 'user.address.getUserAddresses': { data: [] } }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('No addresses found')).toBeVisible()) - expect(screen.getByText('Add Address')).toBeVisible() - }) - - it('shows the error state and retries', async () => { - const api = setupApiMocks({ - procedures: { - 'user.address.getUserAddresses': () => { - throw new Error('down') - }, - }, - }) - renderWithProviders() - - await waitFor(() => - expect(screen.getByText(/Failed to load addresses/)).toBeVisible() - ) - const before = expectProcedureCalled(api.fetchMock, 'user.address.getUserAddresses').length - fireEvent.press(screen.getByText('Retry')) - - await waitFor(() => - expect( - expectProcedureCalled(api.fetchMock, 'user.address.getUserAddresses').length - ).toBeGreaterThan(before) - ) - }) - - it('marks an address as default via user.address.updateAddress', async () => { - const api = setupApiMocks({ - procedures: { - 'user.address.getUserAddresses': { data: [ADDRESS] }, - 'user.address.updateAddress': { success: true }, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Set Default')).toBeVisible()) - fireEvent.press(screen.getByText('Set Default')) - - await waitFor(() => - expectProcedureCalled(api.fetchMock, 'user.address.updateAddress') - ) - expect(lastProcedureInput(api.fetchMock, 'user.address.updateAddress')).toMatchObject({ - id: ADDRESS.id, - isDefault: true, - }) - }) - - it('deletes an address after confirming via user.address.deleteAddress', async () => { - const api = setupApiMocks({ - procedures: { - 'user.address.getUserAddresses': { data: [ADDRESS] }, - 'user.address.deleteAddress': { success: true }, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Delete')).toBeVisible()) - fireEvent.press(screen.getByText('Delete')) - pressAlertButton('Delete') - - await waitFor(() => - expectProcedureCalled(api.fetchMock, 'user.address.deleteAddress') - ) - expect(lastProcedureInput(api.fetchMock, 'user.address.deleteAddress')).toEqual({ - id: ADDRESS.id, - }) - // Let the onSuccess refetch settle; a pending batch would otherwise land in - // the next test's fetch mock and fail as an unmocked procedure. - await waitFor(() => - expect( - procedureCalls(api.fetchMock, 'user.address.getUserAddresses').length - ).toBeGreaterThan(1) - ) - }) -}) - -describe('Coupons screen', () => { - beforeEach(async () => { - await resetStorage() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - const couponsResponse = { - data: { - personal: [ - { - id: 1, - code: 'SAVE20', - discountType: 'percentage', - discountValue: 20, - description: '20% off', - usageCount: 0, - maxLimitForUser: 2, - isExpired: false, - isUsedUp: false, - }, - ], - general: [], - }, - } - - it('renders personal and general sections', async () => { - setupApiMocks({ procedures: { 'user.coupon.getMyCoupons': couponsResponse } }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Add a Coupon')).toBeVisible()) - await waitFor(() => expect(screen.getByText(/SAVE20/)).toBeVisible()) - expect(screen.getByText('Only for Me')).toBeVisible() - expect(screen.getByText('Apply to All')).toBeVisible() - expect(screen.getByText('No general coupons available')).toBeVisible() - }) - - it('redeems a code via user.coupon.redeemReservedCoupon', async () => { - const api = setupApiMocks({ - procedures: { - 'user.coupon.getMyCoupons': couponsResponse, - 'user.coupon.redeemReservedCoupon': { success: true }, - }, - }) - renderWithProviders() - await waitFor(() => expect(screen.getByText('Add a Coupon')).toBeVisible()) - - fireEvent.changeText(screen.getByPlaceholderText('Enter coupon code'), 'secret1') - fireEvent.press(screen.getByText('Add Coupon')) - - await waitFor(() => - expectProcedureCalled(api.fetchMock, 'user.coupon.redeemReservedCoupon') - ) - expect(lastProcedureInput(api.fetchMock, 'user.coupon.redeemReservedCoupon')).toEqual({ - secretCode: 'SECRET1', - }) - }) - - it('shows the empty sections when there are no coupons', async () => { - setupApiMocks({ - procedures: { 'user.coupon.getMyCoupons': { data: { personal: [], general: [] } } }, - }) - renderWithProviders() - - await waitFor(() => - expect(screen.getByText('No personal coupons available')).toBeVisible() - ) - expect(screen.getByText('No general coupons available')).toBeVisible() - }) -}) - -describe('Complaints screen', () => { - beforeEach(async () => { - await resetStorage() - }) - - it('renders complaints and support contacts', async () => { - setupApiMocks({ - procedures: { - 'user.complaint.getAll': { - complaints: [ - { - id: 5, - orderId: 'ORD-11', - complaintBody: 'Item was spoiled', - createdAt: '2026-09-20T10:00:00.000Z', - isResolved: false, - response: null, - }, - ], - }, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Complaint #5')).toBeVisible()) - expect(screen.getByText('Item was spoiled')).toBeVisible() - expect(screen.getByText('Pending')).toBeVisible() - expect(screen.getByText('Need Help?')).toBeVisible() - }) - - it('opens the dialer from Call Us', async () => { - const openURL = jest.spyOn(Linking, 'openURL').mockResolvedValue(true) - setupApiMocks({ procedures: { 'user.complaint.getAll': { complaints: [] } } }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Call Us')).toBeVisible()) - fireEvent.press(screen.getByText('Call Us')) - - expect(openURL).toHaveBeenCalledWith(expect.stringContaining('tel:')) - }) - - it('shows the empty state and Continue Shopping navigates home', async () => { - setupApiMocks({ procedures: { 'user.complaint.getAll': { complaints: [] } } }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('No Complaints')).toBeVisible()) - fireEvent.press(screen.getByText('Continue Shopping')) - - expect(routerMock.push).toHaveBeenCalledWith('/(drawer)/(tabs)/home') - }) - - it('shows the error state', async () => { - setupApiMocks({ - procedures: { - 'user.complaint.getAll': () => { - throw new Error('down') - }, - }, - }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Failed to load complaints')).toBeVisible()) - }) -}) - -describe('Edit profile screen', () => { - beforeEach(async () => { - resetAuthMock() - await resetStorage() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('renders the profile form and logs out', async () => { - setupApiMocks() - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Edit Profile')).toBeVisible()) - - fireEvent.press(screen.getByText('Logout')) - expect(authMock.logout).toHaveBeenCalled() - }) - - it('requires a mobile number before deleting the account', async () => { - const api = setupApiMocks({ procedures: { 'user.auth.deleteAccount': { success: true } } }) - renderWithProviders() - await waitFor(() => expect(screen.getByText('Delete Me and My Data')).toBeVisible()) - - fireEvent.press(screen.getByText('Delete Me and My Data')) - fireEvent.press(screen.getByText('Delete Forever')) - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith('Error', 'Please enter your mobile number') - ) - expect( - api.fetchMock.mock.calls.some(([u]) => String(u).includes('deleteAccount')) - ).toBe(false) - }) - - it('deletes the account via user.auth.deleteAccount', async () => { - const api = setupApiMocks({ procedures: { 'user.auth.deleteAccount': { success: true } } }) - renderWithProviders() - await waitFor(() => expect(screen.getByText('Delete Me and My Data')).toBeVisible()) - - fireEvent.press(screen.getByText('Delete Me and My Data')) - fireEvent.changeText(screen.getByPlaceholderText('Enter mobile number'), '9876543210') - fireEvent.press(screen.getByText('Delete Forever')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'user.auth.deleteAccount')) - expect(lastProcedureInput(api.fetchMock, 'user.auth.deleteAccount')).toEqual({ - mobile: '9876543210', - }) - }) -}) - -describe('Terms screen', () => { - it('renders the policy and goes back', async () => { - setupApiMocks() - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Terms & Conditions')).toBeVisible()) - expect(screen.getByText('FRESHYO – Legal Policies')).toBeVisible() - - fireEvent.press(screen.getByText('Terms & Conditions')) - // The back arrow has no testID; the header title is not the button, so just - // assert the screen rendered its content. - expect(screen.getByText('A. TERMS & CONDITIONS')).toBeVisible() - }) -}) diff --git a/apps/user-ui/tests/screens/me-hub.test.tsx b/apps/user-ui/tests/screens/me-hub.test.tsx deleted file mode 100644 index 0bfd408..0000000 --- a/apps/user-ui/tests/screens/me-hub.test.tsx +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Me hub (app/(drawer)/(tabs)/me/index.tsx): menu navigation + logout. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import Me from '@/app/(drawer)/(tabs)/me/index' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { authMock, resetAuthMock } from '../mocks/auth' -import { routerMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -describe('Me hub', () => { - beforeEach(async () => { - resetAuthMock() - await resetStorage() - }) - - it('renders the account sections and menu entries', async () => { - setupApiMocks() - renderWithProviders() - - await waitFor(() => expect(screen.getByText('My Account')).toBeVisible()) - expect(screen.getByText('My Orders')).toBeVisible() - expect(screen.getByText('Addresses')).toBeVisible() - expect(screen.getByText('Help & Complaints')).toBeVisible() - expect(screen.getByText('Terms & Conditions')).toBeVisible() - }) - - it('navigates to the orders screen', async () => { - setupApiMocks() - renderWithProviders() - await waitFor(() => expect(screen.getByText('My Orders')).toBeVisible()) - - fireEvent.press(screen.getByText('My Orders')) - expect(routerMock.push).toHaveBeenCalledWith('/(drawer)/(tabs)/me/my-orders') - }) - - it('navigates to addresses', async () => { - setupApiMocks() - renderWithProviders() - await waitFor(() => expect(screen.getByText('Addresses')).toBeVisible()) - - fireEvent.press(screen.getByText('Addresses')) - expect(routerMock.push).toHaveBeenCalledWith('/(drawer)/(tabs)/me/addresses') - }) - - it('logs out from the footer button', async () => { - setupApiMocks() - renderWithProviders() - await waitFor(() => - expect(screen.getByText('Log Out from Freshyo')).toBeVisible() - ) - - fireEvent.press(screen.getByText('Log Out from Freshyo')) - expect(authMock.logout).toHaveBeenCalled() - }) -}) diff --git a/apps/user-ui/tests/screens/me-orders.test.tsx b/apps/user-ui/tests/screens/me-orders.test.tsx deleted file mode 100644 index 49b1ea8..0000000 --- a/apps/user-ui/tests/screens/me-orders.test.tsx +++ /dev/null @@ -1,100 +0,0 @@ -/** - * My orders (app/(drawer)/(tabs)/me/my-orders/index.tsx). - * Asserts user.order.getOrders, the loading/error/empty states and row navigation. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import MyOrders from '@/app/(drawer)/(tabs)/me/my-orders/index' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { expectProcedureCalled } from '../mocks/procedures' -import { routerMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const ORDER = { - id: 11, - orderId: 'ORD-11', - orderDate: '2026-09-20T10:00:00.000Z', - orderStatus: 'confirmed', - deliveryStatus: 'pending', - deliveryDate: '2026-09-26T10:00:00.000Z', - cancelReason: null, - totalAmount: 500, - deliveryCharge: 15, - userNotes: null, - isFlashDelivery: false, - createdAt: '2026-09-20T10:00:00.000Z', - items: [ - { productName: 'Chicken Breast 500 g', quantity: 1, unitNotation: '500g', price: 215, discountedPrice: 215, amount: 215, image: null }, - ], -} - -const ordersResponse = (orders: unknown[]) => ({ - data: orders, - pagination: { page: 1, pageSize: 10, totalCount: orders.length, totalPages: 1 }, -}) - -describe('My orders', () => { - beforeEach(async () => { - await resetStorage() - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('renders the fetched orders', async () => { - const api = setupApiMocks({ - procedures: { 'user.order.getOrders': ordersResponse([ORDER]) }, - }) - renderWithProviders(, { centralStores: false }) - - await waitFor(() => expect(screen.getByText('#ORD-11')).toBeVisible()) - expect(screen.getByText('Chicken Breast 500 g')).toBeVisible() - expect(expectProcedureCalled(api.fetchMock, 'user.order.getOrders')).toBeTruthy() - }) - - it('navigates to the order detail when a row is pressed', async () => { - setupApiMocks({ procedures: { 'user.order.getOrders': ordersResponse([ORDER]) } }) - renderWithProviders(, { centralStores: false }) - - await waitFor(() => expect(screen.getByText('#ORD-11')).toBeVisible()) - fireEvent.press(screen.getByText('#ORD-11')) - - expect(routerMock.push).toHaveBeenCalledWith('/(drawer)/(tabs)/me/my-orders/11') - }) - - it('shows the empty state and Start Shopping navigates home', async () => { - setupApiMocks({ procedures: { 'user.order.getOrders': ordersResponse([]) } }) - renderWithProviders(, { centralStores: false }) - - await waitFor(() => expect(screen.getByText('No orders yet')).toBeVisible()) - fireEvent.press(screen.getByText('Start Shopping')) - - expect(routerMock.push).toHaveBeenCalledWith('/(drawer)/(tabs)/home') - }) - - it('shows the error state and retries', async () => { - const api = setupApiMocks({ - procedures: { - 'user.order.getOrders': () => { - throw new Error('orders down') - }, - }, - }) - renderWithProviders(, { centralStores: false }) - - await waitFor(() => expect(screen.getByText('Unable to load orders')).toBeVisible()) - - const before = expectProcedureCalled(api.fetchMock, 'user.order.getOrders').length - fireEvent.press(screen.getByText('Retry')) - - await waitFor(() => - expect( - api.fetchMock.mock.calls.filter(([u]) => String(u).includes('getOrders')).length - ).toBeGreaterThan(before) - ) - }) - -}) diff --git a/apps/user-ui/tests/screens/mutation-invalidation.test.tsx b/apps/user-ui/tests/screens/mutation-invalidation.test.tsx deleted file mode 100644 index 126c39a..0000000 --- a/apps/user-ui/tests/screens/mutation-invalidation.test.tsx +++ /dev/null @@ -1,279 +0,0 @@ -/** - * Mutation → refetch wiring. - * - * Each test mounts a real observer of the query the mutation is supposed to - * refresh, fires the mutation through the UI/hook, and asserts the query is - * fetched again. This deliberately checks that the invalidation key actually - * matches an observer — a spy on `invalidateQueries` would still pass for a - * no-op key like the string `['user.address.getUserAddresses']` (tRPC v11 keys - * are `[['user','address','getUserAddresses'], {...}]`). - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import { act, fireEvent, renderHook, screen, waitFor } from '@testing-library/react-native' - -import PaymentAndOrderComponent from '@/components/PaymentAndOrderComponent' -import OrderDetails from '@/app/(drawer)/(tabs)/me/my-orders/[id]' -import Addresses from '@/app/(drawer)/(tabs)/me/addresses/index' -import Coupons from '@/app/(drawer)/(tabs)/me/coupons/index' -import { useUpdateProfile } from '@/src/api-hooks/auth.api' -import { trpc } from '@/src/trpc-client' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { authMock, resetAuthMock } from '../mocks/auth' -import { procedureCalls } from '../mocks/procedures' -import { searchParamsMock } from '../mocks/router' -import { createQueryClient, Providers, renderWithProviders } from '../helpers/render' - -const USER = { - id: 5, - name: 'Test User', - email: 'test@example.com', - mobile: '9876543210', - profileImage: '', - createdAt: '', -} - -const ADDRESS = { - id: 1, - name: 'Home', - phone: '9876543210', - addressLine1: '12 Main Road', - addressLine2: 'Apt 4', - city: 'Hyderabad', - state: 'Telangana', - isDefault: false, -} - -const ORDER = { - id: 42, - orderId: 'ORD-42', - orderDate: '2026-09-20T10:00:00.000Z', - createdAt: '2026-09-20T10:00:00.000Z', - orderStatus: 'confirmed', - deliveryStatus: 'pending', - deliveryDate: '2026-09-26T10:00:00.000Z', - cancelReason: null, - orderAmount: 500, - discountAmount: 0, - deliveryCharge: 15, - couponCode: null, - isFlashDelivery: false, - userNotes: null, - items: [ - { - productName: 'Chicken Breast 500 g', - quantity: 1, - unitNotation: '500g', - price: 215, - amount: 215, - image: null, - }, - ], -} - -const baseProps = { - selectedAddress: 1, - selectedSlots: { 1: 1849 }, - selectedCouponIds: [], - cartItems: [{ id: 1, skuId: 2, quantity: 1, slotId: 1849 }], - totalPrice: 215, - totalSavings: 0, - discountAmount: 0, - finalTotal: 215, - finalTotalWithDelivery: 230, - deliveryCharge: 15, - constsData: { freeDeliveryThreshold: 249, deliveryCharge: 15 }, - selectedCoupons: [], -} - -/** Mounted observers so an invalidation has something to refetch. */ -const OrdersProbe = () => { - trpc.user.order.getOrders.useQuery({ page: 1, pageSize: 50 }) - return null -} -const EligibleProbe = () => { - trpc.user.coupon.getEligible.useQuery(undefined, { enabled: true }) - return null -} -const DefaultAddressProbe = () => { - trpc.user.address.getDefaultAddress.useQuery() - return null -} - -const count = (api: ReturnType, name: string) => - procedureCalls(api.fetchMock, name).length - -describe('mutation invalidation', () => { - beforeEach(async () => { - // Flush a batched tRPC request left over from the previous test. - await act(async () => { - jest.advanceTimersByTime(1) - }) - resetAuthMock() - await resetStorage() - searchParamsMock.current = {} - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('refetches getOrders after placeOrder, so NextOrderGlimpse updates', async () => { - const queryClient = createQueryClient() - const api = setupApiMocks({ - orders: [], - procedures: { 'user.order.placeOrder': { data: [{ id: 99 }] } }, - }) - - renderWithProviders( - <> - - - , - { centralStores: false, queryClient } - ) - - await waitFor(() => expect(count(api, 'user.order.getOrders')).toBeGreaterThan(0)) - const before = count(api, 'user.order.getOrders') - - fireEvent.press(screen.getByTestId('place-order-button')) - - await waitFor(() => expect(count(api, 'user.order.getOrders')).toBeGreaterThan(before)) - }) - - it('refetches getOrders after cancelling from the order detail screen', async () => { - const queryClient = createQueryClient() - const api = setupApiMocks({ - orders: [], - procedures: { - 'user.order.getOrderById': ORDER, - 'user.order.cancelOrder': { success: true }, - }, - }) - searchParamsMock.current = { id: String(ORDER.id) } - - renderWithProviders( - <> - - - , - { centralStores: false, queryClient } - ) - - await waitFor(() => expect(screen.getByText('Cancel Order')).toBeVisible()) - await waitFor(() => expect(count(api, 'user.order.getOrders')).toBeGreaterThan(0)) - const before = count(api, 'user.order.getOrders') - - fireEvent.press(screen.getByText('Cancel Order')) - await waitFor(() => expect(screen.getByTestId('cancel-reason')).toBeVisible()) - fireEvent.changeText(screen.getByTestId('cancel-reason'), 'Changed my mind') - fireEvent.press(screen.getByText('Confirm Cancellation')) - - await waitFor(() => expect(count(api, 'user.order.cancelOrder')).toBeGreaterThan(0)) - await waitFor(() => expect(count(api, 'user.order.getOrders')).toBeGreaterThan(before)) - }) - - it('refetches eligible coupons after redeeming a reserved coupon', async () => { - const queryClient = createQueryClient() - const api = setupApiMocks({ - procedures: { - 'user.coupon.getMyCoupons': { data: { personal: [], general: [] } }, - 'user.coupon.redeemReservedCoupon': { success: true }, - 'user.coupon.getEligible': { data: [] }, - }, - }) - - renderWithProviders( - <> - - - , - { queryClient } - ) - - await waitFor(() => expect(screen.getByText('Add a Coupon')).toBeVisible()) - await waitFor(() => expect(count(api, 'user.coupon.getEligible')).toBeGreaterThan(0)) - const before = count(api, 'user.coupon.getEligible') - - fireEvent.changeText(screen.getByPlaceholderText('Enter coupon code'), 'secret1') - fireEvent.press(screen.getByText('Add Coupon')) - - await waitFor(() => - expect(count(api, 'user.coupon.redeemReservedCoupon')).toBeGreaterThan(0) - ) - await waitFor(() => expect(count(api, 'user.coupon.getEligible')).toBeGreaterThan(before)) - }) - - it('refetches the default address after setting a new default', async () => { - const queryClient = createQueryClient() - const api = setupApiMocks({ - procedures: { - 'user.address.getUserAddresses': { data: [ADDRESS] }, - 'user.address.updateAddress': { success: true }, - 'user.address.getDefaultAddress': { success: true, data: ADDRESS }, - }, - }) - - renderWithProviders( - <> - - - , - { queryClient } - ) - - await waitFor(() => expect(screen.getByText('Set Default')).toBeVisible()) - await waitFor(() => - expect(count(api, 'user.address.getDefaultAddress')).toBeGreaterThan(0) - ) - const before = count(api, 'user.address.getDefaultAddress') - - fireEvent.press(screen.getByText('Set Default')) - - await waitFor(() => - expect(count(api, 'user.address.updateAddress')).toBeGreaterThan(0) - ) - await waitFor(() => - expect(count(api, 'user.address.getDefaultAddress')).toBeGreaterThan(before) - ) - }) - - it('refetches getSelfData after updateProfile', async () => { - const queryClient = createQueryClient() - const api = setupApiMocks({ - procedures: { - 'user.user.getSelfData': { data: { user: USER } }, - 'user.auth.updateProfile': { data: { token: 't', user: USER } }, - }, - }) - authMock.user = { id: USER.id } - - const { result } = renderHook( - () => { - const mutation = useUpdateProfile() - const query = trpc.user.user.getSelfData.useQuery() - return { mutation, query } - }, - { - wrapper: ({ children }: { children?: React.ReactNode }) => ( - - {children} - - ), - } - ) - - await waitFor(() => expect(count(api, 'user.user.getSelfData')).toBeGreaterThan(0)) - const before = count(api, 'user.user.getSelfData') - - // Fire-and-forget: awaiting mutateAsync would deadlock under fake timers, - // because httpBatchLink flushes on a timer that only `waitFor` advances. - act(() => { - result.current.mutation.mutate({ name: 'New Name' }) - }) - - await waitFor(() => - expect(count(api, 'user.user.getSelfData')).toBeGreaterThan(before) - ) - }) -}) diff --git a/apps/user-ui/tests/screens/navigation-shell.test.tsx b/apps/user-ui/tests/screens/navigation-shell.test.tsx deleted file mode 100644 index d663b00..0000000 --- a/apps/user-ui/tests/screens/navigation-shell.test.tsx +++ /dev/null @@ -1,55 +0,0 @@ -/** - * App entry redirect (app/index.tsx) — real router. - * - * This file must NOT mock expo-router (the real router is the point). - */ - -import React from 'react' -import { ActivityIndicator, Text } from 'react-native' -import { screen, waitFor } from '@testing-library/react-native' - -import Index from '@/app/index' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { authMock, resetAuthMock } from '../mocks/auth' -import { Providers } from '../helpers/render' -import { renderRoute } from '../helpers/real-router' - -const HomeStub = () => home - -/** Index renders AppContainer, which needs the refresh context. */ -const IndexRoute = () => ( - - - -) - -const ROUTES = { - index: IndexRoute, - '(drawer)/(tabs)/home/index': HomeStub, -} - -describe('App entry', () => { - beforeEach(async () => { - resetAuthMock() - setupApiMocks() - await resetStorage() - }) - - it('redirects to the home route once auth has settled', async () => { - const nav = renderRoute(ROUTES, '/') - - await screen.findByTestId('home-screen') - expect(nav.getPathname()).toBe('/home') - }) - - it('stays on the entry route and shows a spinner while auth loads', async () => { - authMock.isLoading = true - const nav = renderRoute(ROUTES, '/') - - await waitFor(() => - expect(screen.UNSAFE_queryByType(ActivityIndicator)).not.toBeNull() - ) - expect(screen.queryByTestId('home-screen')).toBeNull() - expect(nav.getPathname()).toBe('/') - }) -}) diff --git a/apps/user-ui/tests/screens/order-again.test.tsx b/apps/user-ui/tests/screens/order-again.test.tsx deleted file mode 100644 index c740899..0000000 --- a/apps/user-ui/tests/screens/order-again.test.tsx +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Offers / order-again (app/(drawer)/(tabs)/order-again/index.tsx). - * - * Two sections over the products cache: Offers (isOffer) and Combos - * (productType === 'combo'). The fixture has no offers and six combos. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import Offers from '@/app/(drawer)/(tabs)/order-again/index' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { routerMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const CARD = 'product-card' - -describe('Offers (order-again) screen', () => { - beforeEach(async () => { - await resetStorage() - }) - - it('renders both section headers', async () => { - setupApiMocks() - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Offers')).toBeVisible()) - expect(screen.getByText('Combos')).toBeVisible() - }) - - it('shows the empty message for a section with no products', async () => { - setupApiMocks() - renderWithProviders() - - await waitFor(() => - expect(screen.getByText('No offers available right now')).toBeVisible() - ) - }) - - it('renders a card for every combo', async () => { - setupApiMocks() - renderWithProviders() - - await waitFor(() => - expect(screen.getAllByTestId(CARD).length).toBeGreaterThan(0) - ) - }) - - it('opens the product detail page when a card is pressed', async () => { - setupApiMocks() - renderWithProviders() - - await waitFor(() => - expect(screen.getAllByTestId(CARD).length).toBeGreaterThan(0) - ) - fireEvent.press(screen.getAllByTestId(CARD)[0]) - - expect(routerMock.push).toHaveBeenCalledWith( - expect.stringContaining('/order-again/product-detail/') - ) - }) - - it('shows the loading state while products are pending', async () => { - setupApiMocks({ pendingProducts: true }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Loading offers...')).toBeVisible()) - }) - - it('shows the error state when products fail to load', async () => { - setupApiMocks({ failProducts: true }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Failed to load offers')).toBeVisible()) - expect(screen.getByText('Oops!')).toBeVisible() - }) -}) diff --git a/apps/user-ui/tests/screens/order-amounts.test.tsx b/apps/user-ui/tests/screens/order-amounts.test.tsx deleted file mode 100644 index 40386d2..0000000 --- a/apps/user-ui/tests/screens/order-amounts.test.tsx +++ /dev/null @@ -1,156 +0,0 @@ -/** - * Order amount display — order-success and order-detail. - * - * Both screens show money the app derived rather than money the backend - * charged. The known display bugs are pinned and listed in tests/KNOWN-GAPS.md. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { screen, waitFor } from '@testing-library/react-native' - -import OrderSuccess from '@/app/(drawer)/(tabs)/home/order-success' -import OrderDetails from '@/app/(drawer)/(tabs)/me/my-orders/[id]' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { resetAuthMock } from '../mocks/auth' -import { searchParamsMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const order = (over: Record = {}) => ({ - id: 42, - orderId: 'ORD-42', - orderDate: '2026-09-20T10:00:00.000Z', - createdAt: '2026-09-20T10:00:00.000Z', - orderStatus: 'confirmed', - deliveryStatus: 'pending', - deliveryDate: '2026-09-26T10:00:00.000Z', - cancelReason: null, - orderAmount: 500, - discountAmount: 0, - deliveryCharge: 15, - couponCode: null, - isFlashDelivery: false, - userNotes: null, - items: [ - { - productName: 'Chicken Breast 500 g', - quantity: 1, - unitNotation: '500g', - price: 215, - amount: 215, - image: null, - }, - ], - ...over, -}) - -describe('Order success amounts', () => { - beforeEach(async () => { - resetAuthMock() - await resetStorage() - searchParamsMock.current = {} - setupApiMocks() - }) - - it('shows the order id and the amount from the route params', async () => { - searchParamsMock.current = { orderId: '99', totalAmount: '230' } - - renderWithProviders(, { centralStores: false }) - - await waitFor(() => expect(screen.getByText('Order Placed Successfully!')).toBeVisible()) - expect(screen.getByText('Order #99')).toBeVisible() - expect(screen.getByText('Total: ₹230')).toBeVisible() - }) - - /** - * The success screen renders whatever `totalAmount` sits in the route params. - * Since 2026-10-11 `PaymentAndOrderComponent` writes the server-stored order - * total there (see payment-and-order-money.test.tsx "uses the server-stored - * order amount…"), but this screen itself still just prints the param. - */ - it('renders whatever amount the caller put in the query string', async () => { - searchParamsMock.current = { orderId: '99', totalAmount: '1234.56' } - - renderWithProviders(, { centralStores: false }) - - await waitFor(() => expect(screen.getByText('Total: ₹1234.56')).toBeVisible()) - }) - - it('omits the amount block when the param is missing', async () => { - searchParamsMock.current = { orderId: '99' } - - renderWithProviders(, { centralStores: false }) - - await waitFor(() => expect(screen.getByText('Order #99')).toBeVisible()) - expect(screen.queryByText(/Total: ₹/)).toBeNull() - }) -}) - -describe('Order detail amounts', () => { - beforeEach(async () => { - resetAuthMock() - await resetStorage() - searchParamsMock.current = { id: '42' } - setupApiMocks({ - procedures: { - 'user.order.getOrderById': order(), - 'user.order.updateUserNotes': { success: true }, - 'user.order.cancelOrder': { success: true }, - }, - }) - }) - - it('hides the coupon block when nothing was discounted', async () => { - renderWithProviders(, { centralStores: false }) - - await waitFor(() => expect(screen.getByText('Order #ORD-42')).toBeVisible()) - expect(screen.queryByText('Coupon Applied')).toBeNull() - expect(screen.queryByText(/^Coupon/)).toBeNull() - // The summary shows a Discount row only above zero. - expect(screen.queryByText('Discount')).toBeNull() - expect(screen.getByText('₹500')).toBeVisible() - }) - - it('shows the coupon badge and the discount rows for a discounted order', async () => { - setupApiMocks({ - procedures: { - 'user.order.getOrderById': order({ - couponCode: 'SAVE20', - discountAmount: 20, - orderAmount: 480, - }), - 'user.order.updateUserNotes': { success: true }, - 'user.order.cancelOrder': { success: true }, - }, - }) - - renderWithProviders(, { centralStores: false }) - - await waitFor(() => expect(screen.getByText('SAVE20')).toBeVisible()) - expect(screen.getByText('Coupon Applied')).toBeVisible() - // Badge row and summary row both show the discount. - expect(screen.getAllByText('-₹20').length).toBeGreaterThanOrEqual(1) - expect(screen.getByText('Discount')).toBeVisible() - expect(screen.getByText('₹480')).toBeVisible() - }) - - it('renders a fractional discount verbatim in both the badge and the summary', async () => { - setupApiMocks({ - procedures: { - 'user.order.getOrderById': order({ - couponCode: 'SAVE20', - discountAmount: 20.5, - }), - 'user.order.updateUserNotes': { success: true }, - 'user.order.cancelOrder': { success: true }, - }, - }) - - renderWithProviders(, { centralStores: false }) - - await waitFor(() => expect(screen.getByText('SAVE20')).toBeVisible()) - // The coupon badge and the summary row both print the stored amount as-is. - expect(screen.getAllByText('-₹20.5')).toHaveLength(2) - }) -}) diff --git a/apps/user-ui/tests/screens/order-detail.test.tsx b/apps/user-ui/tests/screens/order-detail.test.tsx deleted file mode 100644 index a9e534e..0000000 --- a/apps/user-ui/tests/screens/order-detail.test.tsx +++ /dev/null @@ -1,159 +0,0 @@ -/** - * Order detail (me/my-orders/[id].tsx) — order.getOrderById, notes edit, - * cancel and the complaint action. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { Alert } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import OrderDetails from '@/app/(drawer)/(tabs)/me/my-orders/[id]' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { expectProcedureCalled, lastProcedureInput } from '../mocks/procedures' -import { routerMock, searchParamsMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const ORDER = { - id: 42, - orderId: 'ORD-42', - orderDate: '2026-09-20T10:00:00.000Z', - createdAt: '2026-09-20T10:00:00.000Z', - orderStatus: 'confirmed', - deliveryStatus: 'pending', - deliveryDate: '2026-09-26T10:00:00.000Z', - cancelReason: null, - orderAmount: 500, - discountAmount: 0, - deliveryCharge: 15, - couponCode: null, - isFlashDelivery: false, - userNotes: null, - items: [ - { - productName: 'Chicken Breast 500 g', - quantity: 1, - unitNotation: '500g', - price: 215, - amount: 215, - image: null, - }, - ], -} - -const setup = (order: Record = ORDER) => - setupApiMocks({ - procedures: { - 'user.order.getOrderById': order, - 'user.order.updateUserNotes': { success: true }, - 'user.order.cancelOrder': { success: true }, - }, - }) - -describe('Order detail', () => { - beforeEach(async () => { - await resetStorage() - searchParamsMock.current = { id: '42' } - jest.spyOn(Alert, 'alert').mockImplementation(() => {}) - }) - - it('renders the order, its items and the total', async () => { - setup() - renderWithProviders(, { centralStores: false }) - - await waitFor(() => expect(screen.getByText('Order #ORD-42')).toBeVisible()) - expect(screen.getByText('Chicken Breast 500 g')).toBeVisible() - expect(screen.getByText('Total Amount')).toBeVisible() - expect(screen.getByText('₹500')).toBeVisible() - }) - - it('shows the error state and goes back', async () => { - setupApiMocks({ - procedures: { - 'user.order.getOrderById': () => { - throw new Error('down') - }, - }, - }) - renderWithProviders(, { centralStores: false }) - - await waitFor(() => expect(screen.getByText('Failed to load')).toBeVisible()) - - fireEvent.press(screen.getByText('Go Back')) - expect(routerMock.back).toHaveBeenCalled() - }) - - it('saves special instructions via user.order.updateUserNotes', async () => { - const api = setup() - renderWithProviders(, { centralStores: false }) - - await waitFor(() => expect(screen.getByText('Order #ORD-42')).toBeVisible()) - - fireEvent.press(screen.getByText('Add')) - fireEvent.changeText( - screen.getByPlaceholderText('Add special delivery instructions...'), - 'Ring the bell' - ) - fireEvent.press(screen.getByText('Save')) - - await waitFor(() => - expectProcedureCalled(api.fetchMock, 'user.order.updateUserNotes') - ) - expect(lastProcedureInput(api.fetchMock, 'user.order.updateUserNotes')).toEqual({ - id: ORDER.id, - userNotes: 'Ring the bell', - }) - }) - - it('requires a reason before cancelling', async () => { - const api = setup() - renderWithProviders(, { centralStores: false }) - - await waitFor(() => expect(screen.getByText('Cancel Order')).toBeVisible()) - fireEvent.press(screen.getByText('Cancel Order')) - - await waitFor(() => expect(screen.getByTestId('cancel-reason')).toBeVisible()) - fireEvent.press(screen.getByText('Confirm Cancellation')) - - await waitFor(() => - expect(Alert.alert).toHaveBeenCalledWith( - 'Error', - 'Please enter a reason for cancellation' - ) - ) - expect( - api.fetchMock.mock.calls.some(([u]) => String(u).includes('cancelOrder')) - ).toBe(false) - }) - - it('cancels the order with a reason via user.order.cancelOrder', async () => { - const api = setup() - renderWithProviders(, { centralStores: false }) - - await waitFor(() => expect(screen.getByText('Cancel Order')).toBeVisible()) - fireEvent.press(screen.getByText('Cancel Order')) - - await waitFor(() => expect(screen.getByTestId('cancel-reason')).toBeVisible()) - fireEvent.changeText(screen.getByTestId('cancel-reason'), 'Changed my mind') - fireEvent.press(screen.getByText('Confirm Cancellation')) - - await waitFor(() => expectProcedureCalled(api.fetchMock, 'user.order.cancelOrder')) - expect(lastProcedureInput(api.fetchMock, 'user.order.cancelOrder')).toEqual({ - id: ORDER.id, - reason: 'Changed my mind', - }) - }) - - it('opens the complaint form', async () => { - setup() - renderWithProviders(, { centralStores: false }) - - await waitFor(() => expect(screen.getByText('Raise Complaint')).toBeVisible()) - fireEvent.press(screen.getByText('Raise Complaint')) - - await waitFor(() => - expect(screen.getByPlaceholderText('Tell us what went wrong...')).toBeVisible() - ) - }) -}) diff --git a/apps/user-ui/tests/screens/order-success.test.tsx b/apps/user-ui/tests/screens/order-success.test.tsx deleted file mode 100644 index 49433c4..0000000 --- a/apps/user-ui/tests/screens/order-success.test.tsx +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Order success screens (scheduled + flash) — route params and the two actions. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { fireEvent, screen } from '@testing-library/react-native' - -import OrderSuccess from '@/app/(drawer)/(tabs)/home/order-success' -import FlashOrderSuccess from '@/app/(drawer)/(tabs)/flash-delivery/order-success' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { routerMock, searchParamsMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -describe('Order success (scheduled)', () => { - beforeEach(async () => { - await resetStorage() - searchParamsMock.current = {} - }) - - it('renders the confirmation and performs both actions', () => { - setupApiMocks() - renderWithProviders(, { centralStores: false }) - - expect(screen.getByText('Order Placed Successfully!')).toBeVisible() - - fireEvent.press(screen.getByText('Continue Shopping')) - expect(routerMock.dismissTo).toHaveBeenCalledWith('/(drawer)/(tabs)/home') - - fireEvent.press(screen.getByText('View My Orders')) - expect(routerMock.dismissAll).toHaveBeenCalled() - expect(routerMock.push).toHaveBeenCalledWith('/(drawer)/(tabs)/me/my-orders') - }) - - it('shows the order id and total when params are present', () => { - searchParamsMock.current = { orderId: 'ORD-9', totalAmount: '500' } - setupApiMocks() - renderWithProviders(, { centralStores: false }) - - expect(screen.getByText('Order #ORD-9')).toBeVisible() - expect(screen.getByText('Total: ₹500')).toBeVisible() - }) -}) - -describe('Order success (flash)', () => { - it('renders the confirmation actions', () => { - searchParamsMock.current = {} - setupApiMocks() - renderWithProviders(, { centralStores: false }) - - expect(screen.getByText('Continue Shopping')).toBeVisible() - expect(screen.getByText('View My Orders')).toBeVisible() - }) -}) diff --git a/apps/user-ui/tests/screens/product-detail-flash-flag.test.tsx b/apps/user-ui/tests/screens/product-detail-flash-flag.test.tsx deleted file mode 100644 index ac7cc6b..0000000 --- a/apps/user-ui/tests/screens/product-detail-flash-flag.test.tsx +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Product-detail route wrappers — the `isFlashDelivery` flag wiring. - * - * tests/screens/product-detail-routes.test.tsx checks the id param but only - * matches `/^7:/` for three of the four routes, so a broken flash flag would - * pass there. This file asserts the flag itself on every wrapper. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -jest.mock('@/components/ProductDetail', () => { - const React = require('react') - const { Text } = require('react-native') - return { - __esModule: true, - default: ({ productId, isFlashDelivery }: { productId: string; isFlashDelivery?: boolean }) => - React.createElement( - Text, - { testID: 'product-detail-mock' }, - `${productId}:${isFlashDelivery ? 'flash' : 'regular'}` - ), - } -}) - -import React from 'react' -import { screen, waitFor } from '@testing-library/react-native' - -import HomeProductDetail from '@/app/(drawer)/(tabs)/home/product-detail/[id]' -import StoreProductDetail from '@/app/(drawer)/(tabs)/stores/store-detail/product-detail/[id]' -import OffersProductDetail from '@/app/(drawer)/(tabs)/order-again/product-detail/[id]/index' -import FlashProductDetail from '@/app/(drawer)/(tabs)/flash-delivery/product-detail/[id]' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { searchParamsMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const DETAIL = 'product-detail-mock' - -describe('Product detail flash flag', () => { - beforeEach(async () => { - await resetStorage() - setupApiMocks() - searchParamsMock.current = { id: '7' } - }) - - const expectFlag = async (ui: React.ReactElement, expected: string) => { - renderWithProviders(ui, { centralStores: false }) - await waitFor(() => expect(screen.getByTestId(DETAIL)).toHaveTextContent(expected)) - } - - it('home route renders a regular product', () => - expectFlag(, '7:regular')) - - it('stores route renders a regular product', () => - expectFlag(, '7:regular')) - - it('order-again route renders a regular product', () => - expectFlag(, '7:regular')) - - it('flash route renders a flash product', () => - expectFlag(, '7:flash')) -}) diff --git a/apps/user-ui/tests/screens/product-detail-routes.test.tsx b/apps/user-ui/tests/screens/product-detail-routes.test.tsx deleted file mode 100644 index db799e3..0000000 --- a/apps/user-ui/tests/screens/product-detail-routes.test.tsx +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Product-detail route wrappers (home / stores / order-again / flash). - * - * The heavy ProductDetail component is mocked here so this file isolates the - * wrappers: they must read the `id` param and render ProductDetail with it. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -jest.mock('@/components/ProductDetail', () => { - const React = require('react') - const { Text } = require('react-native') - return { - __esModule: true, - default: ({ productId, isFlashDelivery }: { productId: string; isFlashDelivery?: boolean }) => - React.createElement( - Text, - { testID: 'product-detail-mock' }, - `${productId}:${isFlashDelivery ? 'flash' : 'regular'}` - ), - } -}) - -import React from 'react' -import { screen, waitFor } from '@testing-library/react-native' - -import HomeProductDetail from '@/app/(drawer)/(tabs)/home/product-detail/[id]' -import StoreProductDetail from '@/app/(drawer)/(tabs)/stores/store-detail/product-detail/[id]' -import OffersProductDetail from '@/app/(drawer)/(tabs)/order-again/product-detail/[id]/index' -import FlashProductDetail from '@/app/(drawer)/(tabs)/flash-delivery/product-detail/[id]' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { searchParamsMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const DETAIL = 'product-detail-mock' - -describe('Product detail routes', () => { - beforeEach(async () => { - await resetStorage() - setupApiMocks() - searchParamsMock.current = { id: '7' } - }) - - it('home route renders ProductDetail with the id', async () => { - renderWithProviders(, { centralStores: false }) - - await waitFor(() => expect(screen.getByTestId(DETAIL)).toHaveTextContent('7:regular')) - }) - - it('stores route renders ProductDetail', async () => { - renderWithProviders(, { centralStores: false }) - - await waitFor(() => expect(screen.getByTestId(DETAIL)).toHaveTextContent(/^7:/)) - }) - - it('order-again route renders ProductDetail', async () => { - renderWithProviders(, { centralStores: false }) - - await waitFor(() => expect(screen.getByTestId(DETAIL)).toHaveTextContent(/^7:/)) - }) - - it('flash route renders ProductDetail', async () => { - renderWithProviders(, { centralStores: false }) - - await waitFor(() => expect(screen.getByTestId(DETAIL)).toHaveTextContent(/^7:/)) - }) -}) diff --git a/apps/user-ui/tests/screens/search.test.tsx b/apps/user-ui/tests/screens/search.test.tsx deleted file mode 100644 index afad857..0000000 --- a/apps/user-ui/tests/screens/search.test.tsx +++ /dev/null @@ -1,101 +0,0 @@ -/** - * Search results (app/(drawer)/(tabs)/home/search-results/index.tsx). - * - * Client-side Fuse.js search over the products cache, debounced by 300ms. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { act, fireEvent, screen, waitFor } from '@testing-library/react-native' - -import SearchResults from '@/app/(drawer)/(tabs)/home/search-results/index' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { routerMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const CARD = 'product-card' -const INPUT = 'search-input-input' - -/** Render and wait until the product grid is populated. */ -async function renderLoaded() { - const api = setupApiMocks() - renderWithProviders() - await waitFor(() => expect(screen.getAllByTestId(CARD).length).toBeGreaterThan(0)) - return api -} - -/** Type into the search bar and let the 300ms debounce fire. */ -async function typeQuery(text: string) { - fireEvent.changeText(screen.getByTestId(INPUT), text) - await act(async () => { - jest.advanceTimersByTime(300) - }) -} - -describe('Search results', () => { - beforeEach(async () => { - await resetStorage() - }) - - it('lists all products when the query is empty', async () => { - await renderLoaded() - - expect(screen.getByText('All Products')).toBeVisible() - expect(screen.getAllByTestId(CARD).length).toBeGreaterThan(0) - }) - - it('filters products by the debounced query', async () => { - await renderLoaded() - const before = screen.getAllByTestId(CARD).length - - await typeQuery('chicken liver') - - await waitFor(() => - expect(screen.getByText(/Search Results for "chicken liver"/)).toBeVisible() - ) - - const after = screen.getAllByTestId(CARD).length - expect(after).toBeGreaterThan(0) - expect(after).toBeLessThanOrEqual(before) - }) - - it('shows the no-results state for an unmatched query', async () => { - await renderLoaded() - - await typeQuery('zzzzzzzz') - - await waitFor(() => expect(screen.getByText('No products found')).toBeVisible()) - expect(screen.getByText(/Try adjusting your search/)).toBeVisible() - }) - - it('restores all products when the query is cleared', async () => { - await renderLoaded() - - await typeQuery('chicken liver') - await waitFor(() => - expect(screen.getByText(/Search Results for "chicken liver"/)).toBeVisible() - ) - - await typeQuery('') - await waitFor(() => expect(screen.getByText('All Products')).toBeVisible()) - expect(screen.getAllByTestId(CARD).length).toBeGreaterThan(0) - }) - - it('shows the loading state while products are pending', async () => { - setupApiMocks({ pendingProducts: true }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Loading products...')).toBeVisible()) - }) - - it('opens the product detail page when a card is pressed', async () => { - await renderLoaded() - - fireEvent.press(screen.getAllByTestId(CARD)[0]) - - expect(routerMock.push).toHaveBeenCalledWith( - expect.stringContaining('/home/product-detail/') - ) - }) -}) diff --git a/apps/user-ui/tests/screens/slot-view.test.tsx b/apps/user-ui/tests/screens/slot-view.test.tsx deleted file mode 100644 index 97fb774..0000000 --- a/apps/user-ui/tests/screens/slot-view.test.tsx +++ /dev/null @@ -1,149 +0,0 @@ -/** - * Slot views (components/SlotSpecificView.tsx): SlotProducts and - * FlashDeliveryProducts, plus the slot-view route's data source. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { TextInput } from 'react-native' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import { - FlashDeliveryProducts, - SlotProducts, -} from '@/components/SlotSpecificView' -import availability from '../mocks/mock-availability-response.json' -import productsResponse from '../mocks/mock-products-response.json' -import { mockSlots, resetStorage, setupApiMocks } from '../mocks/api' -import { routerMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const BASE = '/(drawer)/(tabs)/home/slot-view' -const SLOT = mockSlots.slots.find((s) => s.products.length > 0)! - -const PRODUCTS = productsResponse.products.filter((p) => !p.isComboOnly) -const AVAIL_BY_ID = new Map(availability.availability.map((a) => [a.id, a])) - -const isOutOfStock = (id: number) => AVAIL_BY_ID.get(id)?.isOutOfStock === true - -/** Slot products the screen renders: present in the cache and in stock. */ -const slotProducts = (storeId?: number) => - SLOT.products - .map((p) => PRODUCTS.find((x) => x.id === p.id)) - .filter((p): p is (typeof PRODUCTS)[number] => !!p && !isOutOfStock(p.id)) - .filter((p) => (storeId ? p.storeId === storeId : true)) - -/** Products eligible for flash delivery: flash-available and in stock. */ -const flashProducts = () => - PRODUCTS.filter((p) => { - const a = AVAIL_BY_ID.get(p.id) - return a?.isFlashAvailable === true && !a?.isOutOfStock - }) - -describe('SlotProducts', () => { - beforeEach(async () => { - await resetStorage() - }) - - it('shows the loading state while slots load', async () => { - setupApiMocks({ pendingSlots: true }) - renderWithProviders() - - await waitFor(() => - expect(screen.getByText('Loading slot delivery...')).toBeVisible() - ) - }) - - it('shows the error state when slots fail', async () => { - setupApiMocks({ failSlots: true }) - renderWithProviders() - - await waitFor(() => - expect(screen.getByText('Failed to load slot delivery')).toBeVisible() - ) - }) - - it('shows the no-slot state for an unknown slot id', async () => { - setupApiMocks() - renderWithProviders() - - await waitFor(() => - expect(screen.getByText('No delivery slot available.')).toBeVisible() - ) - }) - - it('lists the slot products and navigates on press', async () => { - setupApiMocks() - renderWithProviders() - - await waitFor(() => expect(screen.getByTestId('slot-detail-page')).toBeVisible()) - - const first = slotProducts()[0] - expect(first).toBeDefined() - await waitFor(() => - expect(screen.getAllByText(first.name).length).toBeGreaterThan(0) - ) - - fireEvent.press(screen.getAllByText(first.name)[0]) - - expect(routerMock.push).toHaveBeenCalledWith( - `/(drawer)/(tabs)/home/product-detail/${first.id}` - ) - }) - - it('shows the empty message when a store has no products in the slot', async () => { - setupApiMocks() - renderWithProviders( - - ) - - await waitFor(() => - expect( - screen.getByText('No products from this store in this slot.') - ).toBeVisible() - ) - }) -}) - -describe('FlashDeliveryProducts', () => { - beforeEach(async () => { - await resetStorage() - }) - - it('lists flash-available in-stock products', async () => { - setupApiMocks() - renderWithProviders() - - const first = flashProducts()[0] - expect(first).toBeDefined() - await waitFor(() => - expect(screen.getAllByText(first.name).length).toBeGreaterThan(0) - ) - }) - - it('filters products by the search box', async () => { - setupApiMocks() - renderWithProviders() - - const first = flashProducts()[0] - await waitFor(() => - expect(screen.getAllByText(first.name).length).toBeGreaterThan(0) - ) - - fireEvent.changeText(screen.UNSAFE_getAllByType(TextInput)[0], 'zzzzzzz') - - await waitFor(() => - expect(screen.getByText('No 1 Hr Delivery products available.')).toBeVisible() - ) - }) - - it('shows the empty message when there are no products', async () => { - setupApiMocks({ products: { products: [], tags: [] } }) - renderWithProviders() - - await waitFor(() => - expect(screen.getByText('No 1 Hr Delivery products available.')).toBeVisible() - ) - }) -}) diff --git a/apps/user-ui/tests/screens/store-detail.test.tsx b/apps/user-ui/tests/screens/store-detail.test.tsx deleted file mode 100644 index 81e0258..0000000 --- a/apps/user-ui/tests/screens/store-detail.test.tsx +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Store detail (stores/store-detail/[id].tsx) — store meta, tag chips, - * products and the tag filter. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import StoreDetail from '@/app/(drawer)/(tabs)/stores/store-detail/[id]' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { routerMock, searchParamsMock } from '../mocks/router' -import { renderWithProviders } from '../helpers/render' - -const CARD = 'product-card' - -describe('Store detail', () => { - beforeEach(async () => { - await resetStorage() - searchParamsMock.current = { id: '1' } - }) - - it('renders the store, its tags and products', async () => { - setupApiMocks() - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Meat Store')).toBeVisible()) - expect(screen.getByText('Chicken (3)')).toBeVisible() - await waitFor(() => expect(screen.getAllByTestId(CARD).length).toBeGreaterThan(0)) - }) - - it('filters by tag and clears the filter', async () => { - setupApiMocks() - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Chicken (3)')).toBeVisible()) - - fireEvent.press(screen.getByText('Chicken (3)')) - await waitFor(() => expect(screen.getByText('Chicken items')).toBeVisible()) - - fireEvent.press(screen.getByText('Clear')) - await waitFor(() => expect(screen.getByText(/\d+ products/)).toBeVisible()) - }) - - it('navigates to a product detail when a card is pressed', async () => { - setupApiMocks() - renderWithProviders() - - await waitFor(() => expect(screen.getAllByTestId(CARD).length).toBeGreaterThan(0)) - fireEvent.press(screen.getAllByTestId(CARD)[0]) - - expect(routerMock.push).toHaveBeenCalledWith( - expect.stringContaining('/stores/store-detail/product-detail/') - ) - }) - - it('shows the error state when the store cannot be loaded', async () => { - setupApiMocks({ failStores: true }) - renderWithProviders() - - await waitFor(() => - expect(screen.getByText('Store not found or error loading')).toBeVisible() - ) - }) -}) diff --git a/apps/user-ui/tests/screens/stores.test.tsx b/apps/user-ui/tests/screens/stores.test.tsx deleted file mode 100644 index c995c46..0000000 --- a/apps/user-ui/tests/screens/stores.test.tsx +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Stores list (app/(drawer)/(tabs)/stores/index.tsx). - * - * Reads stores.json, deep-links to a store picked on the home page via - * navigationStore, and offers a retry on error. - */ - -jest.mock('expo-router', () => require('../mocks/router').expoRouterMock()) - -import React from 'react' -import { fireEvent, screen, waitFor } from '@testing-library/react-native' - -import Stores from '@/app/(drawer)/(tabs)/stores/index' -import storesResponse from '../mocks/mock-stores-response.json' -import { resetStorage, setupApiMocks } from '../mocks/api' -import { routerMock } from '../mocks/router' -import { useNavigationStore } from '@/src/store/navigationStore' -import { renderWithProviders } from '../helpers/render' - -const countStoresRequests = (mock: { mock: { calls: unknown[][] } }) => - mock.mock.calls.filter(([url]) => String(url).includes('stores.json')).length - -describe('Stores screen', () => { - beforeEach(async () => { - await resetStorage() - useNavigationStore.setState({ - isNavigatedFromHome: false, - selectedStoreId: null, - }) - }) - - it('lists every store with its product count', async () => { - setupApiMocks() - renderWithProviders() - - // The header is static, so wait for the cards before asserting names. - await waitFor(() => - expect(screen.getAllByText('Explore Store').length).toBeGreaterThan(0) - ) - - for (const store of storesResponse.stores) { - expect(screen.getByText(store.name)).toBeVisible() - } - expect(screen.getAllByText('Explore Store')).toHaveLength( - storesResponse.stores.length - ) - }) - - it('navigates to a store detail when Explore Store is pressed', async () => { - setupApiMocks() - renderWithProviders() - - await waitFor(() => - expect(screen.getAllByText('Explore Store').length).toBeGreaterThan(0) - ) - fireEvent.press(screen.getAllByText('Explore Store')[0]) - - expect(routerMock.push).toHaveBeenCalledWith( - expect.stringContaining('/stores/store-detail/') - ) - }) - - it('deep-links to the store chosen on the home page and clears the flag', async () => { - setupApiMocks() - useNavigationStore.setState({ isNavigatedFromHome: true, selectedStoreId: 4 }) - - renderWithProviders() - - await waitFor(() => - expect(routerMock.push).toHaveBeenCalledWith( - '/(drawer)/(tabs)/stores/store-detail/4' - ) - ) - - const state = useNavigationStore.getState() - expect(state.isNavigatedFromHome).toBe(false) - expect(state.selectedStoreId).toBeNull() - }) - - it('shows the error state and refetches on Retry', async () => { - const api = setupApiMocks({ failStores: true }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('Store Fetch Failed')).toBeVisible()) - - const before = countStoresRequests(api.axiosGet) - fireEvent.press(screen.getByText('Retry')) - - await waitFor(() => - expect(countStoresRequests(api.axiosGet)).toBeGreaterThan(before) - ) - }) - - it('shows the empty state when there are no stores', async () => { - setupApiMocks({ stores: { stores: [] } }) - renderWithProviders() - - await waitFor(() => expect(screen.getByText('No Stores Available')).toBeVisible()) - }) -}) diff --git a/apps/user-ui/tests/setup.ts b/apps/user-ui/tests/setup.ts deleted file mode 100644 index 60ba61a..0000000 --- a/apps/user-ui/tests/setup.ts +++ /dev/null @@ -1,157 +0,0 @@ -/** - * Shared Jest setup for apps/user-ui. - * - * Only the native/context dependencies that cannot run under a plain Jest - * environment are stubbed here. Everything else (components, stores, hooks) - * stays real so tests exercise the actual wiring. - * - * Note: no `typeof import('react-native')` type expressions below. Loading the - * RN ambient globals from a type position here reverses their precedence with - * @types/node's, which flips `setTimeout` from `number` to `NodeJS.Timeout` and - * fails typecheck in unrelated app files (packages/ui/src/components/ - * bottom-dropdown.tsx). - */ - -/** - * Note: `expo-router` is NOT mocked here. A global mock would also apply to - * tests/home-page/navigation.test.tsx, which drives the real router. Test files - * that need the mocked router add it themselves (see tests/mocks/router.ts). - */ - -/** - * Refresh plumbing, irrelevant to most assertions. - * `useMarkDataFetchers` runs `useFocusEffect`, which throws without a - * NavigationContainer. These are mocked by their own module paths rather than - * partially mocking the `common-ui` index: several index components import - * back from `common-ui` (button.tsx -> common-ui), so spreading - * `jest.requireActual('common-ui')` walks a half-initialised module and throws. - * - * Rather than no-op'ing them, the mocks record the callback so - * tests/home-page/home-refresh.test.tsx can invoke the page's handleRefresh - * (see tests/mocks/refresh.ts). - */ -jest.mock('common-ui/hooks/useMarkDataFetchers', () => ({ - __esModule: true, - useMarkDataFetchers: (cb: () => void) => { - require('./mocks/refresh').refreshHooks.markDataFetchers = cb - }, -})) - -jest.mock('common-ui/hooks/useManualRefresh', () => ({ - __esModule: true, - default: (cb: () => void) => { - require('./mocks/refresh').refreshHooks.manualRefresh = cb - }, -})) - -// Registered here (not in the test files) so it is in place before any app -// module imports axios. Implementations are set in tests/mocks/api.ts. -jest.mock('axios') - -/** - * Native / third-party modules that cannot run under jest. Stubs live in - * tests/mocks/native.ts; individual tests spy on or override them as needed. - */ -jest.mock('react-native-webview', () => require('./mocks/native').webviewMock()) -jest.mock('expo-updates', () => require('./mocks/native').updatesMock()) -jest.mock('expo-linking', () => require('./mocks/native').linkingMock()) -jest.mock('expo-location', () => require('./mocks/native').locationMock()) -jest.mock('expo-notifications', () => require('./mocks/native').notificationsMock()) - -/** - * useHideTabNav / useAuthenticatedRoute use @react-navigation/native's - * useFocusEffect, which throws without a NavigationContainer. Run the callback - * once on mount instead so focus-driven side effects are testable. - */ -jest.mock('@react-navigation/native', () => { - const actual = jest.requireActual('@react-navigation/native') - const React = require('react') - - return { - ...actual, - useFocusEffect: (callback: () => void | (() => void)) => { - const ran = React.useRef(false) - React.useEffect(() => { - if (ran.current) return - ran.current = true - return callback() - }, []) - }, - } -}) - -/** - * Auth is out of scope for these tests. `useUserDetails` throws without an - * AuthProvider (which would drag in secure-store, tRPC login and redirect - * handling), so the context is stubbed with a signed-out shape. Overridable via - * tests/mocks/auth.ts (set authMock.userDetails) for signed-in cases. - */ -jest.mock('@/src/contexts/AuthContext', () => - require('./mocks/auth').authContextMock() -) - -/** - * Cart hooks import this deep path directly (not via the common-ui index), and - * the real service talks to expo-secure-store. In-memory map instead; the cart - * starts empty, which is the cold-start path these tests exercise. - */ -jest.mock('common-ui/src/services/StorageServiceCasual', () => { - const store = new Map() - - return { - StorageServiceCasual: { - getItem: jest.fn(async (key: string) => store.get(key) ?? null), - setItem: jest.fn(async (key: string, value: string) => { - store.set(key, value) - return true - }), - removeItem: jest.fn(async (key: string) => { - store.delete(key) - return true - }), - clearAll: jest.fn(async (keys: string[]) => { - keys.forEach((key) => store.delete(key)) - return true - }), - }, - } -}) - -/** - * Secure StorageService (expo-secure-store backed). Mocked at the service - * module path: packages/ui resolves expo-secure-store from its own node_modules, - * so mocking the native module from here would not reach it. - */ -jest.mock('common-ui/src/services/StorageService', () => { - const store = new Map() - - return { - StorageService: { - getItem: jest.fn(async (key: string) => store.get(key) ?? null), - setItem: jest.fn(async (key: string, value: string) => { - store.set(key, value) - return true - }), - removeItem: jest.fn(async (key: string) => { - store.delete(key) - return true - }), - clearAll: jest.fn(async (keys: string[]) => { - keys.forEach((key) => store.delete(key)) - return true - }), - }, - } -}) - -/** - * Freeze the clock for every test. The home page is time-sensitive — it drops - * slots whose deliveryTime is not after `dayjs()` and flags slots "closing - * soon" within 4 hours — while the slot mocks carry fixed deliveryTime values. - * A drifting wall clock therefore makes those assertions flaky. - * - * Frozen at suite start rather than a hard-coded instant, so the fixed slot - * dates in the mocks stay in the future. Use `jest.advanceTimersByTime()` / - * `jest.setSystemTime()` in a test that needs to move through time. - */ -jest.useFakeTimers({ now: Date.now() }) diff --git a/apps/user-ui/tests/stores/region-store.test.ts b/apps/user-ui/tests/stores/region-store.test.ts deleted file mode 100644 index 30d4e30..0000000 --- a/apps/user-ui/tests/stores/region-store.test.ts +++ /dev/null @@ -1,53 +0,0 @@ -/** - * regionStore (src/store/regionStore.ts). - * - * The browsing region is deliberately NOT persisted — it is re-derived on every - * launch — so this pins the in-memory contract and the generation bump. - */ - -import { useRegionStore } from '@/src/store/regionStore' - -const REGION = { id: 2, name: 'Region B', description: null, effectiveBoundId: 7 } - -describe('regionStore', () => { - beforeEach(() => { - useRegionStore.setState({ - selectedRegionId: null, - selectedRegion: null, - selectedBoundId: null, - regionGeneration: 0, - }) - }) - - it('stores the selected region and bound and bumps the generation', () => { - useRegionStore.getState().setRegion(REGION, 7) - - const state = useRegionStore.getState() - expect(state.selectedRegionId).toBe(2) - expect(state.selectedRegion).toMatchObject({ id: 2, name: 'Region B' }) - expect(state.selectedBoundId).toBe(7) - expect(state.regionGeneration).toBe(1) - }) - - it('does not bump the generation for an identical selection', () => { - useRegionStore.getState().setRegion(REGION, 7) - useRegionStore.getState().setRegion(REGION, 7) - - expect(useRegionStore.getState().regionGeneration).toBe(1) - }) - - it('clears the region and bumps the generation', () => { - useRegionStore.getState().setRegion(REGION, 7) - useRegionStore.getState().clearRegion() - - const state = useRegionStore.getState() - expect(state.selectedRegionId).toBeNull() - expect(state.selectedRegion).toBeNull() - expect(state.selectedBoundId).toBeNull() - expect(state.regionGeneration).toBe(2) - }) - - it('is memory-only (no persist middleware)', () => { - expect((useRegionStore as unknown as { persist?: unknown }).persist).toBeUndefined() - }) -}) diff --git a/apps/user-ui/tests/stores/store-staleness.test.ts b/apps/user-ui/tests/stores/store-staleness.test.ts deleted file mode 100644 index 13a2ec3..0000000 --- a/apps/user-ui/tests/stores/store-staleness.test.ts +++ /dev/null @@ -1,121 +0,0 @@ -/** - * centralSlotStore.setSlotsData — the rebuild of productSlotsMap on every slots - * or availability refresh. - * - * The cart reconciler and the out-of-stock rules both read this map, so a stale - * or partial rebuild silently changes what the user can buy. store staleness - * beyond the map itself (query-level races) is listed in tests/KNOWN-GAPS.md. - */ - -import { useCentralSlotStore } from '@/src/store/centralSlotStore' - -type AvailabilityEntry = { - id: number - isOutOfStock?: boolean - isFlashAvailable?: boolean - isSuspended?: boolean -} - -const slot = (id: number, productIds: number[]) => ({ - id, - deliveryTime: new Date(Date.now() + 3 * 3600_000).toISOString(), - freezeTime: new Date(Date.now() + 2 * 3600_000).toISOString(), - products: productIds.map((productId) => ({ id: productId, images: [] })), -}) - -const product = (id: number) => ({ id }) - -const reset = () => - useCentralSlotStore.setState({ - slots: [], - productSlotsMap: {}, - isSlotsLoaded: false, - refetchSlots: null, - setSlotsData: useCentralSlotStore.getState().setSlotsData, - setRefetchSlots: useCentralSlotStore.getState().setRefetchSlots, - }) - -const setup = ( - slots: unknown[], - productAvailability: unknown[], - availability: AvailabilityEntry[] -) => useCentralSlotStore.getState().setSlotsData(slots as never, productAvailability as never, availability as never) - -const map = () => useCentralSlotStore.getState().productSlotsMap - -describe('centralSlotStore.setSlotsData', () => { - beforeEach(reset) - - it('creates an entry for every product in productAvailability', () => { - setup([], [product(1), product(2)], []) - - expect(Object.keys(map()).sort()).toEqual(['1', '2']) - expect(map()[1].slots).toEqual([]) - expect(map()[1].isOutOfStock).toBe(false) - }) - - it('merges the availability flags onto each product', () => { - setup([], [product(1), product(2), product(3)], [ - { id: 1, isOutOfStock: true }, - { id: 2, isFlashAvailable: true }, - { id: 3, isSuspended: true }, - ]) - - expect(map()[1]).toMatchObject({ isOutOfStock: true, isFlashAvailable: false, isSuspended: false }) - expect(map()[2]).toMatchObject({ isOutOfStock: false, isFlashAvailable: true, isSuspended: false }) - expect(map()[3]).toMatchObject({ isOutOfStock: false, isFlashAvailable: false, isSuspended: true }) - }) - - it('defaults every flag to false when the product has no availability row', () => { - setup([], [product(1)], []) - - expect(map()[1]).toEqual({ slots: [], isOutOfStock: false, isFlashAvailable: false, isSuspended: false }) - }) - - it('attaches each slot to every product it carries', () => { - setup([slot(1849, [1, 2]), slot(1847, [1])], [product(1), product(2)], []) - - expect(map()[1].slots.map((s: { id: number }) => s.id)).toEqual([1849, 1847]) - expect(map()[2].slots.map((s: { id: number }) => s.id)).toEqual([1849]) - }) - - it('ignores a slot product that is not in productAvailability', () => { - setup([slot(1849, [1, 99])], [product(1)], []) - - expect(Object.keys(map())).toEqual(['1']) - expect(map()[1].slots).toHaveLength(1) - }) - - it('marks the slots loaded so the cart reconciler can run', () => { - expect(useCentralSlotStore.getState().isSlotsLoaded).toBe(false) - - setup([], [product(1)], []) - - expect(useCentralSlotStore.getState().isSlotsLoaded).toBe(true) - }) - - /** - * A refresh rebuilds the map from scratch rather than merging, so a product - * that drops out of the cache disappears entirely — the cart reconciler and - * the out-of-stock checks then see it as unknown. - */ - it('replaces the map wholesale on a refresh, dropping vanished products', () => { - setup([slot(1849, [1, 2])], [product(1), product(2)], []) - expect(Object.keys(map()).sort()).toEqual(['1', '2']) - - setup([slot(1850, [1])], [product(1)], []) - - expect(Object.keys(map())).toEqual(['1']) - expect(map()[1].slots.map((s: { id: number }) => s.id)).toEqual([1850]) - }) - - it('keeps the availability flags when the same product is refreshed', () => { - setup([], [product(1)], [{ id: 1, isOutOfStock: true }]) - expect(map()[1].isOutOfStock).toBe(true) - - setup([], [product(1)], []) - - // The availability row is gone, so the flag resets. - expect(map()[1].isOutOfStock).toBe(false) - }) -}) diff --git a/apps/user-ui/tests/stores/stores.test.ts b/apps/user-ui/tests/stores/stores.test.ts deleted file mode 100644 index 88f4d28..0000000 --- a/apps/user-ui/tests/stores/stores.test.ts +++ /dev/null @@ -1,130 +0,0 @@ -/** - * Zustand stores: initial state + actions. - * - * Stores are module singletons; each test pokes the one it needs and resets it - * afterwards where the shape is shared with other tests. - */ - -import { useAddressStore } from '@/src/store/addressStore' -import { useAppStore } from '@/src/store/appStore' -import { useCartStore } from '@/src/store/cartStore' -import { useCentralProductStore } from '@/src/store/centralProductStore' -import { useCentralSlotStore } from '@/src/store/centralSlotStore' -import { useFlashCartStore } from '@/src/store/flashCartStore' -import { useNavigationStore } from '@/src/store/navigationStore' -import { useQuickDeliveryStore } from '@/src/store/quickDeliveryStore' -import { useStoreHeaderStore } from '@/src/store/storeHeaderStore' -import { useFlashNavigationStore } from '@/components/stores/flashNavigationStore' -import { useSlotStore } from '@/components/stores/slotStore' - -describe('zustand stores', () => { - it('appStore tracks tab-bar visibility per caller', () => { - useAppStore.getState().setHideTabsNavKey('cart', true) - expect(useAppStore.getState().hideTabsNav.cart).toBe(true) - - useAppStore.getState().setHideTabsNavKey('cart', false) - expect(useAppStore.getState().hideTabsNav.cart).toBe(false) - }) - - it('addressStore holds the selected checkout address', () => { - useAddressStore.getState().setSelectedAddressId(7) - expect(useAddressStore.getState().selectedAddressId).toBe(7) - }) - - it('cartStore queues and clears the add-to-cart product', () => { - const product = { id: 2, name: 'Chicken Breast 500 g' } - useCartStore.getState().setAddedToCartProduct({ productId: 2, product }) - expect(useCartStore.getState().addedToCartProduct).toEqual({ productId: 2, product }) - - useCartStore.getState().clearAddedToCartProduct() - expect(useCartStore.getState().addedToCartProduct).toBeNull() - }) - - it('flashCartStore queues and clears the flash product', () => { - const product = { id: 5, name: 'Cucumber' } - useFlashCartStore.getState().setAddedFlashProduct({ productId: 5, product }) - expect(useFlashCartStore.getState().addedFlashProduct).toEqual({ productId: 5, product }) - - useFlashCartStore.getState().clearAddedFlashProduct() - expect(useFlashCartStore.getState().addedFlashProduct).toBeNull() - }) - - it('navigationStore tracks the from-home flag and selected store', () => { - useNavigationStore.getState().setNavigatedFromHome(true) - useNavigationStore.getState().setSelectedStoreId(4) - - const state = useNavigationStore.getState() - expect(state.isNavigatedFromHome).toBe(true) - expect(state.selectedStoreId).toBe(4) - }) - - it('quickDeliveryStore holds the selected slot', () => { - useQuickDeliveryStore.getState().setSelectedSlotId(1849) - expect(useQuickDeliveryStore.getState().selectedSlotId).toBe(1849) - }) - - it('storeHeaderStore holds the screen title', () => { - useStoreHeaderStore.getState().setTitle('Meat Store') - expect(useStoreHeaderStore.getState().title).toBe('Meat Store') - }) - - it('slotStore holds the quick-delivery slot and store', () => { - useSlotStore.getState().setSlotId(1849) - useSlotStore.getState().setStoreId(1) - - expect(useSlotStore.getState().slotId).toBe(1849) - expect(useSlotStore.getState().storeId).toBe(1) - }) - - it('flashNavigationStore flags navigation back to the cart and resets', () => { - useFlashNavigationStore.getState().setShouldNavigateToCart(true) - expect(useFlashNavigationStore.getState().shouldNavigateToCart).toBe(true) - - useFlashNavigationStore.getState().reset() - expect(useFlashNavigationStore.getState().shouldNavigateToCart).toBe(false) - }) - - it('centralProductStore indexes products by id', () => { - useCentralProductStore.getState().setProducts([ - { id: 2, name: 'Chicken Breast 500 g', price: 215 }, - { id: 5, name: 'Cucumber', price: 15 }, - ] as never) - - const state = useCentralProductStore.getState() - expect(state.products).toHaveLength(2) - expect(state.productsById[2].name).toBe('Chicken Breast 500 g') - expect(state.productsById[5].price).toBe(15) - }) - - it('centralSlotStore builds productSlotsMap from slots + availability', () => { - useCentralSlotStore.getState().setSlotsData( - [ - { - id: 1849, - deliveryTime: '2026-09-26T10:00:00.000Z', - freezeTime: '2026-09-26T09:00:00.000Z', - products: [{ id: 2, images: [] }], - }, - ] as never, - [{ id: 2 }] as never, - [ - { - id: 2, - price: 215, - marketPrice: 220, - flashPrice: null, - isFlashAvailable: true, - isOutOfStock: false, - isSuspended: false, - }, - ] as never - ) - - const state = useCentralSlotStore.getState() - expect(state.isSlotsLoaded).toBe(true) - expect(state.slots).toHaveLength(1) - expect(state.productSlotsMap[2].slots.map((s) => s.id)).toEqual([1849]) - expect(state.productSlotsMap[2].isFlashAvailable).toBe(true) - expect(state.productSlotsMap[2].isOutOfStock).toBe(false) - }) -}) diff --git a/cart_top.png b/cart_top.png new file mode 100644 index 0000000000000000000000000000000000000000..ad19e4895af41915304efe647aa91d4f75dfae8c GIT binary patch literal 240492 zcmeFZXIN8R*EOmrpaM2PkgkXb2q?V;P)g{%NmY>E2@oL^5m7p#6lnqJ9qEuzM4Hsl zOXwXE5~PF@+P8h)@43r4|Ic-PycZWcn@#pwYtOaToMX%}lQ1m}Fx54NYZoqDpi)+n z*ST=vGWx=WY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te%(z4f?0Xk zpD&FArBEOn7^R=%cOfo9XVkg5BOE?oYfP|ewkvj4GXENcpeEsqnrW>O|6zh9@5q!rj@<23S&1NFJjFr zA|bEwBTCNRmt|nQWq3Pf^QB`kXg$y@|LB3ci|83!6G-4I`8DYU(|{3wX_^zN%=+SA z%VUW$X7~87<*`H~|3AyadF`D9750foHL{S88a=!NV_Bag! z3e6s2h_r$JI{<=hZ5cF!aEJ0hTd(eG9{u%$uk&0Z55&8`lSj_T#6X9uPAUhGz&@sE zW?|v+nL*T=e69<^?`LG3b9RP+Wx^v&;$%YCCpK~|$K9+NZY_7j-26o%cGa`QT@25b zT~AmIQ=^@;oLj&a@euM*^rAr0=7501_JGmQyZnm8*8k?-8=Pb|TsKSM7GjNYcfn#S zzx>(b|83ar^BAKjSo$_Rcz`s5b2{m9rS;lvPKZ7H-sP)z?fw4sV|BR1fVH!-zl;(Q z$!{o)4l=H*t?h68W9CCSU)|;wO9niu&CMpIG8SQR{JEh_rd#(@E8N9va?lqn7f1B>&3-51Al+ zmO9&?si11Y_p?ZpEKzZ`e_KL1c0!2x_Hohi!z_BeE6%V5brN>}e6gY? z+@N5bIXT#(STvHY#_(d-Q-25t3v10>js%$+h=SyqCci1wJtyhe*(yRkcq@$^I9)C_ zvM&+le%$j#lF@gB=UC= zH8r&wzAUf33h1wDJ6?~YwvsXDQ8ig+7Y$L-AGXH}kG7_^T;KK9tHYLVycd)y~_jRah>{P9Zu$Pj&M zZmy+?U}}2$7|2$NVP!{W;*r6@I z9M~;$N|^SKs7ex|s%PXAbG?#t)5c`7ef_UV&)*6DH=6$NohPxvHXy?{8OsHKMpzTQ JbRGN4e*<&QW9R?? literal 0 HcmV?d00001 diff --git a/change-log.txt b/change-log.txt index b4b9bed..70f7e7d 100644 --- a/change-log.txt +++ b/change-log.txt @@ -6608,3 +6608,42 @@ user-ui @@ -145 +145 @@ - sendAdminNotification: protectedProcedure + sendAdminNotification: staffProcedure + +=== 2026-10-18 14:50:17 IST | .pi/mcp.json === +Add a "_notes" block recording the Maestro MCP obstacles hit during the FR-2026-10-18-01 regression run and the recovery steps. mcpServers is unchanged. + +--- a/.pi/mcp.json ++++ b/.pi/mcp.json +@@ -9,6 +9,38 @@ + ], + "description": "Maestro mobile/web UI automation: list devices, drive and inspect the screen, run YAML flows locally or on Maestro Cloud." + } ++ }, ++ "_notes": { ++ "added": "2026-10-18 (FR-2026-10-18-01 regression run)", ++ "known_issues": [ ++ "MCP can wedge with 'Device became unreachable during deviceInfo'. Later calls then fail instantly because the failure state is cached, so retrying does not help.", ++ "Observed cause: a stale/duplicate 'maestro.cli.AppKt mcp' java process and/or stale '~/.maestro/deps/simulator-server ios --id ' children. Killing the simulator-server children alone did not recover it.", ++ "Recovery that worked: kill the java process running 'maestro.cli.AppKt mcp' (pgrep -f 'maestro.cli.AppKt mcp'). pi respawns it on the next tool call; list_devices and run then work again.", ++ "After a respawn the Maestro Viewer URL changes (seen at http://127.0.0.1:10000/ and http://127.0.0.1:9999/). Surface the URL from the tool output instead of hardcoding it.", ++ "take_screenshot returns null content on iOS (the image is still shown to the assistant). On iOS prefer 'xcrun simctl io screenshot '. On the 'chromium' device take_screenshot returns real base64 image content.", ++ "Maestro text matchers are FULL-STRING regex with IGNORE_CASE: text 'Foo' does not match 'Foo bar'. Use '.*Foo.*' or an anchored regex.", ++ "React Native placeholders are not accessibility text nodes (e.g. the cart's 'Select a coupon'); tap/assert those by point.", ++ "Leftover modals (Remove Item / Delete Address / iOS Save Password) silently block every subsequent tap in a flow; dismiss them explicitly.", ++ "The MCP server is a long-lived JVM; after heavy flow churn restart it before starting a new batch." ++ ], ++ "device_ids": { ++ "ios_simulator": "5A64695E-F4D4-4E2E-90F3-EC3493A2B457", ++ "web": "chromium" ++ } + } + } + +[2026-10-18 18:17:12] DELETE entire test directories (user request) +Removed directories: +- apps/backend/tests (41 files) +- apps/user-ui/tests (89 files) +- apps/admin-ui/tests (75 files) +Total files removed: 205 +Command: rm -rf apps/backend/tests apps/user-ui/tests apps/admin-ui/tests +Note: package.json test scripts for user-ui/admin-ui/backend still reference these paths and will need cleanup. diff --git a/docs/test reports/full-regression-2026-10-18-defects.md b/docs/test reports/full-regression-2026-10-18-defects.md new file mode 100644 index 0000000..ddbe801 --- /dev/null +++ b/docs/test reports/full-regression-2026-10-18-defects.md @@ -0,0 +1,134 @@ +# Full regression defect register — FR-2026-10-18-01 + +**Source:** [`docs/test reports/full-regression-2026-10-18.md`](./full-regression-2026-10-18.md) +**Run:** FR-2026-10-18-01 · 2026-10-18 +**Derived:** this file lists the defects/problems recorded in the report. It is not a re-test and does not add new findings. +**Status:** all items are open unless the source report explicitly says they were reverted or repaired. The report states that no source code was modified. + +The report contains **55 numbered defect entries**. Two are duplicates/extensions of earlier entries: + +- **#29** duplicates the empty-component issue in **#20**. +- **#45** is the same stack-trace/500 root cause as **#8**, with a specific read-path example. +- **#37** extends the zero-cap validation issue in **#15** with `minOrder: -5`. + +So the register has **55 report entries / ~52 distinct defects**. + +Severity is taken from the report where labelled; where the report gives no explicit severity, a conservative severity is assigned from the demonstrated impact. + +--- + +## P0 — release blockers + +| # | Defect | Cases | Evidence / source | +|---|---|---|---| +| 1 | **Customer privilege escalation on admin procedures.** A customer JWT reaches `protectedProcedure`-based admin resolvers. A customer can read the staff list and roles, **suspend any user**, and reach `admin.user.sendNotification` (which can broadcast to all users when `userIds` is empty). About 30 admin procedures use `protectedProcedure` instead of `staffProcedure`. | SEC-01, SEC-28, CUSTOMER-05, CUSTOMER-11, PUSH-19 | U1 suspended user 1327 via `admin.user.updateUserSuspension` (200); staff list/roles exposed; notification path reachable. §1, §21 | +| 2 | **Suspension is not enforced.** `createContext` assigns `user` before the suspension check and the catch does not clear it. A suspended user keeps full API access, can log in again, and can read their account; only order placement is blocked. | CUSTOMER-03, CUSTOMER-04 | Suspended U0 old token → `getSelfData` 200; fresh login succeeded; `placeOrder` 403. §1, §20 | +| 3 | **JWT signing secret is committed in repository configs.** `wrangler.dev.toml` / `wrangler.prod.toml` contain a weak secret. An offline-minted staff token was accepted as a real staff member. | SEC-06 | Token minted with `my_meatfarmer_jwt_secret_key` accepted; `admin.me` → e2eadminA. §1 | +| 4 | **No quantity or inventory bound on order placement.** `quantity: 1e9` created an order worth ₹235,000,000,000. | CART-16, ORDER-04 | Order 2563 created, total ₹235,000,000,000; cancelled as cleanup. §8, §15 | +| 5 | **Coupon type switch keeps the old discount.** Editing a percentage coupon to a flat amount returns 200 but leaves both fields; pricing continues to apply the percentage. Applies to regional and global update paths. | CPM-21 | 15% coupon updated with `flatDiscount: 30` still stored `discountPercent: 15`; order discount remained 15%. §13 | +| 6 | **Cross-user complaint creation.** U2 can raise a complaint against U1's order; there is no ownership check on the referenced order. | SUPPORT-05 (earlier `COMPLAINT-02`) | Complaint 107 created by U2 against U1's order 2562. §30, §31.4 | +| 7 | **Negative / non-finite money accepted.** Negative and `1e308` prices, negative/150% coupons, and negative delivery charges were accepted and served. | STOCK-12, CFG-08, CPM-06 | Negative prices accepted; `deliveryCharge: -50` served; 150% coupon accepted. §5, §13, §29.5 | +| 8 | **Business rejections surface as HTTP 500 with stack traces.** Not-found, cross-user, invalid-coupon and other business rejections return 500/`INTERNAL_SERVER_ERROR` instead of actionable 4xx; responses expose internal file paths. | SEC-15, SEC-22, UX-03 | `data.stack` with `.wrangler/tmp/.../worker.js` paths in responses. §1, §46 | +| 9 | **Unknown or foreign keys accepted.** Global constants accept arbitrary keys; `tagsOrder` accepts garbage/foreign SKU ids; scope checks are otherwise correct. | CFG-13, CFG-17, SEC-13 | `__e2e_unknown_key__` persisted; `tagsOrder='999999,0,-1,999999'` stored. §1, §5 | +| 10 | **Regional product suspension cannot be set.** `isSuspendedInRegion: true` returns 200 but does not persist; a "regionally suspended" item remains orderable. | STOCK-07, STOCK-08, CART-08 | Read-back stayed `false`; suspended item ordered successfully. §29.5, §29.9 | +| 16 | **Cross-region data leakage and association in admin APIs.** Staff B can read a region-1 customer's details; region-1 objects accept region-2 SKUs/products in slots, tags, groups, stores and product updates. A foreign SKU was attached to a region-1 product. | CUSTOMER-08, SLOT-12, TAG-06, GROUP-05, STORE-07, PROD-11 | Staff B read region-1 customer 388; slot accepted region-2 SKU; product 160 SKUs became `[162,184]`. §31.5–§31.6 | +| 41 | **Regional admin can create a `super_admin`-role staff account.** The account is region-scoped, but the role itself is not restricted; its token reaches `admin.user.getAllUsers`. | STAFF-07b | Created role `super_admin` with 200; token got 200 on customer-data admin read; 401 on superadmin routes. §45 | +| 52 | **Unauthenticated packaging mutation (IDOR).** `admin.vendorSnippets.updateOrderItemPackaging` is a `publicProcedure` with its staff check commented out. It accepts a sequential `orderItemId`, so anyone can flip packaging state. | VENDOR-07 | No `Authorization` header → 200; `is_packaged` changed; restored to false. §50 | +| 53 | **No logout or token revocation; sessions last months.** No logout procedure or revocation store exists. Staff/user JWTs carry multi-month `exp`; a captured token remains valid after logout or password/account changes. | SAUTH-11, SAUTH-03 | All logout paths 404; staff exp ≈ 2026-11-17, user ≈ 2027-01-14; old token still 200. §51 | + +--- + +## P1 — high-priority defects + +| # | Defect | Cases | Evidence / source | +|---|---|---|---| +| 11 | **No per-item flash validation.** A non-flash-available SKU is accepted into a flash order. | FLASH-03 (earlier labelled FLASH-04) | Flash order with an ineligible SKU returned 200. §29.10, §31.10 | +| 12 | **Double-tolerated terminal mutations.** Resolving an already-resolved complaint and customer-cancelling an already-cancelled order overwrite the stored response/reason. | SUPPORT-10, CANCEL-04 | Complaint response overwritten; second cancel returned 200 and replaced reason. §2, §16, §31.4 | +| 13 | **Ghost-user suspension.** `admin.user.updateUserSuspension` accepts a non-existent user id and reports success, creating a ghost row. | CUSTOMER-06 (earlier CUSTOPS-09) | Non-existent id → 200 "User suspended successfully". §29.11 | +| 14 | **Soft-deleted SKU remains price-editable.** A price update on a soft-deleted SKU is accepted. | STOCK-15 | Obsolete target returned 200. §29.5 | +| 15 | **Minor money/eligibility contract gaps.** `getEligible` ignores an invalid `regionId`; `maxValue: 0` is ignored; negative prices accepted. | CPA-25, MONEY-20, STOCK-12 | Invalid region returned full list; zero cap still discounted; negative/1e308 accepted. §29.8, §29.9, §44 | +| 17 | **`getUserDetails` returns 500 for a user with a large order history.** Other users return 200. | CUSTOMER-01 | "Failed query: select id from orders …". §31.5 | +| 18 | **No coordinate or delivery-sequence validation.** `lat:200, lng:400` accepted; delivery sequences accept duplicate, unknown and foreign order ids. | DELIVERY-08, DELIVERY-04, DELIVERY-05 | Out-of-range coordinates 200; sequence `[2637,999999,2638,2637]` 200. §31.3 | +| 19 | **`javascript:` banner destination accepted.** Redirect scheme is not validated. | BANNER-11 | `javascript:alert(1)` accepted. §31.6 | +| 20 | **Combo integrity gaps.** Self-referencing and empty-component combos are accepted. | COMBO-07, COMBO-08 | Both returned 200. §31.6 | +| 21 | **Group deletion ignores active slot attachment.** A group attached to an active slot can be deleted. | GROUP-10 | Delete returned 200. §31.6 | +| 22 | **Store accepts an invalid/unclaimed image key.** | STORE-10 | Store create with bad key returned 200. §31.6 | +| 23 | **Delivered orders remain editable by the customer; notes have no length limit.** | EDIT-03, EDIT-04 | Delivered order note update 200; 411-char unicode note accepted. §31.2 | +| 24 | **Fulfilment blocked by a soft-deleted product.** A valid order cannot be delivered once the product row is soft-deleted. | FUL-14 | Deliver returned 400. §31.1 | +| 25 | **Flash-order integrity.** A scheduled slot id is accepted in a flash payload; coupons on flash orders are rejected. | FLASH-08, FLASH-15 | Flash + scheduled slot 200; flash + coupon 400. §31.10 | +| 27 | **Structural product/tag changes are not published.** Product create and tag create did not advance `products_version_num`; the new SKU was absent from the published products file after 30s/8s. | CACHE-02, CACHE-13 | Version stayed 20→20 and 22→22; new SKU missing. §33.3 | +| 28 | **Slot accepts `freezeTime` after `deliveryTime`.** | SLOT-09 | Invalid slot accepted 200. §33.3 | +| 30 | **Upload validation gaps.** External `https://` image URLs and unsupported MIME types are accepted; 6 MB/corrupt bodies can be PUT under an image MIME. | UPLOAD-09, UPLOAD-10, UPLOAD-20 | External URL accepted; `application/x-msdownload` signed; 6 MB/corrupt PUT 200. §33.3 | +| 32 | **Duplicate global product on concurrent create.** Two simultaneous same-name creates both returned 200. | GP-18 | Two global product rows. §37 | +| 33 | **Tag update accepts an invalid image key.** Same class as #22 but a different endpoint. | TAG-11 | Update returned 200. §37 | +| 35 | **Coupon dropdown hides ineligible coupons instead of showing disabled reasons.** The API returns 33 coupons including all disabled classes; the sheet shows only 8 applicable rows and no disabled rows. | CLS-02, CLS-03, CLS-04, CLS-05, CLS-06 (CLS-15 related) | API vs UI comparison; no "Disabled + reason" layout. §41, §51 | +| 37 | **Zero coupon cap is ignored; negative `minOrder` accepted.** Extends #15. | MONEY-20 | `maxValue:0` still discounted; `minOrder:-5` accepted. §44 | +| 38 | **Address creation has no idempotency.** An ambiguous retry creates duplicate address rows. | ADDR-21 | Two rows after retry. §44 | +| 40 | **Duplicate staff identity via concurrency.** Simultaneous same-username creates both succeed. | STAFF-11 | Two rows returned 200. §45 | +| 42 | **Account deletion returns 500 for users with orders.** No deletion/anonymisation path for users with history; the row and token survive. | PROFILE-11 | FK delete failure; post-delete `/self` still 200. §45 | +| 43 | **Duplicate store on retry.** Same store name created twice. | STORE-12 | 200/200; two rows. §45 | +| 44 | **`getOrderById` returns 500 where 4xx is required.** Non-existent, malformed and another user's order ids all return 500. | ORDER-10, UX-03 | `parseInt` feeds `NaN` into the query; 500 `-32603`. §46 | +| 45 | **Error responses carry full stack traces.** Same root cause as #8; specific read-path example. | UX-03, SEC-22 | Stack with absolute `.wrangler/tmp` paths. §46 | +| 46 | **No idempotency on order placement.** An identical retry creates a second order and double-charges. | CHECK-09, CHECK-11, ORDER-16, UX-04, UX-14 | Orders 2709/2710 from identical submits. §46 | +| 47 | **Cart is silently destroyed by an unconfirmed startup region switch.** When the persisted browsing region differs from the address/GPS-anchored region at launch, startup calls `confirmRegionSwitch` without a dialog; that function clears both carts despite requiring user confirmation. The earlier "first adoption" explanation was corrected in §54. | UX-01, UX-05, LOC-09, LOC-19 | Cold start with carts; region mismatch path clears carts with no warning; address-selector path does show a confirmation. §47, §54 | +| 49 | **Cart values are never validated; native cart cannot survive corrupt JSON.** Negative/non-numeric/1e9 quantities keep checkout enabled; native `getLocalCart` has no try/catch. | CART-13, CART-21 | Web bill ₹233,000,000,000 for `1e9`; native corrupt read throws. §48 | +| 50 | **Closed delivery slot is silently rewritten; web has no closed-slot guard.** Native rewrites the line to the earliest valid slot without notice; web keeps checkout enabled. | CGRD-03, CART-20 | Line moved from 30 Oct to 5 Nov; web "Proceed to Checkout" stayed enabled. §49 | +| 51 | **`admin.slots.updateSlot` is a destructive partial update.** Omitted `groupIds` clears associations; invalid group ids are silently dropped. | SLOT-16 | Slot 2085 `[17] → []`; `[5,999999] → [5]` with 200. §50 | + +--- + +## P2 — lower-priority defects and gaps + +| # | Defect | Cases | Evidence / source | +|---|---|---|---| +| 26 | **Unbounded text.** Complaint body (5,000 chars) and order notes (411 chars) have no length limits. | SUPPORT-04, EDIT-04 | Accepted without limit. §31.2, §31.4 | +| 29 | **Empty-component combo accepted.** Duplicate of #20. | COMBO-08 | 200. §33.3 | +| 31 | **No string-length limits on names.** Store/product names (and previously address/name fields) accept Unicode + 300+ chars. | STORE-05, PROD-09; ADDR-09, AUTH-09, SUPPORT-04, EDIT-04 | 300-char names accepted. §29, §33.3 | +| 34 | **Non-default address deletion fails in the app UI.** The API deletes it, but the confirmed UI action leaves the row listed. | ADDR-14 | Confirmed delete; address remained. §37.1 | +| 36 | **Mismatched DELIVER-TO label after GPS region adoption.** The region pill shows region 2 while the address line still shows the region-1 address. | LOC-19(b), REGION/LOC header | Screenshot `u18_region2gps`. §42.2 | +| 39 | **New region's bound not visible immediately.** `superadmin.regions.bounds` returns 0 bounds right after create while `effectiveSettings` works. | REGION-16 | Immediate read returned 0 bounds. §44 | +| 48 | **Floating "1 Hr Delivery" CTA intercepts taps.** It covers the bottom row of scrollable lists; the Terms row could not be tapped. | UX-10, UX-16 | Tap on Terms row opened the quick-delivery dialog. §47 | +| 54 | **Empty cart is not validated for flash orders.** `selectedItems: []` reaches Drizzle and returns 500 with an internal message. | FLASH-13 | "values() must be called with at least one value". §52 | +| 55 | **Flash (slot-less) orders cannot reach vendor production/packing views.** Vendor demand is keyed by `slotId`; flash orders have `slotId: null`. | FLASH-15 / vendor demand | `getSlotOrders` showed 0 flash orders; `getAll` does show them. Flagged for product confirmation. §52 | + +--- + +## Non-defect observations and scope blockers + +These are recorded by the report but are not counted as product defects above: + +| Item | Status | Note | +|---|---|---| +| Notifications / push | **SKIPPED (19)** | Excluded by owner instruction; real delivery not exercised. The reachable `admin.user.sendNotification` path is covered as a privilege defect (#1). | +| OTP authentication | **SKIPPED (15)** | Excluded from the password regression; no real SMS/OTP. | +| Queue/scheduler jobs | **SKIPPED (12)** | `JOB-03…10`, `JOB-12…15` excluded; no `--test-scheduled` harness used. | +| Fallback/legacy UI | **SKIPPED (14)** | `apps/fallback-ui` excluded and not running. | +| Admin web | **BLOCKED** | Not running; `SAUTH-15` and admin-web parity cases not driven. | +| `create-user` script (`USR-01…06`) | **BLOCKED** | `bcryptjs` not installed for the available Bun/tsx runners. | +| Rate-limit harness (`SEC-24`) | **BLOCKED** | No approved bounded harness. | +| Policy cases | **BLOCKED** | `ORDER-22` N/A (accepted historical zero discount), `EDIT-14` policy, `BOUND-09` cross-region overlap. | +| Expo Go permission prompt | **Not a product defect** | Per-experience Expo Go prompt; documented as a harness artifact. | +| Web cart fee presentation | **Not a defect** | Web defers the delivery fee to checkout while native shows it in the cart; recorded as a platform difference. | +| UI assertion failures | **Inconclusive** | Some Maestro chains failed due to leftover modals/full-string matching; report marks these as inconclusive, not product failures. | + +--- + +## Report hygiene / inconsistencies + +- The report's defect count changes through the document: **34** at §38, **48** at §47, **52** at §50, **55** at §54. This register uses the final **55 entries**. +- The execution tally is also inconsistent across phases (e.g. §36 says ~510 executed/~275 not run; §47 says ~668/~127; §54 says ~707/~88; §50 says ~683/~112). Treat coverage percentages as approximate. +- §30 corrects many provisional case IDs (for example `COMPLAINT-*` → `SUPPORT-*`, `CUSTOPS-*` → `CUSTOMER-*`, `DELIV` → `DELIVERY-*`). This register uses the corrected IDs. +- #29 duplicates #20; #45 duplicates the root cause in #8; #37 extends #15. +- The report says no source code was modified. These defects are therefore **reported, not fixed**, in that run. + +--- + +## Suggested triage order + +1. **#1, #2, #3, #52, #53** — authentication, suspension, secret and unauthenticated-write blockers. +2. **#4, #5, #6, #7, #8, #9** — money integrity, cross-user data, error contract, unknown-key validation. +3. **#10, #16, #41** — regional suspension, cross-region leakage, role escalation. +4. **#27, #35, #47, #49, #50** — publication, coupon UI, cart destruction and cart validation. +5. Remaining P1, then P2. + +No files other than this register were changed. diff --git a/docs/test reports/full-regression-2026-10-18.md b/docs/test reports/full-regression-2026-10-18.md new file mode 100644 index 0000000..0eba9cc --- /dev/null +++ b/docs/test reports/full-regression-2026-10-18.md @@ -0,0 +1,2626 @@ +# Freshyo full regression run — test-case catalog execution + +**Run ID:** FR-2026-10-18-01 +**Date started:** 2026-10-18 11:11 IST (05:41 UTC) +**Database:** throwaway/staging Postgres `meatfarmer` @ `57.128.212.174:7447` (schema `mf`) — disposable, freely mutable during this run. +**Backend:** `http://localhost:8787` (wrangler dev, `wrangler.dev.toml`, verified live) +**Clients under test:** +- Customer mobile (Expo Go): `host.exp.Exponent` ← Metro `:8081` (`apps/user-ui`) +- Admin mobile (Expo Go): `host.exp.Exponent` ← Metro `:8082` (`apps/admin-ui`) +- Customer web: Chromium `http://localhost:4174` +- Superadmin web: Chromium `http://localhost:4176` (`apps/superadmin-ui`; note `:4175` is a stale sandbox copy) +- iOS simulator (booted): `iphone_6.5_in` / iOS 18.6 — `5A64695E-F4D4-4E2E-90F3-EC3493A2B457` +**Method:** per the catalog README — happy paths via Maestro UI on Expo Go; persistence/security via direct tRPC probes and authoritative `mf.*` Postgres reads. See `docs/maestro-mcp-agent-guidelines.md`. + +## Identities used +| Alias | Identity | Source | +|---|---|---| +| anon | no token | — | +| U1 | customer id 1, mobile `9676651496`, `meatfarmer@123` | existing | +| U2 | customer id 1327, `e2e_u2b@test.com` / `9000000002`, `Test@12345` | registered this run | +| U0 | customer id 1328, throwaway email, `Test@12345` | registered this run | +| staffA | `e2eadminA` / `Test@12345` (region 1) | existing | +| staffB | `e2eadminB` / `Test@12345` (region 2) | existing | +| SA | `superadmin` / `superadmiN123` | existing | + +## Progress log +- 11:11 IST — environment verified (backend 8787, Metro 8081/8082, web 4174/4176, sim `5A64695E…`); identities established; report opened. DB-access limitation discovered (live D1 state not readable from this shell) — API probes used as authoritative evidence. +- 11:20 — Maestro MCP wedged ("Device became unreachable"); MCP process restarted; CLI driver used as fallback; MCP used afterwards. +- 11:24–11:50 — customer app E2E in Expo Go (login wall → cart → COD order #2560 → cancel → order history) + admin app (session, orders, fulfilment). +- 11:50–13:10 — API sweeps: security matrix, auth, regions/bounds/constants/location/addresses, cart/slots/checkout/pricing/flash, coupons, orders/cancellation, complaints/incidents/notifications/uploads/jobs, staff/profile, catalogue CRUD, cache. +- ~13:15 — report finalised. + +## Status summary + +855 catalogued cases. **Executed with evidence: 249** (PASS 176 · FAIL 34 · PARTIAL/BLOCKED/INCONCLUSIVE 22 · N/A 17). **Not run: ~606.** + +| Checklist | Cases | PASS | FAIL | PARTIAL/BLOCKED | N/A | NOT RUN | +|---|---|---|---|---|---|---| +| authorization-api-contracts | 28 | 12 | 7 | 4 | 0 | 5 | +| customer-authentication | 18 | 11 | 4 | 1 | 1 | 1 | +| regions | 16 | 8 | 2 | 4 | 0 | 2 | +| bounds | 18 | 8 | 1 | 2 | 0 | 7 | +| constants-configuration | 18 | 10 | 3 | 2 | 0 | 3 | +| location-region-switching | 25 | 8 | 0 | 0 | 0 | 17 | +| addresses | 25 | 12 | 3 | 2 | 0 | 8 | +| cart | 23 | 3 | 1 | 1 | 0 | 18 | +| scheduled-slots | 20 | 3 | 0 | 0 | 0 | 17 | +| checkout | 22 | 8 | 1 | 0 | 0 | 13 | +| pricing-delivery-fees | 22 | 6 | 0 | 0 | 0 | 16 | +| flash-delivery | 16 | 3 | 0 | 0 | 0 | 13 | +| coupon-management | 21 | 6 | 3 | 1 | 0 | 11 | +| coupon-application | 28 | 8 | 0 | 0 | 0 | 20 | +| coupon-stacking-and-cart-guards | 47 | 0 | 0 | 0 | 0 | 47 | +| reserved-coupons | 18 | 3 | 0 | 0 | 0 | 15 | +| orders | 22 | 6 | 2 | 1 | 1 | 12 | +| cancellation | 18 | 3 | 2 | 1 | 0 | 12 | +| fulfillment | 16 | 2 | 0 | 1 | 0 | 13 | +| order-edits-rebalance | 18 | 0 | 0 | 0 | 0 | 18 | +| delivery-operations | 14 | 0 | 0 | 0 | 0 | 14 | +| complaints | 16 | 4 | 1 | 0 | 0 | 11 | +| customer-management-incidents | 17 | 3 | 2 | 0 | 0 | 12 | +| notifications | 19 | 2 | 1 | 0 | 0 | 16 | +| uploads-images | 20 | 4 | 1 | 0 | 0 | 15 | +| jobs-health | 15 | 2 | 0 | 0 | 0 | 13 | +| staff-authentication | 15 | 3 | 0 | 0 | 0 | 12 | +| staff-management | 14 | 5 | 0 | 0 | 0 | 9 | +| profile-account-lifecycle | 16 | 3 | 0 | 0 | 0 | 13 | +| regional-stores | 15 | 4 | 0 | 0 | 0 | 11 | +| global-stores | 15 | 1 | 0 | 0 | 0 | 14 | +| regional-products | 20 | 5 | 0 | 0 | 0 | 15 | +| global-products | 21 | 4 | 0 | 0 | 0 | 17 | +| combos | 16 | 1 | 0 | 0 | 0 | 15 | +| catalog-search | 18 | 0 | 0 | 0 | 0 | 18 | +| product-tags-ordering | 16 | 3 | 0 | 0 | 0 | 13 | +| product-groups | 14 | 3 | 0 | 0 | 0 | 11 | +| banners | 14 | 4 | 0 | 0 | 0 | 10 | +| reviews | 12 | 2 | 0 | 0 | 0 | 10 | +| vendor-snippets | 15 | 3 | 0 | 0 | 0 | 12 | +| cache-publication | 23 | 3 | 0 | 0 | 0 | 20 | +| fallback-legacy-pages | 14 | 0 | 0 | 0 | 0 | 14 | +| otp-authentication | 15 | 0 | 0 | 0 | 15 | 0 | +| recovery-platform-accessibility | 22 | 0 | 0 | 0 | 0 | 22 | + +## P0 defects found (blockers for a release decision) + +1. **Customer privilege escalation on admin procedures** — a customer JWT reads the staff list/roles and can **suspend any user**; `admin.user.sendNotification` is reachable and broadcasts to all users when `userIds` is empty. ~30 admin procedures use `protectedProcedure` instead of `staffProcedure` (SEC-01/28, CUSTOPS-05, NOTIF-19). +2. **Suspension is not enforced** — `createContext` assigns `user` before the suspension check and the catch does not clear it; suspended users keep full API access and can log in (CUSTOPS-04). Order placement is the only blocked path (ORDER-06). +3. **JWT secret committed** in `wrangler.dev.toml`/`wrangler.prod.toml` with a weak value → offline minting of any staff/superadmin token (SEC-06). +4. **No quantity/inventory bound on orders** — `quantity:1e9` created a ₹235,000,000,000 order (CART-16 / ORDER-04). +5. **Coupon type switch keeps the old discount** — percent stays and still applies after a flat switch (CPM-21). +6. **Cross-user complaint** — U2 can raise a complaint against U1's order (COMPLAINT-02). +7. **Non-finite/negative money accepted** — negative and 1e308 prices, negative/150% coupons (STOCK-12, CFG-08, CPM-06). +8. **Business rejections surface as HTTP 500** with stack traces, not actionable 4xx (SEC-15/22 and throughout). +9. **Unknown/foreign keys accepted** — `superadmin.const.updateGlobalConstants` has no whitelist; `tagsOrder` accepts garbage SKU ids; `tagsOrder`/`updateBoundSettings` scope checks are otherwise good (CFG-13, CFG-17, SEC-13). + +## Fixtures created during the run (throwaway DB) + +Regions 4–8 (`E2E Region…`, `E2E Sole…`, `E2E Race…`) — **region deletion is unsupported**, so these remain; none overlaps the Mahabubnagar GPS polygon. Store 11 (soft-deleted products keep it undeletable), tag 11, group 14 (deleted), banner 14 (deleted), global store 12 (deleted), product 156/157 (deleted), customer U2 (+addresses), several `E2E…` coupons (invalidated), reserved secrets (redeemed), orders 2560–2581 (mostly cancelled). Global `versionNum`/region-1 `supportMobile`/bound-2 settings were reverted; the stray `__e2e_unknown_key__` global const was nulled. + +--- + +## 1. Security / authorization matrix (`authorization-api-contracts.md`, 28 cases) + +Probe method: direct tRPC calls with anon / U1 / U2 / staffA / staffB / superadmin tokens, plus forged JWTs (HS256 signed with the repo's `JWT_SECRET`). Live D1 state was not readable from this host (see "DB access" note below), so persistence assertions use API reads. + +| Case | Status | Evidence | +|---|---|---| +| SEC-01 Anonymous/customer calls admin/superadmin mutations | **FAIL (P0)** | Anon → 401 for every admin/superadmin mutation (good). But a **customer token reaches the resolver** on `protectedProcedure`-based admin mutations. Actual unauthorised write proven: U1 called `admin.user.updateUserSuspension` and suspended user 1327 (200 `User suspended successfully`), then unsuspended. (Reverted.) | +| SEC-02 Regional staff calls superadmin procedures | PASS | staffA/staffB → 401 on `superadmin.regions.create`, `staff.create`, `const.updateGlobalConstants`, `const.updateLegacyConstants`, `globalProducts/globalStores/globalCoupons.create`, `regions.deleteBound`, `const.getGlobalConstants`. | +| SEC-03 Staff B probes A ids | PASS (mostly) | staffB (region 2) → 404 for region-1 product 30, store 2, slot 2072; `banner.getBanner` 13 → `null`; `getGroups`/`getProductTags` → empty. Writes blocked: toggleOutOfStock/deleteProduct/deleteStore/updateBanner/updateSlotCapacity → 404. Minor: `order.getOrderDetails` and `coupon.delete` return **500** "not found" instead of 404. | +| SEC-04 Save with foreign ids | PASS | staffA update/save with region-2 store/group ids rejected; no cross-region write observed (verified via subsequent `getStores`/`getGroups`). | +| SEC-05 U2 probes U1 data | PASS | U2 `order.getOrderById`→own scope; `address.updateAddress` id 17 → rejected; `address.deleteAddress` 17 → 404 "does not belong to user". `getUserAddresses`/`getMyCoupons`/`complaints` return only own rows. | +| SEC-06 Forged/expired/malformed JWT | **FAIL (partial, P0)** | Expired, wrong-secret, malformed, `alg:none`, ghost staffId, ghost superadminId, `userAsSuper` → all 401. **But** the JWT secret `my_meatfarmer_jwt_secret_key` is committed in `wrangler.dev.toml` (and prod config), so a token minted offline with `{staffId:11}` was accepted as staff (admin.me returned e2eadminA). Anyone with repo access can impersonate any staff/superadmin. | +| SEC-07 Removed/reassigned staff token | NOT RUN (destructive fixture change) | | +| SEC-08 Regional edit of global structural fields | PARTIAL | `getStores` returns `isGlobal`; regional store update rejects globals (`existingStore.isGlobal` guard). Full structural-field matrix deferred to STOCK/GP sections. | +| SEC-09 Public route field exposure | PASS (with notes) | `common.essentialConsts` returns only business constants + `assetsDomain`/`apiCacheKey` (no secrets). `listRegions` returns public region rows. No credentials in public payloads. | +| SEC-10 Mixed-region checkout / foreign address-bound | see CHECK section | Covered with checkout. | +| SEC-11 Item packaging with foreign ids | see FUL section | | +| SEC-12 Malformed/empty/huge ids | PASS (mostly) | `id:'abc'`/`' 1 '`/`null` → 400; `-1`,`0`,`1.5`,`1e21`,`>2^62` → 404. Minor: `order.getOrderById orderId:'abc'` → **500** instead of 400. | +| SEC-13 Unknown / wrong-scope const key | **FAIL (P1)** | `superadmin.const.updateGlobalConstants {key:'__e2e_unknown_key__'}` returned `{success:true}` and **persisted the unknown key** into global consts (no whitelist). Wrong-scope write (bound key via region endpoint) correctly rejected (400). | +| SEC-14 Customer-supplied money/creator/actor | see CHECK/ORDER sections | | +| SEC-15 Business rejection contract | PARTIAL | OOS/full-slot/protected-delete rejections tested in feature sections; several not-found paths surface as 500 (see SEC-03). | +| SEC-16 Partial write on failure | see feature sections | | +| SEC-17 Duplicate/concurrent operations | see feature sections | | +| SEC-18 Coupon / reserved redemption races | see coupon sections | | +| SEC-19 Large arrays / unbounded queries | **FAIL (P1)** | `admin.order.getAll {limit: 1e9}` returned the full result set (no upper bound on `limit`), `coupon.getAll {limit:1e9}` likewise. 100 kB `search` string → 431. | +| SEC-20 Script/HTML in fields | PARTIAL | Stored/echoed verbatim by API (see CUSTOPS/COMBO); UI escaping not exhaustively verified. | +| SEC-21 SQL-special strings | PASS | `' OR 1=1--`, `x'; DROP TABLE users;--`, `Robert'); DROP TABLE users;--` → empty results, no error, user table intact. Minor: `%`/`_%` act as LIKE wildcards (input not escaped). | +| SEC-22 Private response/error/log inspection | **FAIL (P1)** | Every 500 returns `data.stack` with full internal file paths (`TypeError: Cannot read properties of null (reading 'regionId') at file:///…/.wrangler/tmp/dev-.../worker.js`). | +| SEC-23 CORS / origin policy | PASS | `Origin: https://evil.example.com` → `access-control-allow-origin: null`; allow-listed origins echoed. | +| SEC-24 Rate/abuse control | NOT RUN | No approved bounded harness; not exercised (no real SMS/notifications sent). | +| SEC-25 Reads after logout / account switch | **FAIL (P1)** | No server-side revocation: staff/user JWTs stay valid until expiry (30 d); logout is client-only. Account-switch residual state not systematically tested. | +| SEC-26 Public health/legacy/deep-link routes | PASS | `/api/health` and `/api/seed` public by design; `/api/test/*` and `/api/v1/cm/*` require auth (401). tRPC `common.healthCheck` public. | +| SEC-27 Auth failure then valid retry | see AUTH section | | +| SEC-28 Customer token → admin staff procedures | **FAIL (P0)** | Customer token gets **200 + full staff list with roles & permissions** from `admin.staffUser.getStaff`, all roles from `admin.staffUser.getRoles`, `admin.vendorSnippets.getAll` → `[]`, `admin.order.getAll` → 200 (empty body: swallows the null-region error). Most other admin reads return **500** (null `regionId`) rather than 401/403, i.e. `protectedProcedure` accepts customers on ~30 admin procedures. `admin.user.sendNotification` is reachable by a customer and queues to **all** users when `userIds` is empty (probe used `userIds:[-1]`, queued 0 — no notification sent). | + +### Root-cause note (SEC-01/28) +`packages`-level: `protectedProcedure` in `src/trpc/trpc-index.ts` authorises **any** authenticated principal (`ctx.user || ctx.staffUser`). ~30 admin procedures use `protectedProcedure` instead of `staffProcedure`, then dereference `ctx.staffUser!.regionId` — customers therefore either (a) reach the resolver and fail with a 500, or (b) if the resolver never dereferences staff context first, succeed (staff list/roles read, user suspension write, notification broadcast). + +### Bonus defect found while testing +`src/app.ts` `createContext`: for regular users it sets `user = decoded` **before** the `isUserSuspended` check, and the surrounding `catch` does not clear `user`. Result: **suspend has no effect** — suspended user 1328 could still log in and call `user.user.getSelfData` (200) while `isSuspended=true` (verified with staffA suspend → U0 old token 200, fresh login issued and 200; reverted). + +### Still-open SEC cases (not run) +SEC-07 (destructive staff reassignment), SEC-14/16/17/18/20 (covered from feature sections), SEC-24 (rate limits — no bounded harness approved). + +**Area totals:** PASS 11 · FAIL 7 · PARTIAL 5 · NOT RUN 2 · (SEC-10/11 deferred to CHECK/FUL) + +## 2. Customer authentication (`customer-authentication.md`, 18 cases) + +| Case | Status | Evidence | +|---|---|---| +| AUTH-01 Password login with each identifier | **PASS (partial)** | Mobile `9302136839` → 200; email (lowercase) → 200; **UPPERCASE email → 200** (case-insensitive). Minor FAIL: mobile with surrounding spaces (`" 9302136839 "`) → 401 `Invalid credentials` (no trimming). No OTP sent. | +| AUTH-02 Register → sign out → sign in | PASS | Registered U0; re-login with the same credentials → 200, same userId. | +| AUTH-03 Login from Cart / Me / protected links | PASS (UI) | See Maestro run §22 — login wall from Cart returns to cart with items intact. | +| AUTH-04 Signed-out browse + Cart/Me | PASS (UI) | See §22. | +| AUTH-05 Cold start with persisted session, then logout | PASS (UI) | See §22. | +| AUTH-06 Wrong password / unknown / empty / malformed | PASS | wrong pw → 401; unknown → 401; empty identifier → 400 zod; `@@@` → 401. No token issued. | +| AUTH-07 Missing fields / bad email / bad mobile / weak pw | **FAIL (P1)** | Missing email → 400; `notmail` → 400; `12345` mobile → 400. **But password `"1"` was accepted** and account 1329 created — no minimum-strength/unacceptable-password rule. | +| AUTH-08 Duplicate email/mobile, case/space variants | PASS | Duplicate email → 409; duplicate email with different case → 409; duplicate mobile → 409. Email normalised lowercase. | +| AUTH-09 Unicode / long / whitespace | **FAIL (minor)** | Unicode name `"Ünïcødé 😀"` accepted (200) and trimmed; a **500-char name** was also accepted (no length limit) — agreed limits not enforced. | +| AUTH-10 Tampered/expired/malformed JWT | PASS | see SEC-06. | +| AUTH-11 Customer↔staff token crossing | **FAIL (minor)** | staff token → `user.user.getSelfData` returns **500** (`null.userId`) instead of 401/403; superadmin token → 401. | +| AUTH-12 Logout U1 → login U2, no residue | PASS (API) | U2 `getUserAddresses`/`getOrders`/`getMyCoupons` return only own (empty) data; no U1 rows leaked. | +| AUTH-13 Double-tap / delayed login | PASS (UI) | See §22 (single submit; no duplicate session). | +| AUTH-14 Error then retry | PASS | Bad login → 401; immediate valid login → 200. | +| AUTH-15 Malicious/privileged return URL | PARTIAL | `freshyo://` deep links only navigate to app routes; no open redirect observed in the login return path (UI, §22). | +| AUTH-16 Concurrent duplicate registration | **FAIL (P1)** | Two simultaneous `register` calls with the **same email + same mobile** both returned 200 and created **two users (1332, 1333)** — no uniqueness race guard / unique constraint at time of write. | +| AUTH-17 Refresh/back + keyboard/secure entry | PASS (UI) | Secure password field accepts `inputText` (masked); login succeeds (§22). | +| AUTH-18 OTP in isolated harness | N/A (POLICY) | Excluded from default password suite per README; no real SMS tests executed. | + +**Area totals:** PASS 11 · FAIL 4 · PARTIAL 1 · N/A 1 · NOT RUN 0 + +## 22. Maestro UI run log — customer app in Expo Go (`host.exp.Exponent`, Metro :8081) + +Device `5A64695E…` (iphone_6.5_in, iOS 18.6); GPS `16.7489,77.9856`; region **Mahabubnagar (1)**. Screenshots in run artifacts. Harness note: the Maestro **MCP** server wedged mid-session ("Device became unreachable during deviceInfo") after its `simulator-server` child was replaced; the MCP process was restarted and the reference CLI driver was used as a fallback. MCP was then used for the rest of the run. Viewer: `http://127.0.0.1:9999/`. + +| Step | Action | Result | +|---|---|---| +| 1 | `openLink exp://127.0.0.1:8081` → home | Home rendered: DELIVER TO **Mahabubnagar**, search bar, popular categories, tab bar. Bundle loads in Expo Go; status bar clean. | +| 2 | Cold start with previous session (AUTH-05) | **Session restored** — home showed the account's upcoming order #ORD2558; Me tab showed *My Account* without re-login. | +| 3 | Me tab → gear → Edit Profile | Profile shows Full Name `shafi`, empty email, mobile `9676651496`; **Update Profile / Update Password / Logout / Delete Me and My Data** all present. | +| 4 | Logout (AUTH-05) | Me tab flips to the **"Please log in"** wall (`Log in to view your profile, orders and more.` + Log In). Private data gone. | +| 5 | Browse signed out (AUTH-04) | Home + category tabs + search all work signed out. | +| 6 | Search "Chicken" (CAT-01/CAT-02) | Search Results for "Chicken"; 4 results; OOS badges + `UNAVAILABLE` on slot-less SKUs, available SKU purchasable. | +| 7 | Open *Chicken boneless* PDP (CAT-03) | Images carousel, description, `₹235 / 0.5Kg` (`₹239`, 2% OFF), **Add to Cart** + **Get in 1 Hour** (flash) buttons. | +| 8 | Add to Cart signed out (CART-01/02, SLOT-06) | Slot sheet: *Select Delivery Slot → Fri, 30 Oct · 7-8 PM*, quantity stepper, Add to Cart. Selected slot + qty 1 → item added; sticky bar `₹235 • 1 Item`, `₹65 more for FREE Delivery`. | +| 9 | Go to Cart signed out (CART-04) | **Login wall**: `Please log in / Log in to view your cart and continue to checkout.` with Log In + Go Back. | +| 10 | Log In → mobile → "other ways to login" → password (AUTH-03, AUTH-17) | Login screen renders **in place** (RG-13). Mobile `9676651496`, T&C pre-checked, password `meatfarmer@123` (masked) → success; returned **to the cart with the item intact**. iOS "Save Password?" sheet → Not Now. | +| 11 | Cart with session (CART-03, PRICING-01, ADDR-01) | Line: Chicken boneless 0.5Kg ×1, slot `Fri, 30 Oct 7-8 PM` + Change, ₹235. Delivery Slot card. Offers & Coupons (Select a coupon / Add Coupons to account). Delivery Instructions. Delivery Address carousel with default **Shafi (Mbnr, Mahabubnagar)** selected + `+ Add New`. | +| 12 | Cart bill (MONEY) | Item Total ₹235 · Products discount ₹4 · Delivery Fee ₹20 · banner "Add products worth ₹65 for free delivery" (⇒ bound threshold **₹300**) · **To Pay ₹255** (235 − 0 coupon + 20 = 255 ✓). | +| 13 | Checkout (CHECK-01/02) | *Scheduled Delivery Checkout*: Items (slot Fri 30 Oct 7:00 PM, Chicken boneless ×1 ₹235), Delivery Address Shafi, Payment Method **Pay Online (Coming Soon, disabled)** + **Cash on Delivery (selected)**; bill mirrors cart; Back to Cart + Place Order. | +| 14 | Place Order (ORDER-01) | **"Order Placed Successfully!"** — Order **#2560**, Total **₹255**; Continue Shopping / View My Orders. | +| 15 | Verify order 2560 via API | `user.order.getOrderById('2560')` → `{id:2560, orderId:"ORD2560", totalAmount:255, deliveryCharge:20, regionId:1, regionName:"Mahabubnagar", items:[Chicken boneless ×1 @235], isFlashDelivery:false}`. `admin.order.getAll` (staffA, region 1) lists 2560 total 255 / charge 20 / customer 9676651496. **Customer and admin views agree.** | + +Verified testIDs used: `home-search`, `checkout-button`, `place-order-button`, `user-login-mobile`, `user-login-other-ways`, `user-login-password`. + +## 23. Maestro UI run log — admin app in Expo Go (`host.exp.Exponent`, Metro :8082) + +| Step | Action | Result | +|---|---|---| +| 1 | Open `exp://127.0.0.1:8082` | Dashboard loads; admin session **already persisted** (drawer: **e2eadminA · Mahabubnagar**). STAFF-AUTH session restore PASS. | +| 2 | Dashboard content | Quick Actions: Delivery Slots, Add Product, Complaints (badge 2); Orders: Manage Orders, Delivery Sequences; Products & Inventory: Products, Prices Overview, Product Tags, Product Groupings, Banners, Slots, Coupons, Vendor Snippets, Stores, User Management, Send Notifications. | +| 3 | Drawer | Drawer renders correct identity + region, all menu rows present. **Bug (UI):** after selecting a drawer row the drawer stays re-opened over the destination in Expo Go; it only resets on app relaunch. Card navigation from the Dashboard works fine (used for the rest). | +| 4 | Manage Orders (ORDER-04) | List shows #2560 **CANCELLED** / 1 item / ₹255 / Delivery Charge ₹20 / slot Fri Oct 30 7:00 PM / address + phone, and #2559 CANCELLED / 3 items / ₹952 — matches the customer app and the API. | +| 5 | Manage Orders (ORDER-21 / new order visibility) | An order created **via API** (#2561) did **not** appear after the in-page refresh button but appeared on re-entering the screen (and always in `admin.order.getAll`). | +| 6 | Pack / Deliver toggle (FUL-01/02, UI) | Tapping the **Packaged** circle on #2561 did not toggle it (no state change). Fulfilment then verified through the API the UI calls: `admin.order.updatePackaged {orderId:'2561',isPackaged:true}` → `isPackaged:true`; `admin.order.updateDelivered {orderId:'2561',isDelivered:true}` → `isDelivered:true`; customer `getOrderById` → `deliveryStatus:"success"`. **FUL-01/FUL-02 PASS via API; UI toggle INCONCLUSIVE.** | +| 7 | Observation for FUL policy | An order in a **future** slot (Fri 30 Oct) could be marked delivered today (18 Oct) with no guard. | + +## 3. Regions (`regions.md`, 16 cases) + +| Case | Status | Evidence | +|---|---|---| +| REGION-01 | PASS | Created region id 4 "E2E Region …" with 2 bounds (ids 7,8) → 200; `common.listRegions` includes it. | +| REGION-02 | PASS | Rename + description update → 200, same id, name propagates to `listRegions`. | +| REGION-03 | BLOCKED | `common.product.summary` is a REST route (`/api/v1/cm/products/summary`, auth-gated), not a tRPC path; empty-catalog state for the new region not exercised. | +| REGION-04 | PASS | `bounds: []` → 400; non-FeatureCollection geojson → 400; non-numeric priority → 400. | +| REGION-05 | **FAIL** | No name limits/uniqueness: an unicode name padded to 300+ chars was accepted (region 5). | +| REGION-06 | PASS | anon / customer / staffA `regions.create` → 401. | +| REGION-07 | PASS | `regions.get` id −1/0/1.5 → 400; 999999 → 404. | +| REGION-08 | NOT RUN | Global-product seeding for a new region requires global SKUs and a staff account in that region; not exercised. | +| REGION-09 | NOT RUN | Injection of a bound/cache-seeding failure not performed. | +| REGION-10 | **FAIL** | Two concurrent creates with the **same name** both returned 200 (region ids 6 and 7) — no conflict/uniqueness. | +| REGION-11 | PASS (partial) | Rename mid-run did not detach products/staff or change ids. | +| REGION-12 | PASS | No `regions.delete` procedure exists (404 "No procedure found") — deletion unsupported. | +| REGION-13 | NOT RUN | Long-list/stale-label behaviour needs UI. | +| REGION-14 | PASS | Public `listRegions` payload = `{id,name,description,effectiveBoundId,center}` only; no staff/account data. | +| REGION-15 | PASS | New region visible in `listRegions` immediately after create. | +| REGION-16 | PARTIAL | `create` awaits cache generation (best-effort, logs failure) and returns the region; failure-injection path not tested. | + +## 4. Bounds (`bounds.md`, 18 cases) + +| Case | Status | Evidence | +|---|---|---| +| BOUND-01 | PASS | New region bound created; interior point (9.95,76.25) resolves to the correct bound. | +| BOUND-02 | NOT RUN | Polygon used; MultiPolygon not exercised. | +| BOUND-03 | PASS | `updateBound` description + priority (2→3) persisted. | +| BOUND-04 | PASS | Malformed geojson rejected 400 (see REGION-04). | +| BOUND-05 | PASS | lat 200 / lng 400 → 400 zod rejection. | +| BOUND-06 | **FAIL** | Duplicate priority → 409 (good) but **negative priority (−2) accepted**. | +| BOUND-07 | PASS | Two same-region bounds: point in the second resolved to the second bound (deterministic). | +| BOUND-08 | NOT RUN | Exact edge/vertex/hole semantics not probed. | +| BOUND-09 | BLOCKED: POLICY | Cross-region overlap tie rule not documented. | +| BOUND-10 | PASS | Delete sole bound → 409 "only bound of region… needs at least one bound". | +| BOUND-11 | PASS | Delete bound 1 (referenced by 856 addresses) → 409 with address count. | +| BOUND-12 | PASS | staffA `admin.region.getBoundSettings` for region-2 bound 3 → 404 (no foreign read); superadmin path → 200. | +| BOUND-13 | PASS | U1 `activeBound` region 1 → bound 1 (from address), region 2 → bound 3. | +| BOUND-14 | NOT RUN | No live checkout held open during bound removal. | +| BOUND-15 | NOT RUN | Concurrency not exercised. | +| BOUND-16 | PASS (partial) | Effective-bound fallback exists (`getEffectiveBoundId`) for coord-free legacy rows; not exercised on a real legacy row. | +| BOUND-17 | NOT RUN | Map UI not driven. | +| BOUND-18 | PASS | Outside all bounds → `resolveBound` 422 "outside this region's delivery area"; `resolveRegionByLocation` returns `null`. | + +## 5. Constants / configuration (`constants-configuration.md`, 18 cases) + +| Case | Status | Evidence | +|---|---|---| +| CFG-01 | PASS | `common.essentialConsts {boundId:1}` returns all flat fields (`freeDeliveryThreshold, deliveryCharge, *_version_num, assetsDomain, apiCacheKey, regionId, boundId`). | +| CFG-02 | PASS | Set bound-2 `deliveryCharge=25`, `freeDeliveryThreshold=350`, `isFlashDeliveryEnabled=true`; `essentialConsts {boundId:2}` served 25/350/true. (Reverted.) | +| CFG-03 | PASS | Region-1 `supportMobile` change visible on bound 1, region 2 unchanged. (Reverted.) | +| CFG-04 | PASS | Global `versionNum` change appeared on bound 1 **and** region-3 bound 5. (Reverted.) | +| CFG-05 | PASS | staffA `superadmin.const.updateGlobalConstants` / `updateLegacyConstants` → 401. | +| CFG-06 | PASS (partial) | Bound key via region endpoint → 400 (scoped message); region key via bound endpoint → 400. **But** a bound key via the *global* endpoint succeeded (see CFG-13). | +| CFG-07 | PASS | String-typed `deliveryCharge`/`freeDeliveryThreshold` values parsed to numbers; `'true'` parsed as flash enabled. | +| CFG-08 | **FAIL** | Negative `deliveryCharge=-50` accepted and served by `essentialConsts` (`deliveryCharge:-50`) — no domain constraint. (Reverted to null.) | +| CFG-09 | PASS | staffA bound-settings on region-2 bound 3 → 404; bound 3 deliveryCharge unchanged (20). | +| CFG-10 | PASS | Missing `boundId` → 400; unknown `boundId` → 404. | +| CFG-11 | PASS | Bulk region-const update containing one bound-scoped key → 400 and **no partial write** (supportEmail unchanged). | +| CFG-12 | NOT RUN | Rapid A/B edits within the debounce window not timed. | +| CFG-13 | **FAIL** | `superadmin.const.updateGlobalConstants` has **no key whitelist**: a bound-scoped key (`deliveryCharge`) and an arbitrary key (`__e2e_unknown_key__`) were both accepted and persisted. | +| CFG-14 | NOT RUN | KV corruption/rebuild not performed. | +| CFG-15 | NOT RUN | Active-bound priority change while a client is open not tested. | +| CFG-16 | PASS | Server derives the order region/bound from the address coordinates in `placeOrder` (see CHECK); a spoofed client `regionId` cannot move the order. | +| CFG-17 | **FAIL** | `tagsOrder='999999,0,-1,999999'` accepted and stored — foreign/deleted SKU ids not validated. (Restored.) | +| CFG-18 | PARTIAL | Update-notice HTML is only produced when the request `Host` contains `raw`/`mf`; on localhost `webviewHtml:null`, `isWebviewClosable:true`. Notice visual/branching not exercised. | + +## 6. Location & region switching (`location-region-switching.md`, 25 cases) + +| Case | Status | Evidence | +|---|---|---| +| LOC-01 | PASS | GPS (16.7489,77.9856) → region 1 bound 1; anon `activeBound(1)` → bound 1; catalog loads without login (UI §22). | +| LOC-02 | NOT RUN | Permission-denied paths are UI-only. | +| LOC-03 | PASS | `resolveRegionByLocation(0,0)` → `null`; no hang. | +| LOC-04 | NOT RUN | Delayed-GPS race is UI/stateful. | +| LOC-05 | NOT RUN | Requires location change while open. | +| LOC-06/07 | NOT RUN (UI) | Region-switch confirm/cancel + rapid A→B→A not driven on device. | +| LOC-08 | PASS | Native keeps no persisted region (re-derived per launch, observed in §22). | +| LOC-09/21 | NOT RUN (known open) | Startup-adoption cart-clear (review #10) not reproduced; needs a populated cart + cold launch in another region. | +| LOC-10/11 | NOT RUN (UI) | Foreign-default override/switch not driven. | +| LOC-12 | PASS (partial) | U1 address 285 is a legacy row with `vagueBackfilledCoords:true`; it still reports bound 1. | +| LOC-13/14/15/16/17 | NOT RUN | Lifecycle/offline/web/emulator cases not exercised. | +| LOC-18 | NOT RUN | Submit-pending region change not tested. | +| LOC-19 | PASS (API) | Effective/active bound resolution correct for (a) U1 default address, (d) anon fallback; GPS resolution verified. | +| LOC-20 | PASS (native) | Nothing persisted; after relaunch the app re-resolved region 1 from location. | +| LOC-22 | NOT RUN (UI) | Distinct permission messages not driven. | +| LOC-23 | PASS (UI) | Login-from-gate… the cart login wall rendered the login screen in place and returned to the cart (§22). | +| LOC-24 | NOT RUN | Root-wrapper route actions not exercised. | +| LOC-25 | PASS | Outside-all-bounds → `null`; with a default address the address region is used (U1 region 1). | + +## 7. Addresses (`addresses.md`, 25 cases) + +| Case | Status | Evidence | +|---|---|---| +| ADDR-01 | PASS | U2 first address with no `isDefault` → `isDefault:true`, `boundId:1`, `regionId:1` derived from coordinates. | +| ADDR-02 | PASS | Second address with `isDefault:true` → exactly one default. | +| ADDR-03 | PASS | Update omitting `isDefault` retained the existing default. | +| ADDR-04 | PASS | Default invariant held after edits/deletes (≤1 default). | +| ADDR-05 | PASS | Order uses the selected address's bound (§22 checkout used address 285 → bound 1 fee ₹20). | +| ADDR-06 | PASS | Creating an address with region 2 + Jadcherla coords → `regionId:2, boundId:3`. | +| ADDR-07 | PASS | Missing name/city → 400. | +| ADDR-08 | PASS | Phone 9/11 digits and prefix `5` → 400; 10-digit 6–9 accepted. | +| ADDR-09 | **FAIL** | No length limits: a 400-char unicode `addressLine1` accepted. | +| ADDR-10/11 | PASS (partial) | Out-of-area coords → 422 "outside this region's delivery area"; mobile form gating not driven. | +| ADDR-12 | PASS | U2 update U1 address 285 → 500 (fails, wrong contract); delete → 404 "not found or does not belong to user"; U1 address unchanged. | +| ADDR-13 | **FAIL (policy)** | Deleting the **default** address returned 409 (blocked), which contradicts ADDR-14's "delete allowed non-default unused"; the sole-address case could not be isolated (BLOCKED). Behaviour differs from the documented expectation — record, do not assume. | +| ADDR-14 | PARTIAL | Non-default delete path not isolated; default delete refused. | +| ADDR-15/16/17 | NOT RUN | Referenced-address delete and foreign-default switch not driven. | +| ADDR-18 | PASS | Region-2 coords with `regionId:1` → 422; bound re-derived from coordinates for legacy rows. | +| ADDR-19 | NOT RUN | Concurrent default changes not tested. | +| ADDR-20/21 | NOT RUN | Address changed while checkout open / save retry not tested. | +| ADDR-22 | PASS | U1 `activeBound` region 2 → bound 3; B addresses not offered while browsing A (cart carousel §22). | +| ADDR-23/24/25 | NOT RUN | Sheet/keyboard/city-dropdown/signed-out-draft UI cases. | + +**Area totals** — Regions: PASS 8 · FAIL 2 · PARTIAL 2 · BLOCKED 2 · NOT RUN 2. Bounds: PASS 8 · FAIL 1 · PARTIAL 1 · BLOCKED 1 · NOT RUN 5. CFG: PASS 10 · FAIL 3 · PARTIAL 2 · NOT RUN 3. LOC: PASS 8 · NOT RUN 17. Addresses: PASS 12 · FAIL 3 · PARTIAL 2 · NOT RUN 8. + +> **Environment note (DB access):** the live database is a Cloudflare D1 SQLite store driven by `wrangler dev`; its `.wrangler/state` directory is **not visible from this sandbox shell** (a fresh `wrangler d1 execute --local` starts empty). Authoritative persistence evidence therefore comes from tRPC reads (customer + admin + superadmin views) rather than direct SQL. `apps/backend/dumps/latest.sql` (14 Oct) predates the multi-region schema (`regions`/`region_bounds` absent) and is only used for reference. + +## 8. Cart (`cart.md`, 23 cases) + +Server-side API evidence; UI evidence from §22. Local-storage cart cases are device-only. + +| Case | Status | Evidence | +|---|---|---| +| CART-01/02 | PASS (UI) | Add from search → slot sheet → 1 line, ₹235, quantity 1; sticky bar and cart agree. | +| CART-03 | NOT RUN | Increment-step enforcement across entry points not driven. | +| CART-04 | NOT RUN | Remove-confirm cancel/confirm not driven. | +| CART-05 | PASS (UI) | Signed-out add → login wall → login → the same line survived (local cart restored). | +| CART-06 | NOT RUN | Regular vs flash cart separation not driven (flash unavailable, §FLASH). | +| CART-07 | NOT RUN | Slot persistence across relaunch not timed. | +| CART-08 | BLOCKED | No OOS/suspended SKU exists in region 1, so an invalid-line order could not be attempted. | +| CART-09 | NOT RUN | Notes round-trip not driven. | +| CART-10 | see coupon sections | | +| CART-11 | NOT RUN (known open) | Explicit A→B switch clear/preserve not driven. | +| CART-12/13/14/15 | NOT RUN | Concurrency/corrupt-storage/missing-id/slow-refresh not driven. | +| CART-16 | **FAIL (P1)** | `quantity:1.5/-1/0` → 400, **but `quantity:1000000000` was accepted** and created order 2563 with total **₹235,000,000,000** (no max-quantity/inventory guard). Order cancelled as cleanup. | +| CART-17 | NOT RUN | Account-switch cart ownership not driven. | +| CART-18/19/20 | NOT RUN | Partial checkout / floating bar / stale params not driven. | +| CART-21 | NOT RUN | Offline submit not driven. | +| CART-22 | NOT RUN | Global SKU across region switch not driven. | +| CART-23 | PASS (UI) | Signed-out cart → login wall ("Log in to view your cart…"); U1 (has addresses) cart rendered with the address carousel. Zero-address signed-in gate not driven. | + +## 9. Scheduled slots (`scheduled-slots.md`, 20 cases) + +| Case | Status | Evidence | +|---|---|---| +| SLOT-01/03 | PASS | `user.slots.getSlots {regionId:1}` → only the single future slot (Oct 30); past slots (Oct 13–15, still `isActive:true` in DB) are **not** returned. | +| SLOT-06 | PASS | No flash slots exist (all `isFlash:false`) → flash unavailable, matches UI. | +| SLOT-02/04/05/07-20 | NOT RUN | Slot creation/capacity/freeze/increment/group membership via admin and UI not exercised. | +| CHECK-08 (slot part) | PASS | Ordering into a past/frozen slot 2071 → 400 "Selected delivery slot is closed for orders". | + +## 10. Checkout (`checkout.md`, 22 cases) + +| Case | Status | Evidence | +|---|---|---| +| CHECK-01 | PASS | Full UI COD order (#2560, ₹255) → success; customer + admin views agree (§22). | +| CHECK-02/03/04 | NOT RUN | Multi-slot grouped summary / back-navigation edit loop not driven. | +| CHECK-05 | PASS | Invalid addressId → 400 "Invalid address"; empty `selectedItems` → 500 (blocked, but wrong contract). | +| CHECK-06 | NOT RUN | Empty vs no-slot states not driven. | +| CHECK-07 | PASS | Nonexistent SKU → 400; string SKU id → 400; malformed ids safely rejected. | +| CHECK-08 | PASS | Past/frozen slot rejected server-side; (stale price/coupon revalidation → see coupon sections). | +| CHECK-09 | **FAIL (P0-ish, characterization)** | Two **concurrent identical** `placeOrder` calls both returned 200 and created **two orders (2567, 2568)** — matches the documented deferred server idempotency; the in-app synchronous guard was not verified on a single client. | +| CHECK-10/11/12/13/14/15/16 | NOT RUN | Failure-retry / lost-response / suborder / zero-total / ineligible-coupon / session-expiry cases not driven. | +| CHECK-17 | PASS | Client `regionId:2` with address 285 (region 1) → order created with **regionId 1** — address coordinates are authoritative. | +| CHECK-18/19 | NOT RUN | Mixed valid/invalid subset and platform navigation not driven. | +| CHECK-20 | PASS | Online payment is disabled ("Pay Online (Coming Soon)") and COD is preselected; no gateway invoked (§22). | +| CHECK-21 | PASS | Same as CHECK-17: address in A while client claims region B → order scoped to A; no corruption. | +| CHECK-22 | PASS (server) | `slotId:null` → 400 "A delivery slot is required for scheduled orders". The reported **web-client** defect (submitting null slot ids) is therefore guarded server-side; the web UI itself was not driven. | + +## 11. Pricing & delivery fees (`pricing-delivery-fees.md`) + +Bound 1: freeDeliveryThreshold **300**, deliveryCharge **20**. + +| Check | Status | Evidence | +|---|---|---| +| MONEY-01 (threshold) | PASS | ₹235 → goods 235 + fee 20 = **255**; ₹300 (exactly T) → fee **0**, total 300; ₹600 → fee 0, total 600. `goods − discount + delivery = payable` holds; totals finite. | +| Free-delivery banner | PASS (UI) | Cart showed "Add products worth ₹65 for free delivery" at ₹235 (235+65 = 300). | +| Discount line | PASS (UI) | "Products discount ₹4" reflects market-price saving already inside the ₹235 price (₹239→₹235); payable 235+20=255. | +| MONEY-12/13 (coupon cap/negative) | see coupon sections. | +| Per-bound fees | PASS | Bound 2 quote independently configurable (see CFG-02: charge 25 / threshold 350). | +| Other fee/tax/rounding cases | NOT RUN | `platformFeePercent`, `taxRate`, rounding of coupon shares not exercised. | + +## 12. Flash delivery (`flash-delivery.md`, 16 cases) + +| Case | Status | Evidence | +|---|---|---| +| FLASH-01 | PASS | Bound 1 `isFlashDeliveryEnabled:'false'` → `placeOrder {isFlashDelivery:true}` → **403** "Flash delivery is currently unavailable. Please opt for scheduled delivery." | +| FLASH UI | PASS (partial) | Tapping the flash tab with flash disabled shows "1 Hr Delivery Unavailable / Please opt for scheduled delivery" with a "Go to Scheduled Delivery" action. **Defect:** the product page still renders a **"Get in 1 Hour"** button (and a "1 Hr Delivery" badge) while flash is disabled. | +| No flash slots | PASS | All slots `isFlash:false`; no product has `isFlashAvailable`; `FLASH-*` enabled-path cases BLOCKED on missing fixtures. | +| FLASH-02..16 | NOT RUN/BLOCKED | Flash slot creation, flash pricing, flash cart separation, cron toggle not exercised. | + +## 13. Coupons — administration (`coupon-management.md`, 21 cases) + +All test coupons used a unique `E2E…` prefix, future `validTill`, and were invalidated/deleted on cleanup. + +| Case | Status | Evidence | +|---|---|---| +| CPM-01 | PASS | Regional admin created a whole-cart 10% coupon (id 51, region 1) with cap 50. | +| CPM-02 | PASS | Flat-₹20 coupon created; fields persisted. | +| CPM-03 | PASS | Superadmin created global coupon 55 (`regionId:null`) visible in `globalCoupons.list`. (Deleted.) | +| CPM-04 | PASS | Regional create is region-scoped (`regionId:1`); `protectedProcedure` blocks anon/customer. | +| CPM-05 | NOT RUN | Multi-code batch/auto-code collision not exercised. | +| CPM-06 | **FAIL** | "Both types" rejected but as **500**; **negative `flatDiscount:-50` accepted (id 53)** and **`discountPercent:150` accepted (id 54)** — no domain constraints. | +| CPM-07 | NOT RUN | Code normalisation/duplicate handling not isolated. | +| CPM-08 | PASS | User-based coupon restricted to user 388 (`applicableUsers`) — enforced at redemption (see CPA-04). | +| CPM-09 | NOT RUN | Duplicate/nonexistent applicable-user ids not tested. | +| CPM-10 | BLOCKED | Region 2 currently has **no regional-only SKU** (only the global product 102), so a foreign-target attempt could not be constructed. | +| CPM-11 | PASS (API) | Empty/null `skuIds` ⇒ whole cart; populated array discounts only those SKUs (see CPA-07). | +| CPM-12 | NOT RUN | Target replacement/clearing on edit not isolated. | +| CPM-13 | NOT RUN | Null/zero maxValue/minOrder/limit semantics not isolated. | +| CPM-14 | NOT RUN | Expiry boundaries not isolated. | +| CPM-15 | PASS | staffB updating a region-1 coupon → 400; coupon value unchanged (flat 20). | +| CPM-16 | NOT RUN | Invalidate-after-use history not inspected. | +| CPM-17 | NOT RUN | Batch partial-failure reporting not tested. | +| CPM-18 | NOT RUN | Concurrent create/save-mid-relations not tested. | +| CPM-19 | NOT RUN | Global-coupon audit metadata (`createdBy` is null on coupon 55) noted but not evaluated. | +| CPM-20 | NOT RUN | Picker UI not driven. | +| CPM-21 | **FAIL (P0)** | `admin.coupon.update {id, updates:{flatDiscount:30}}` on a **15% coupon** → 200 but the row ends up with **`discountPercent:15` AND `flatDiscount:30`**, and the applied order discount is still **75 (the 15%)**. The opposite field is not cleared — matches review-defect "type switch keeps old discount". | + +## 14. Coupons — eligibility & stacking (`coupon-application.md`, 28 cases) + +| Case | Status | Evidence | +|---|---|---| +| CPA-01 | PASS | 10%/cap-50 on ₹498 → **discount 50, total 448** (goods-only, cap respected); one usage recorded. | +| CPA-02 | NOT RUN | Remove/reapply sequence not driven. | +| CPA-03 | PASS (contract poor) | Region-2 coupon in a region-1 order → rejected (**500**, should be 4xx). Globals allowed in both (coupon 55 is region-null). | +| CPA-04 | PASS | U2 using U1-only coupon → rejected ("not applicable to your account"); no order created. | +| CPA-05 | NOT RUN | Targeted-vs-mixed-cart split not measured. | +| CPA-06 | PASS | Targeted coupon with no target in cart → rejected. | +| CPA-07 | PASS | Targeted minOrder evaluated on the **target subtotal** (target ₹29 + unrelated ₹300, minOrder 100 → rejected 400) — regression R7 not reproduced. | +| CPA-08 | NOT RUN | min−0.01/min/min+0.01 sweep not run. | +| CPA-09 | PASS | Stacking order matters: `[10%, flat20]` → total discount **70**; `[flat20, 10%]` → **68** — sequential application on the reduced base. | +| CPA-10 | PASS | Exclusive coupon alone works; exclusive + another → rejected. | +| CPA-11 | NOT RUN | UI replacement behaviour not driven. | +| CPA-12 | PASS | Duplicate coupon ids `[id,id]` → 200 with a single ₹50 discount (deduped usage). | +| CPA-13 | PASS (contract poor) | Unknown id → rejected (500), negative id → 400, fractional/nonfinite covered by zod. | +| CPA-14 | NOT RUN | Overlapping-target split slots not exercised. | +| CPA-15 | NOT RUN | Aggregate-cap overflow not exercised (no multi-coupon cart test beyond CPA-09). | +| CPA-16 | NOT RUN | OOS/flash/combo-targeted lines not exercised. | +| CPA-17 | PASS | Invalidated coupon → rejected; no order/usage written. | +| CPA-18/19 | NOT RUN | Per-user limit boundary and concurrency not exercised. | +| CPA-20/21 | NOT RUN | First-order coupon across split groups not exercised. | +| CPA-22 | NOT RUN | Stored-discount immutability after coupon edit not inspected. | +| CPA-23 | NOT RUN | Split placement usage attribution not inspected. | +| CPA-24/25/26/27/28 | NOT RUN | Boundary/foreign-region/stale-selection/rounding/quantity-reduction cases not exercised. | + +> **Cross-cutting contract defect:** most business rejections inside coupon/order flows surface as **HTTP 500 / `INTERNAL_SERVER_ERROR`** (exclusive-combination, foreign-region coupon, user-only coupon, targeted-no-match, invalidated coupon, unknown coupon id) instead of an actionable 4xx. Same pattern as SEC-15. + +## 15. Orders (`orders.md`, 22 cases) + +| Case | Status | Evidence | +|---|---|---| +| ORDER-01 | PASS | UI order #2560 and API orders created with correct SKUs/qty/region/total; customer and admin views agree. | +| ORDER-02 | NOT RUN | Multi-slot/split-group placement not exercised (only one future slot exists). | +| ORDER-03 | PASS (contract poor) | Empty items → blocked (500); unknown SKU → 400; invalid slot → 400. | +| ORDER-04 | **FAIL** | `quantity:1e9` accepted (order 2563, ₹235,000,000,000); no max-quantity/inventory guard. | +| ORDER-05 | PASS | B address + region-1-only SKU → 409 "Product 24 is not available in this region"; global SKU 102 accepted in A. | +| ORDER-06 | PASS | Suspended customer `placeOrder` → **403**; after unsuspension → 200. (Note: general API access is *not* blocked for suspended users — see CUSTOPS-04.) | +| ORDER-07 | PASS (contract poor) | U2 `getOrderById('2560')` (U1's order) → 500 "Order not found"; U2 notes on a U1 order → 400. | +| ORDER-08/09 | NOT RUN | Cross-region history + pagination not exercised. | +| ORDER-10 | PASS (contract poor) | orderId `abc`/`ORD2560` → 500; `-1`/missing → 400; no arbitrary parsed id accepted. | +| ORDER-11/13/14/15 | NOT RUN | Cache invalidation, soft-delete history, mid-write DB failure, queue failure not exercised. | +| ORDER-12 | NOT RUN | Coupon/catalog change after placement not inspected. | +| ORDER-16 | **FAIL (characterization)** | Two concurrent identical API submits → two orders (2567/2568); server idempotency deferred per policy. | +| ORDER-17/18/19/20 | NOT RUN | Lost response / large cart / status transition / deep links not exercised. | +| ORDER-21 | PARTIAL | Region-1 admin list returns its own orders with a valid cursor; the "quiet region hidden by global ID window" scenario was not reproduced (needs 50+ newer orders in another region). | +| ORDER-22 | N/A (accepted limitation) | Historical order 2558 keeps `discountAmount:490` with its coupon codes; new orders store their discount (CPA-01). | + +## 16. Cancellation (`cancellation.md`, 18 cases) + +| Case | Status | Evidence | +|---|---|---| +| CANCEL-01 | PASS | Customer cancelled pending COD order #2560 with a reason; status/reason stored; order left the upcoming/fulfilment view. | +| CANCEL-02 | PASS | Admin `cancelOrder {orderId:2581,reason}` → 200; customer view shows `cancellationStatus:"cancelled"` + the admin reason. | +| CANCEL-03 | **FAIL** | Empty reason → 400, **but a whitespace-only reason `" "` was accepted** (200). | +| CANCEL-04 | **FAIL (customer path)** | Admin: delivered order → 400 "Cannot cancel delivered order"; already-cancelled → 400. **Customer:** a second cancel of an already-customer-cancelled order succeeded once (200) and **overwrote the stored reason** (subsequent attempt → 500). | +| CANCEL-05 | PASS | U2 cancels U1 order → rejected (500); staffB cancels region-1 order → 400. | +| CANCEL-06/07/08 | NOT RUN | Split-group partial cancellation and multi-coupon usage restoration not exercised. | +| CANCEL-09/10/11/12 | NOT RUN | Legacy/first-order/racing cases not exercised. | +| CANCEL-13 | NOT RUN | Post-edit compensation using stored charge not inspected. | +| CANCEL-14 | PARTIAL | Cancelled orders still appear in the default admin list (no cancelled-exclusion in the unfiltered view); vendor/upcoming exclusion not checked. | +| CANCEL-15/16/17/18 | NOT RUN | Mid-transaction failure / notification failure / cart restore / dialog cases not exercised. | + +## 17. Fulfilment (`fulfillment.md`, 16 cases) + +| Case | Status | Evidence | +|---|---|---| +| FUL-01/02 | PASS (API) | `updatePackaged` → `isPackaged:true`; `updateDelivered` → `isDelivered:true`; customer `getOrderById` → `deliveryStatus:"success"`. | +| FUL-UI | INCONCLUSIVE | Tapping the Packaged circle in the admin app did not toggle state (no confirmation, no change). | +| FUL policy | OBSERVATION | A future-slot order (slots Oct 30) was deliverable today (Oct 18) with no guard. | +| FUL-03..16 | NOT RUN | Item-level packaging, verification, partial delivery, rebalances, permissions, concurrency not exercised. | + +## 18. Order edits / rebalance (`order-edits-rebalance.md`) & Delivery ops (`delivery-operations.md`) + +**NOT RUN** — `rebalanceSlots`, item repricing, address-coordinate edits, delivery-sequence ordering/maps and location-permission flows were not exercised (no split-group fixtures; and the admin app's location calls may be unreliable in Expo Go — `expo-location` SDK skew noted in the guidelines). + +## 19. Complaints (`complaints.md`, 16 cases) + +| Case | Status | Evidence | +|---|---|---| +| COMPLAINT-01 | PASS | U1 raised a complaint on own order 2562 → 200 (complaint 106, region 1). | +| COMPLAINT-02 | **FAIL (P0)** | **U2 raised a complaint against U1's order 2562** → 200 (complaint 107, `userId:1327`, same `orderId`) — no ownership check on the referenced order. | +| COMPLAINT-03 | PASS | Admin list (region 1) shows both complaints with user/order/status. | +| COMPLAINT-04 | PASS | Admin `resolve {complaintId,responseText}` → 200. | +| COMPLAINT-05 | PASS | staffB resolving a region-1 complaint → 400. | +| COMPLAINT-06..16 | NOT RUN | Images, incident linkage, notification on resolve, pagination/filters, XSS rendering not exercised. | + +## 20. Customer operations & incidents (`customer-management-incidents.md`, 17 cases) + +| Case | Status | Evidence | +|---|---|---| +| CUSTOPS-01 | PASS | `addUserIncident` (user 1327, order 2562, score 1) → 200 (incident 16). | +| CUSTOPS-02 | PASS | `getUserIncidents {userId:1327}` → 1 incident with order status. | +| CUSTOPS-03 | PASS | Customer token `addUserIncident` → 401. | +| CUSTOPS-04 | **FAIL (P0)** | **Suspension is not enforced**: with U2 suspended, `user.user.getSelfData` → 200 and a **fresh login succeeded**. Root cause: `createContext` sets `user = decoded` before the suspension check and the surrounding `catch` does not clear it. (Placement is still blocked — ORDER-06.) | +| CUSTOPS-05 (customer list) | FAIL (SEC-28) | Customer token can read the staff list (`admin.staffUser.getStaff` → 9 rows with roles/permissions) and can **suspend any user** via `admin.user.updateUserSuspension`. | +| CUSTOPS-06..17 | NOT RUN | Negativity scores, filters, suspension UI, notifications, pagination not exercised. | + +## 21. Notifications, uploads, jobs/health, staff, profile + +### Notifications (`notifications.md`, 19 cases) — **SKIPPED (excluded by owner instruction, 2026-10-18)** + +The catalog was updated to mark this checklist excluded: all 19 cases are **retained** but reported as `SKIPPED` +(not `PASS`/`FAIL`/`NOT RUN`). They require real push delivery to devices/recipients, which is out of scope for +this harness. Notification cases were **not executed**. + +> The two observations recorded before this instruction took effect are **privilege/authorization** findings, not +> notification-delivery tests, and remain valid under the security checklist (SEC-28 / CUSTOPS-05): a **customer token** +> reaches `admin.user.sendNotification`, and the superadmin sender endpoint accepts the right principals. No real +> broadcast was ever sent (probes used `userIds:[-1]` → 0 recipients). + +| Case | Status | Evidence | +|---|---|---| +| PUSH-01 … PUSH-19 | SKIPPED | Excluded from the automated run (see `docs/test-cases/notifications.md`). | + +### Uploads (`uploads-images.md`, 20 cases) +| Case | Status | Evidence | +|---|---|---| +| UPLOAD-01 | PASS | `common.generateUploadUrls {contextString:'review'}` → signed R2 URL; customer/server contexts work. | +| UPLOAD-02 | PASS | Invalid `contextString` → 400 (zod enum). | +| UPLOAD-03 | PASS | Anonymous upload-url request → 401. | +| UPLOAD-04 | PASS | Staff `product_info` upload URL → 200. | +| UPLOAD-05 | **FAIL (minor)** | Arbitrary mime type (`application/x-msdownload`) accepted → signed URL issued (extension defaults to `.jpg`); no mime allowlist. | +| UPLOAD-06..20 | NOT RUN | Actual PUT, size limits, orphan cleanup, delete-on-replace, signed-URL expiry not exercised. | + +### Jobs / health (`jobs-health.md`, 15 cases) +| Case | Status | Evidence | +|---|---|---| +| JOB-01 | PASS | tRPC `common.healthCheck` → `{status:'ok'}`; REST `/api/health` → 200. | +| JOB-02 | PASS | Superadmin read paths reachable. | +| JOB-03..15 | NOT RUN | Cron flash toggle, queue consumers, retry/DLQ, cache jobs not exercised (no scheduler trigger). | + +### Staff authentication (`staff-authentication.md`, 15 cases) +| Case | Status | Evidence | +|---|---|---| +| SAUTH-01 | PASS | Wrong staff password / unknown staff → 401; wrong superadmin password → 401. | +| SAUTH-02 | PASS | Customer mobile used as staff name → 401 (no cross-identity session). | +| SAUTH-05 | PASS (UI) | Admin app cold start restored the staff session (e2eadminA · Mahabubnagar). | +| SAUTH-15 | NOT RUN | Admin-web reload identity/region regression not driven (no admin-web surface running). | +| SAUTH-03/04/06-14 | NOT RUN | Role/permission matrix, expiry, logout, password change not exercised. | + +### Staff management (`staff-management.md`, 14 cases) +| Case | Status | Evidence | +|---|---|---| +| STAFF-01 | PASS | Superadmin created staff id 13 in region 1. | +| STAFF-02 | PASS | `roles` → super_admin/admin/marketer/delivery_staff. | +| STAFF-03 | PASS | Duplicate name → 409; invalid role → 400; invalid region → 400. | +| STAFF-04 (reassign) | PASS | Region update applied to an existing session token (region 1→2). | +| STAFF-05 (remove) | PASS | Removed staff token → 401 on next call (SEC-07 resolved). | +| STAFF-06..14 | NOT RUN | Permission toggles, store/coupon ownership blocks, concurrent edits not exercised. | + +### Profile / account lifecycle (`profile-account-lifecycle.md`, 16 cases) +| Case | Status | Evidence | +|---|---|---| +| PROFILE-01 | PASS | `updateProfile {name}` persisted. | +| PROFILE-02 | PASS | `updatePassword` → new password works, old fails; short password → 400. | +| PROFILE-03 | PASS | `deleteAccount` with wrong mobile → 400; correct mobile → 200 and the account can no longer log in. | +| PROFILE-04..16 | NOT RUN | Suspension interplay, profile image, DOB/gender validation, session invalidation on delete not exercised. | + +## 24. Catalogue: stores, products, tags, groups, banners, reviews, vendor + +### Regional stores (`regional-stores.md`, 15) +| Case | Status | Evidence | +|---|---|---| +| RSTORE-01/02 | PASS | Created regional store id 11 → visible in region 1 only (`staffB` list does **not** include it). | +| RSTORE-03 | PASS | Rename → 200. | +| RSTORE-04/SEC-03 | PASS | staffB updating the region-1 store → 404. | +| RSTORE-05..15 | NOT RUN | Image replace/delete, product assignment, delete-with-products guard (observed: delete of a store with soft-deleted products → 500 "still has products"), global-store interaction, parity cases. | + +### Global stores (`global-stores.md`, 15) +| Case | Status | Evidence | +|---|---|---| +| GSTORE-01 | PASS | Superadmin created global store id 12 (region-less); deleted successfully. | +| GSTORE-02..15 | NOT RUN | Elevation, image lifecycle, parity with regional screen, protected delete with global products. | + +### Regional products (`regional-products.md`, 20) +| Case | Status | Evidence | +|---|---|---| +| RPROD-01 | PASS | Created regional product id 156 (sku 157, price 123) under store 11. | +| RPROD-02 | PASS (contract poor) | SKU without a `quantity` feature → 500 (rejected). | +| RPROD-03 | PASS | Read-back returns the created product. | +| RPROD-04/SEC-03 | PASS | staffB reading the region-1 product → 404. | +| RPROD-05 | PASS | Update (name + price 130) → 200. | +| RPROD-06..20 | NOT RUN | Images, variants, increment step, combos across regions, delete protection, parity. | + +### Global products (`global-products.md`, 21) — already tested in §STOCK +GP-03/04/06 PASS (SKU ids preserved, in-place suspension, market values untouched); GP-07 PASS (regional structural edit refused); GP-14 PASS (anon/customer/staff elevation refused). GP-01/02/05/08/09/10/11/12/13/15..21 **NOT RUN**. + +### Combos (`combos.md`, 16) +| Case | Status | Evidence | +|---|---|---| +| COMBO-01 | PASS | Created a `productType:'combo'` product with a component sku → 200 (id 157). | +| COMBO-02..16 | NOT RUN | Component availability, combo-only flag, combo pricing, region policy. | + +### Tags (`product-tags-ordering.md`, 16) +| Case | Status | Evidence | +|---|---|---| +| TAG-01/02 | PASS | Created dashboard tag id 11 on a region-1 product → 200 and listed. | +| TAG-03 | PASS | Update tag → 200. | +| TAG-04..16 | NOT RUN | Ordering (`tagsOrder`), deletion, image upload, dashboard ordering, region parity. (Note: `tagsOrder` accepts garbage ids — CFG-17.) | + +### Groups (`product-groups.md`, 14) +| Case | Status | Evidence | +|---|---|---| +| GROUP-01/02 | PASS | Created group id 14 with product 30 → 200 and listed. | +| GROUP-03 | PASS | Delete group → 200. | +| GROUP-04..14 | NOT RUN | Slot snapshot/live membership policy, duplicates, parity. | + +### Banners (`banners.md`, 14) +| Case | Status | Evidence | +|---|---|---| +| BANNER-01/02 | PASS | Created banner id 14 (created **inactive** by default) → listed (n=5). | +| BANNER-03 | PASS | Update name + `isActive:true` → 200. | +| BANNER-04 | PASS | Delete → 200. | +| BANNER-05..14 | NOT RUN | Serial ordering, redirect URL validation, active/inactive customer visibility, image lifecycle. | + +### Reviews (`reviews.md`, 12) +| Case | Status | Evidence | +|---|---|---| +| REVIEW-01 | PASS | Customer review on product 24 (ratings 5) → 200 (review id 37). | +| REVIEW-02 | PASS | Admin `getProductReviews` returns reviews. | +| REVIEW-03..12 | NOT RUN | Ratings bounds, images, admin response, delete, legacy conditional coverage. | + +### Vendor snippets (`vendor-snippets.md`, 15) +| Case | Status | Evidence | +|---|---|---| +| VENDOR-01/02 | PASS | Created snippet (slot 2072, sku 24, permanent) → 200, listed (n=5). | +| VENDOR-03 | PASS | Delete → 200. | +| VENDOR-04..15 | NOT RUN | Slot/product scope validation, order packaging per snippet, expiry, parity. | + +## 25. Reserved coupons (`reserved-coupons.md`, 18 cases) + +| Case | Status | Evidence | +|---|---|---| +| RESERVED-01 | PASS | Regional admin created a reserved coupon (secret `SECRET…`, region 1). | +| RESERVED-02 | PASS | Customer redeemed the secret → personal coupon created (id 66, `isUserBased:true`, region 1). | +| RESERVED-03 | PASS | Second redemption of the same secret → 400 "Invalid or already redeemed". | +| RESERVED-04..18 | NOT RUN | Expiry-at-claim, wrong region/user, reserved→coupon field copy verification, usage limits, invalidation. | + +## 26. Coupon stacking & cart guards (`coupon-stacking-and-cart-guards.md`, 47 cases) + +Only the core stacking behaviours were exercised (CPA-09/10/12/repeat): sequential application in selection order (70 vs 68), exclusive-combination rejection, duplicate-id dedupe, and the aggregate cap on a single coupon. **CSQ-01..47 otherwise NOT RUN** — overlapping-target split slots, negative sub-order guards, multi-coupon caps across sub-orders and cart-guard edge cases need multi-item/multi-slot fixtures that are unavailable with a single active slot. + +## 27. Cache publication (`cache-publication.md`, 23 cases) + +| Case | Status | Evidence | +|---|---|---| +| CACHE-01 | PASS | After a price write, region-1 `availability_version_num` advanced 22→23 (and products stayed 7 — no regression); values read back through `essentialConsts`. | +| CACHE-02 | PASS | `https://assets2.freshyo.in/api-cache-dev/regions/1/v-7/products.json` → 200. | +| CACHE-03 | PASS | Region-1 product cache contains 149 entries (matches the admin region-1 product list). | +| CACHE-04..23 | NOT RUN | Bounded publication deadline, region isolation of regeneration (CACHE-23/JOB-15), global regeneration narrowing, KV/DB convergence after edits, force-failure paths. | + +## 28. Legacy / OTP / recovery / delivery + +| Checklist | Status | Note | +|---|---|---| +| Fallback & legacy pages (14) | NOT RUN | Legacy web routes/parity not driven (no legacy surface running). `/api/v1/cm/*` correctly requires auth (SEC-26). | +| OTP authentication (15) | N/A (POLICY) | Excluded from the default password suite; no real SMS/OTP was triggered. `user.auth.sendOtp`/`verifyOtp` exist but were not exercised. | +| Recovery/platform/accessibility (22) | NOT RUN | Permission-denied, offline recovery, accessibility, RTL, low-end device cases not exercised. | +| Delivery operations (14) | NOT RUN | See §18. | +| Order edits/rebalance (18) | NOT RUN | See §18. | + +--- + +# 29. Continued run — phase 2 (fixtures built, blocked families executed) + +After the first pass I built the fixtures that were missing and re-ran the blocked families. The earlier summary was +superseded; the **revised summary is at the end of this section**. + +## 29.1 Fixtures created (all disposable) + +| Fixture | Value | +|---|---| +| Region-1 slots | **S1 = 2076** (5 Nov, 7–8 PM), **S2 = 2077** (6 Nov, 7–8 PM), both active and offering every region-1 SKU (163 SKUs) | +| Region-2 slot | **Bslot = 2078** (7 Nov), offering the 4 region-2/global SKUs | +| OOS product | id 160 / sku 162 | +| Regionally-suspended product | id 161 / sku 163 | +| Soft-deleted product | id 162 / sku 164 | +| Flash-available product | id 163 / sku 165 (flashPrice 55) | +| Region-2-only store/product | store 13, product 172 (`E2E BSecret…`, sku) — **not** elevated | +| Global product, 2 SKUs | id 159 (skus 160, 161), store 1 | +| U1 bound-2 address | id 898 (16.778, 77.998 → bound 2) | +| Exact-price fixtures | P1000/P999/P900/P450 (created + deleted per script) | + +## 29.2 Coupon stacking & cart guards (`coupon-stacking-and-cart-guards.md`, 47) + +| Case | Status | Evidence | +|---|---|---| +| CSQ-01 | PASS | 10% then flat ₹100 on ₹1000 → disc **200**, payable **800**. | +| CSQ-02 | PASS | flat ₹100 then 10% → disc **190**, payable **810** (order changes result). | +| CSQ-03 | PASS | 15% of ₹999 → disc **150** (integer, `Math.round`). | +| CSQ-04 | PASS | 10% then 20% on ₹1000 → **100 + 180 = 280**, payable 720 (second on reduced base). | +| CSQ-05 | PASS | flat ₹100 then 50%/cap ₹100 → disc **200** (cap on its own reduced base). | +| CSQ-06 | PASS | flat ₹1000 on ₹450 → clamped to **450**, total ₹20 (fee), never negative. | +| CSQ-07 | PASS | targeted sku130 (10%) then whole-cart flat ₹100 on ₹329 → **30 + 100 = 130**. | +| CSQ-08 | PASS | two overlapping targeted 10% on ₹300 → **30 then 27 = 57**. | +| CSQ-09 | PASS | 2-slot cart with one coupon → sub-orders sum to goods − discount + fee; fee charged once. | +| CSQ-10 | PASS | preview = persisted order = order detail (`total 800, disc 200`). | +| CSQ-11 | PASS | 150% coupon → goods clamped to 0, delivery still added, total ₹20 (no negative). | +| CSQ-12 | PASS | single 10% on ₹1000 → disc 100. | +| CSQ-13 | PASS | exclusive alone 200; exclusive + other → rejected. | +| CSQ-14 | PASS | flat ₹149.5 → rounded to **150**. | +| CLS-04 | PASS | `isFirstOrder` returned by `getEligible`; first-order coupon rejected on the 2nd order (CPA-20). | +| CLS-07 | PASS | expired coupon absent from `getEligible`. | +| CLS-08 | PASS | invalidated coupon absent (CPM-16). | +| CLS-09 | PASS | usage-limit-reached coupon absent (CPA-18). | +| CLS-10 | PASS | U1-only personal coupon not listed for U2 / not redeemable by U2 (CPA-04). | +| CDIS-01 | PASS (UI) | Cart row reads **Products discount** (₹4). | +| CDIS-02/03, CLS-01/02/03/05/06/11/12/13/14/15, CGRD-01..09, USR-01..06 | NOT RUN | UI dropdown ordering/disabled reasons, cart-guard banner, and the `create-user` script were not exercised. (Server-side equivalents of CGRD-03 and CDIS-01 were verified: closed-slot rejection and the discount row.) | + +## 29.3 Orders / checkout / cancellation with real split groups + +| Case | Status | Evidence | +|---|---|---| +| ORDER-02 | PASS | items in S1+S2 → 2 sub-orders, **shared `orderGroupId`**, per-item slot ids preserved. | +| ORDER-09 | PASS | `limit 3` → cursor 2600 → next page, **no overlap**, stable ordering. | +| ORDER-18 | PASS | multi-item identical-subtotal cart preserved across sub-orders. | +| ORDER-19 | PASS | three concurrent `getOrderById` → identical totals. | +| ORDER-08 | PASS | U1 order with region-2 address + region-2 SKU + B slot → `regionId:2`, total 131. | +| CHECK-13 | PASS | success references a valid group; delivery charged **once** (`fees=[0,0]`). | +| CHECK-17/21 | PASS | client `regionId` ignored; address coordinates decide region. | +| CANCEL-06 | PASS | cancel primary of a split group → sibling **intact**; coupon still consumed. | +| CANCEL-07/08 | PASS | after cancelling **all** siblings the coupon became **re-eligible** (usage restored once). | +| CANCEL-05 | PASS | staffB cancelling a region-1 order → 404; order untouched. | +| CANCEL-04 | **FAIL (re-confirmed)** | customer can cancel an already-customer-cancelled order once more and the **stored reason is overwritten**; admin path correctly returns 400 "already cancelled". | +| ORDER-16 | **FAIL (characterization)** | two concurrent identical submits → two orders (server idempotency deferred). | +| ORDER-03/04/10/11/13/14/15/17/20, CHECK-03/04/06/11/12/14/15/16/18/19 | NOT RUN | | +| CANCEL-09/10/11/12/13/14/15/16/17/18 | NOT RUN / PARTIAL | | + +## 29.4 Order edits, rebalance & delivery operations + +| Case | Status | Evidence | +|---|---|---| +| EDIT-01 | PASS | `admin.order.rebalanceSlots {slotIds:[S1,S2]}` → 200, 25 orders updated. | +| EDIT-02 | PASS | `removeDeliveryCharge {orderId}` → 200, customer view fee 20 → **0**. | +| EDIT-03 | PASS | `updateAddressCoords` persisted new lat/lng. | +| EDIT-04..18 | NOT RUN | Item-level repricing, split rebalance edge cases, address-coordinate guards. | +| DELIV-01 | PASS | `getSlotOrders {slotId:"2076"}` → 200, 20 orders for the slot. | +| DELIV-02 | PASS | `getDeliverySequence`/`updateDeliverySequence` round-trip (`[2602]`). | +| DELIV-03..14 | NOT RUN | Maps/sequence ordering UI, location permissions, route optimisation. | + +## 29.5 Prices, stock & suspension + +| Case | Status | Evidence | +|---|---|---| +| STOCK-01 | PASS | single-SKU price by `skuId` (30: 17 → 17.5), sibling untouched. | +| STOCK-02 | PASS | bulk 2 SKUs persisted; untouched SKU unchanged (235). | +| STOCK-03/GP-08 | PASS | global SKU market price edited in A (150→157 in B only when B edits); A unchanged when B edits. | +| STOCK-04 | PASS | mixed A+B batch → 400 `Invalid SKU IDs: 159`. | +| STOCK-05 | PASS | variant OOS → only that variant; server blocks the OOS SKU order; restore works. | +| STOCK-06/09 | PASS | global `isSuspended` on a regional SKU → order **400**; kill-switch respected. | +| STOCK-07/08 | **FAIL (P0/P1)** | `admin.product.updateProduct {skus[].isSuspendedInRegion:true}` returns **200 but does not persist** (`isSuspendedInRegion` stays `false` on read-back) → regional suspension cannot be set; a "regionally suspended" item is still orderable. | +| STOCK-10 | PASS | offer flag set in A only; B unchanged. | +| STOCK-11 | INFO | `flashPrice:0`/`marketPrice:0` accepted and served as 0. | +| STOCK-12 | **FAIL** | negative (−5) and `1e308` prices accepted and served. | +| STOCK-13 | PASS/INFO | empty batch → 400; duplicate `skuId` in a batch → last wins. | +| STOCK-15 | **FAIL** | price update on a **soft-deleted** SKU → 200 (obsolete target not rejected). | +| STOCK-17 | PASS | price changed while "cart open" → order uses the **current** price (₹255 → ₹265). | +| STOCK-16/18/19/20 | NOT RUN | | +| SEC-16 | PASS | rejected mixed batch applied **no** partial write (sku29 unchanged). | + +## 29.6 Global products (elevation & market seeding) + +| Case | Status | Evidence | +|---|---|---| +| GP-01/02 | PASS | one structural global product with 2 SKUs; A and B each see their own market row (independent prices/flags). | +| GP-03 | PASS | superadmin structural update preserves SKU ids (no duplicates). | +| GP-04 | PASS | in-place global suspension edit — same SKU, no duplicate row. | +| GP-05 | PASS | adding a third SKU → 3 SKUs, existing overrides kept. | +| GP-06 | PASS | structural save left A/B market values untouched. | +| GP-07 | PASS | regional admin structural edit of a global product → 400; name unchanged. | +| GP-11 | PASS | global product pointed at a **regional** store → 500 "A global product must use a global store". | +| GP-12 | PASS | `superadmin.products.elevate` of the region-2 product → 200, SKU id preserved, `regionId:null`. | +| GP-13 | PASS | elevate already-global / missing / foreign-store → all 400. | +| GP-14 | PASS | anon/customer/staff elevation → 401. | +| GP-17 | PASS | update with a missing product id → 404. | +| GP-09/10/15/16/18/19/20/21 | NOT RUN | New-region seeding after global exists, missing market row, tag/group associations, soft-delete with orders, concurrency, failure injection, UI draft bleed. | + +## 29.7 Cache publication + +| Case | Status | Evidence | +|---|---|---| +| CACHE-04 | PASS | after a price write, region **A** `availability_version_num` 43→44; region **B** unchanged (9). | +| CACHE-23/JOB-15 | PASS | a region-A cache request did **not** advance region B's version. | +| CACHE-05 / CUSTOMER-17 | PASS | region-A `products.json` (158 items) contains **no** region-2-only SKU. | +| CACHE-06 | PASS (INFO) | region-B `products.json` (4 items) contains no A-only SKU. | +| CACHE-07/08 | PASS | slots cache `…/regions/1/slots/v-22/slots.json` → 200; availability `…/av-44/availability.json` → 200. Product cache needs the `apiCacheKey` segment; slots/availability do not. | +| CACHE-09..22 | NOT RUN | Bounded publication deadline, KV/DB convergence, force-failure paths, tag/const-affecting regeneration. | + +## 29.8 Coupon application & management (remainder) + +| Case | Status | Evidence | +|---|---|---| +| CPA-05 | PASS | 50% targeted sku24 in a ₹235+₹300 cart → disc **118** (only the target line). | +| CPA-08 | PASS | target ₹29 exactly at `minOrder` → disc 3. | +| CPA-14 | PASS | overlapping targeted coupons on a split order → **no negative sub-order**; discs 156/162. | +| CPA-15 | PASS | two flat ₹900 on ₹235 → disc clamped to 235, total ₹20. | +| CPA-16 | PASS | coupon targeting only OOS/suspended SKUs → no eligible target, rejected. | +| CPA-18 | PASS | `maxLimitForUser:1` → 2nd order rejected and the coupon leaves `getEligible`. | +| CPA-19 | PASS | concurrent one-use coupon → one 200 + one rejection (no overuse). | +| CPA-20 | PASS | first-order coupon works on order 1, rejected on order 2. | +| CPA-22 | PASS | stored discount unchanged after the coupon is edited. | +| CPA-24 | PASS | expired coupon rejected at spend and hidden from the list. | +| CPA-25 | **FAIL (minor)** | `getEligible {regionId: 99999}` → 200 with the full coupon list (no region validation); `-1` → 400. | +| CPA-28 | PASS | targeted `minOrder 400`: qty 2 accepted, qty 1 rejected. | +| CPA-02/11/23/26/27 | NOT RUN | | +| CPM-05 | PASS | multi-code batch created 2 coupons. | +| CPM-07 | PASS | duplicate code → rejected. | +| CPM-12 | PASS | clearing `skuIds` on edit → whole-cart. | +| CPM-13 | INFO | `maxValue:0`/`minOrder:0` accepted; order still discounted. | +| CPM-14 | INFO | past and future `validTill` both accepted at creation; eligibility enforced at spend. | +| CPM-16 | PASS | invalidating a used coupon blocks new spend; the old order's discount is unchanged. | +| CPM-18 | PASS | concurrent duplicate create → one 200, one rejection. | +| CPM-19/20 | NOT RUN | Audit attribution / picker UI. | +| RESERVED-04 | PASS | expired reserved secret → rejected at claim. | +| RESERVED-05 | PASS | invalid secret → 400. | +| RESERVED-06 | PASS | redeemed coupon copies fields (20% / minOrder 100 / user-based / region 1). | +| RESERVED-07 | PASS | the reserved secret is not visible to another user. | +| RESERVED-08..18 | NOT RUN | | + +## 29.9 Products with availability states (cart guard / OOS) + +| Case | Status | Evidence | +|---|---|---| +| CART-08 (OOS) | PASS | ordering the OOS SKU → 400 "Product … is unavailable". | +| CART-08 (soft-deleted) | PASS | ordering the soft-deleted SKU → 400. | +| CART-08 (regionally suspended) | **FAIL** | the regionally-suspended SKU was **orderable** (root cause: STOCK-07/08 persistence bug). | +| CACHE/CATALOG isolation | PASS | UI search for a region-2-only product while browsing region 1 → **"No products found"** — CUSTOMER-17 **not reproduced**. | + +## 29.10 Flash delivery (enabled path) + +| Case | Status | Evidence | +|---|---|---| +| FLASH-02 | PASS | enabling `isFlashDeliveryEnabled` on bound 1 → served `true`, flash fee ₹69. | +| FLASH-03 | PASS | flash order with `slotId:null` → 200, total 124 (80 goods + 69 flash fee). | +| FLASH-04 | **FAIL** | a **non-flash-available** SKU was accepted into a flash order (no per-item flash validation). | +| FLASH-05 | INFO | flash with a scheduled slot still succeeds. | +| FLASH-06/07/08 | PASS (UI) | Flash tab available ("Delivery in within 1 hour"); add shows the **pink flash cart** (₹233, "₹267 more for FREE Delivery" = ₹500 flash threshold), separate from the blue regular cart. | +| FLASH-09..16 | NOT RUN | Flash cron toggle, flash pricing per item, flash cart checkout, capacity. | + +## 29.11 Complaints, customer ops, uploads, staff, profile (remainder) + +| Case | Status | Evidence | +|---|---|---| +| COMPLAINT-06 | PASS | complaint with `imageUrls` → 200. | +| COMPLAINT-07 | PASS | complaint with no `orderId` → 200. | +| COMPLAINT-08 | PASS | empty body → 400. | +| COMPLAINT-09 | PASS | paginated admin list (limit 3 → cursor 108 → no overlap). | +| COMPLAINT-10 | **FAIL** | resolving an **already-resolved** complaint → 200 and the stored **response is overwritten**. | +| COMPLAINT-11 | INFO | ` ` is accepted (200) and returned **verbatim** by the customer read API with no server-side sanitisation. RN `MyText` renders it inert; any HTML renderer must escape. | +| SUPPORT-14 | P1 | **FAIL** | Submitting the identical complaint twice (a simulated network retry) → 200/200 and **two rows** with the same body: no idempotency key, so a retry duplicates the complaint. | +| CUSTOMER-10 | P1 | **PARTIAL** | Profile edit → 200, incidents read → 200; but `admin.user.getUserDetails(388)` (a user with 204 orders) → **500 "Failed query: select \"id\" from \"orders\" …"** — the same failure as defect **#17**. | +| CUSTOMER-16 | P2 | **PASS** | Customer search by mobile → 200 with id/name/mobile/totalOrders/lastOrderDate, no spinner/timeout at the API level. Mobile-copy/UI text-scale are client concerns. | +| CART-14 | P1 | **PARTIAL** | After product delete: ordering its SKU → 400 "Product … is unavailable" (no phantom purchase), but `admin.product.getProductById` still returns the deleted product with **200**. | +| CART-15 | P1 | **PARTIAL** | No cart API exists server-side (the cart is a local client store); a slow price refresh can only be exercised on the device — deferred. | +| CLS-03 | P0 | **PASS (payload)** | A region-2 coupon is returned to a region-1 customer (`regionId:2`) so the sheet can render "Not valid in your region"; U1's list spans regions 1 and 2. | +| CLS-04 | P0 | **PASS (payload)** | First-order-only coupon returned with `isFirstOrderOnly:true`; U1 (204 orders) sees 2 such coupons — the sheet must disable them. | +| CLS-05 | P1 | **PASS (payload)** | `minOrder:99999` coupon returned with `minOrder` intact, so the shortfall text is computable. | +| CLS-06 | P1 | **PASS (payload)** | SKU-targeted coupon (targets sku 21) returned with `skuIds:[21]`; a coupon targeting a non-existent SKU is refused at create time (500 "Invalid SKU IDs: 999999"). | +| CLS-02 | P0 | _pending (device sheet)_ | — | +| CPA-26 | P1 | **PASS** | U2's coupon payload contains **0** coupons targeted at U1; U2's own personal coupons (id list) are the only personal ones returned. (`getEligible` intentionally returns other-region coupons so the UI can disable them — this is the payload contract, not leakage.) | + +#### Verdict tallies for phases 1–4 +PASS 38 · FAIL 12 · PARTIAL 10 · pending/blocked 15 (per-case list in the tables above). + +**New defects opened this run** +- **#62 (P2)** — assigning a global product to a regional store returns 200 while nothing changes. +- **#63 (P1)** — `admin.order.getAll` `packagedFilter:'not_packaged'` returns no rows for orders whose `is_packaged` is not `true`; the orders fall out of both packaged filters. + +**Confirmed (still open) from the previous register:** #1 (STAFF-08 user→admin read), #8 (business rejections as 500 + stack traces — hit by COMBO-06/12, VENDOR-09, CPA-21, cancel), #9 (TAG-13 foreign tagsOrder ids), #12-ish (double cancel not exercised), #17 (CUSTOMER-10 `getUserDetails` 500), #20 (COMBO-07 self-reference), #27 revised→ **cache publication does converge (~43 s) with a version bump**, so the earlier "structural changes are not published" finding did not reproduce in this build for product create; #31 (COMBO-15 unbounded text), #46 (ORDER-15 duplicate orders). diff --git a/docs/test reports/pending-test-cases-2026-10-18.md b/docs/test reports/pending-test-cases-2026-10-18.md new file mode 100644 index 0000000..ec17c35 --- /dev/null +++ b/docs/test reports/pending-test-cases-2026-10-18.md @@ -0,0 +1,410 @@ +# Pending Test Cases — Freshyo Full Regression (Run FR-2026-10-18-01) + +**Generated from** `docs/test reports/full-regression-2026-10-18.md` (results so far) against the catalogue in +`docs/test-cases/*.md` (45 files, **855 cases**). + +**How this list was derived (reproducible, script-based).** Every case id in the catalogue was extracted from the +`| ID | P | title | criteria |` tables and matched against every id that appears anywhere in the results report. An id +that **never appears in the report** is treated as pending. Ids that appear but were recorded as `SKIPPED`, +`PARTIAL`, `BLOCKED` or re-opened are listed in §2/§3 from the narrative. + +| Bucket | Count | +|---|---| +| Catalogue (all cases) | **855** | +| Appear in the results report | 714 | +| **Never appear in the report (pending)** | **141** | +| of which excluded by owner instruction | 53 | +| of which runnable when next picked up | 88 | + +**Results so far:** 855 catalogued · 60 `SKIPPED` · ~736 executed (~92%) · **61 defects** (defect 35 withdrawn; +56–61 open). Per-case evidence for everything executed is in `docs/test reports/full-regression-2026-10-18.md`. + +> Caveat: "appears in the report" includes ids mentioned only in a `SKIPPED`/blocked narrative. If a case was folded +> into an aggregate sentence in §1–§55 without its id, it will not be counted as pending here — re-check before +> re-running a group. Criteria for every id live in its source file (last column below). + +--- + +## 1. Excluded by owner instruction + +Owner instruction: *"don't do anything related to OTP or Notifications, skip those"*; queue/scheduled-job cases and +fallback/legacy UI were also parked. Cases are **retained in the catalogue** and marked `SKIPPED` in the report — they +are listed here only so nothing is silently dropped. + +### 1.1 OTP/one-time-code flows — excluded by owner instruction (15) + +Source: `docs/test-cases/otp-authentication.md` + +| ID | P | Case | Note | +|---|---|---|---| +| OTP-03 | P0 | Existing password account verifies same mobile. | Excluded by owner instruction — retained, marked SKIPPED. | +| OTP-04 | P0 | Wrong/empty/malformed OTP, no prior send or expired credentials. | Excluded by owner instruction — retained, marked SKIPPED. | +| OTP-05 | P0 | OTP for mobile A submitted with mobile B. | Excluded by owner instruction — retained, marked SKIPPED. | +| OTP-06 | P0 | Reuse successful code/verification ID. | Excluded by owner instruction — retained, marked SKIPPED. | +| OTP-10 | P0 | Bounded abuse/rate-limit checks in isolated adapter. | Excluded by owner instruction — retained, marked SKIPPED. | +| OTP-13 | P0 | Verification returns token/cookie/logs. | Excluded by owner instruction — retained, marked SKIPPED. | +| OTP-01 | P1 | Approved test mobile requests code then verifies provider-valid code. | Excluded by owner instruction — retained, marked SKIPPED. | +| OTP-02 | P1 | Verify approved new mobile without pre-existing account. | Excluded by owner instruction — retained, marked SKIPPED. | +| OTP-07 | P1 | Resend code before verifying previous code. | Excluded by owner instruction — retained, marked SKIPPED. | +| OTP-08 | P1 | Expiry exact boundary and client clock skew. | Excluded by owner instruction — retained, marked SKIPPED. | +| OTP-09 | P1 | Invalid phone length/prefix/country format/whitespace. | Excluded by owner instruction — retained, marked SKIPPED. | +| OTP-11 | P1 | Provider timeout/error on send or verify. | Excluded by owner instruction — retained, marked SKIPPED. | +| OTP-12 | P1 | Concurrent valid verifies for same new mobile. | Excluded by owner instruction — retained, marked SKIPPED. | +| OTP-14 | P1 | Suspended/deleted-account mobile uses OTP. | Excluded by owner instruction — retained, marked SKIPPED. | +| OTP-15 | P2 | UI requests resend/verification then background/back/offline retry. | Excluded by owner instruction — retained, marked SKIPPED. | + +### 1.2 Push notifications — excluded by owner instruction (17) + +Source: `docs/test-cases/notifications.md` + +| ID | P | Case | Note | +|---|---|---|---| +| PUSH-03 | P0 | Logout U1, login U2 on same device. | Excluded by owner instruction — retained, marked SKIPPED. | +| PUSH-05 | P0 | Send targeted message to approved U1 fixture. | Excluded by owner instruction — retained, marked SKIPPED. | +| PUSH-06 | P0 | B staff submits A/private target IDs or customer calls send API. | Excluded by owner instruction — retained, marked SKIPPED. | +| PUSH-09 | P0 | Notification with private order/complaint link clicked by wrong account. | Excluded by owner instruction — retained, marked SKIPPED. | +| PUSH-16 | P0 | Sensitive payloads/logs, admin/internal notes. | Excluded by owner instruction — retained, marked SKIPPED. | +| PUSH-02 | P1 | Same token repeated or refreshed token/new device. | Excluded by owner instruction — retained, marked SKIPPED. | +| PUSH-04 | P1 | Register staff token, trigger authorized test order notification. | Excluded by owner instruction — retained, marked SKIPPED. | +| PUSH-07 | P1 | Missing/invalid/expired token and empty title/body. | Excluded by owner instruction — retained, marked SKIPPED. | +| PUSH-08 | P1 | Duplicate user/token IDs, many supported recipients. | Excluded by owner instruction — retained, marked SKIPPED. | +| PUSH-10 | P1 | Cold/background/foreground tap on supported deep link. | Excluded by owner instruction — retained, marked SKIPPED. | +| PUSH-11 | P1 | Invalid/deleted target route or unsupported link scheme. | Excluded by owner instruction — retained, marked SKIPPED. | +| PUSH-12 | P1 | Order/cancel/complaint queue event retried. | Excluded by owner instruction — retained, marked SKIPPED. | +| PUSH-13 | P1 | Provider timeout/token invalidation. | Excluded by owner instruction — retained, marked SKIPPED. | +| PUSH-14 | P1 | Notifications denied/OS token unavailable. | Excluded by owner instruction — retained, marked SKIPPED. | +| PUSH-17 | P1 | Staff deleted/reassigned after token registration. | Excluded by owner instruction — retained, marked SKIPPED. | +| PUSH-18 | P1 | Scheduled/event send delayed past cancellation/deletion. | Excluded by owner instruction — retained, marked SKIPPED. | +| PUSH-15 | P2 | Physical-device receipt vs emulator queue acceptance. | Excluded by owner instruction — retained, marked SKIPPED. | + +### 1.3 scheduled/queue jobs — excluded by owner instruction (8) + +Source: `docs/test-cases/jobs-health.md` + +| ID | P | Case | Note | +|---|---|---|---| +| JOB-04 | P1 | New write during existing generation. | Excluded by owner instruction — retained, marked SKIPPED. | +| JOB-05 | P1 | Flash enable/disable at intended regional schedule boundaries. | Excluded by owner instruction — retained, marked SKIPPED. | +| JOB-06 | P1 | Midnight/IST/UTC crossover and delayed scheduler tick. | Excluded by owner instruction — retained, marked SKIPPED. | +| JOB-07 | P1 | Retry same queue event or duplicate scheduler invocation. | Excluded by owner instruction — retained, marked SKIPPED. | +| JOB-08 | P1 | DB/KV/storage/provider unavailable during job. | Excluded by owner instruction — retained, marked SKIPPED. | +| JOB-09 | P1 | Job interrupted/restarted midway. | Excluded by owner instruction — retained, marked SKIPPED. | +| JOB-13 | P1 | Regional versions and in-memory store freshness after initialization. | Excluded by owner instruction — retained, marked SKIPPED. | +| JOB-14 | P2 | Logs/alerts on permanent failure. | Excluded by owner instruction — retained, marked SKIPPED. | + +### 1.4 fallback/legacy UI — excluded by owner instruction (low priority) (13) + +Source: `docs/test-cases/fallback-legacy-pages.md` + +| ID | P | Case | Note | +|---|---|---|---| +| LEGACY-02 | P0 | Anonymous/customer visits operational user/order/super-admin routes. | Excluded by owner instruction — retained, marked SKIPPED. | +| LEGACY-03 | P0 | User/order detail with guessed foreign IDs. | Excluded by owner instruction — retained, marked SKIPPED. | +| LEGACY-06 | P0 | Standalone coupon creation from staff A vs customer/B/global attempt. | Excluded by owner instruction — retained, marked SKIPPED. | +| LEGACY-12 | P0 | API environment/base URL in standalone deployment. | Excluded by owner instruction — retained, marked SKIPPED. | +| LEGACY-04 | P1 | Supported location marker saves intended order/address coords. | Excluded by owner instruction — retained, marked SKIPPED. | +| LEGACY-05 | P1 | Missing/malformed marker params/coords and permission denied. | Excluded by owner instruction — retained, marked SKIPPED. | +| LEGACY-07 | P1 | User-connect flow with approved identity/link. | Excluded by owner instruction — retained, marked SKIPPED. | +| LEGACY-08 | P1 | Vendor page expired/permanent/missing snippet. | Excluded by owner instruction — retained, marked SKIPPED. | +| LEGACY-10 | P1 | Browser refresh/back/cold direct route. | Excluded by owner instruction — retained, marked SKIPPED. | +| LEGACY-11 | P1 | Active backend endpoint changed since legacy UI shipped. | Excluded by owner instruction — retained, marked SKIPPED. | +| LEGACY-13 | P1 | Network/asset error, corrupt local state. | Excluded by owner instruction — retained, marked SKIPPED. | +| LEGACY-09 | P2 | Inauguration/demo promotional page. | Excluded by owner instruction — retained, marked SKIPPED. | +| LEGACY-14 | P2 | Mobile browser keyboard/safe-area/maps and desktop layout. | Excluded by owner instruction — retained, marked SKIPPED. | + +--- + +## 2. Open / partial results that need another pass + +These **do** appear in the report, but were recorded as `PARTIAL`, `RE-VERIFY`, `BLOCKED` or `N/A`, or rest on +structural-only evidence. Their ids are therefore also absent from §3. + +| ID | P | What is needed | +|---|---|---| +| CLS-02 | P0 | RE-VERIFY: defect 35 withdrawn (viewport-only screen dump); needs the coupon sheet scrolled past the first viewport. *(Inspect a disabled row.)* | +| CLS-03 | P0 | RE-VERIFY: defect 35 withdrawn — as CLS-02. *(Coupon scoped to another region.)* | +| CLS-04 | P0 | RE-VERIFY: defect 35 withdrawn — as CLS-02. *(First-order-only coupon, customer already ordered.)* | +| CLS-05 | P1 | RE-VERIFY: defect 35 withdrawn — as CLS-02. *(`minOrder` above cart subtotal.)* | +| CLS-06 | P1 | RE-VERIFY: defect 35 withdrawn — as CLS-02. *(Targeted coupon matching no cart items.)* | +| SAUTH-10 | P1 | Blocked: correct `admin.staffUser.login` input shape unresolved (my attempts returned 400). *(Slow/double login, logout during pending request.)* | +| SAUTH-15 | P1 | Blocked: needs admin-web running (not started in this environment). *(Admin-web reload on a region-scoped screen, specifically Vendor Snippets.)* | +| UX-15 | P1 | Blocked: in-app update prompt cannot appear inside Expo Go (needs a dev/prod build). *(App build older/newer than supported version policy.)* | +| UX-20 | P2 | Blocked: admin parity needs admin-web; flash parity on web/Android not driven. *(Run same critical flow native/web/admin native/admin-web.)* | +| ADDR-23 | P2 | Blocked: needs device — `BottomDialog` delete-error/keyboard/scroll; component has since moved to `RawBottomDialog`. *(BottomDialog deletion error, keyboard/scroll, readonly checkout address.)* | +| ADDR-25 | P1 | Blocked: OTP-gated (excluded by owner instruction). *(Signed-out user drafts an address, then logs in/registers.)* | +| CART-17 | P1 | Blocked: OTP-gated (excluded by owner instruction). *(Logout/login U2 with U1 cart.)* | +| CART-21 | P0 | Blocked: OTP-gated (excluded by owner instruction). *(Network unavailable; attempt submit from cached cart.)* | +| LOC-07 | P0 | Partial: structural PASS recorded; a literal request-generation-counter proof needs network throttling. *(Rapid A→B→A with delayed catalog responses.)* | +| LOC-10 | P1 | Partial: needs device re-run with a controllable in-flight request. *(U1 A/B addresses; default B while browsing A.)* | +| LOC-18 | P0 | Recorded FAIL on structural evidence; the device interleaving itself was not driven. *(Change region while submit request is pending.)* | +| ADDR-16 | P0 | Partial: needs device re-run. *(Foreign default address when browsing A.)* | +| CACHE-09 | P1 | Partial: direct discovery-KV blob deletion not performed; verdict rests on code path + the live CFG-14 result. *(Missing/corrupt discovery KV in approved fixture.)* | +| FLASH-11 | P1 | Partial: the clock/midnight/timezone half needs the excluded scheduled-job harness. *(Exact schedule boundary/midnight/timezone change.)* | +| CGRD-03 | P0 | Partial: recorded PARTIAL in §40 — needs device re-run of the blocked path. *(Item whose selected slot's freeze time has passed.)* | +| CGRD-05 | P1 | Partial: recorded PARTIAL in §40 — needs device re-run of the blocked path. *(Out-of-stock item present.)* | +| CGRD-06 | P1 | Partial: recorded PARTIAL in §40 — needs device re-run of the blocked path. *(Flash-delivery cart.)* | +| STORE-15 | P1 | Half verified: the persistence half is recorded **PASS** (report §50, *"A successful store mutation is persisted and immediately readable"*); the **cache/upload-cleanup-failure** half is not yet verified. *(Successful mutation followed by cache/upload-cleanup failure.)* | +| EDIT-14 | P0 | Policy case — owner decision required (recorded as POLICY in the report). *(Lower new goods below historic discount.)* | +| ORDER-22 | P2 | N/A by specification. *(Open a historical pre-migration order whose stored total already included a coupon discount.)* | +| SEC-24 | P1 | Blocked: needs a rate-limit/throttle harness (no request-flood tooling in this run). *(Repeated auth/code requests in approved bounded harness.)* | +| USR-01 | P1 | Blocked: `create-user` harness needs `bcryptjs`, not installed for the Bun/tsx runner. *(`bun run create-user -- --mobile --password

[--name --email]`.)* | + +--- + +## 3. Pending — runnable when next picked up (88) + +Grouped by source file; `P0` first. Every one of these has no blocker recorded in the report. + +### addresses.md (1) + +| ID | P | Case | Note | +|---|---|---|---| +| ADDR-11 | P1 | Deny location, invalid map link/coordinates or outside service. | Not reached in this run — no blocker recorded. | + +### banners.md (4) + +| ID | P | Case | Note | +|---|---|---|---| +| BANNER-10 | P1 | Delete image cleanup fails. | Not reached in this run — no blocker recorded. | +| BANNER-12 | P1 | Save timeout/double create/concurrent reorder. | Not reached in this run — no blocker recorded. | +| BANNER-14 | P1 | A/B edits within same publication window. | Not reached in this run — no blocker recorded. | +| BANNER-13 | P2 | Carousel swipe, autoplay if supported, orientation/text scale. | Not reached in this run — no blocker recorded. | + +### cache-publication.md (2) + +| ID | P | Case | Note | +|---|---|---|---| +| CACHE-19 | P1 | Concurrent version increments in A. | Not reached in this run — no blocker recorded. | +| CACHE-22 | P1 | Deleted/deactivated region metadata or bound priority change. | Not reached in this run — no blocker recorded. | + +### cancellation.md (5) + +| ID | P | Case | Note | +|---|---|---|---| +| CANCEL-08 | P0 | Multiple coupons on fully cancelled group. | Not reached in this run — no blocker recorded. | +| CANCEL-12 | P0 | Cancellation races packaging/delivery. | Not reached in this run — no blocker recorded. | +| CANCEL-16 | P1 | Notification/Telegram fails after cancellation saved. | Not reached in this run — no blocker recorded. | +| CANCEL-17 | P1 | Cart after cancellation. | Not reached in this run — no blocker recorded. | +| CANCEL-18 | P2 | Cancel confirmation/back/error dialog. | Not reached in this run — no blocker recorded. | + +### cart.md (3) + +| ID | P | Case | Note | +|---|---|---|---| +| CART-02 | P1 | Add same SKU again vs explicit Update Item. | Not reached in this run — no blocker recorded. | +| CART-14 | P1 | Catalog ID missing after product deletion or region switch. | Not reached in this run — no blocker recorded. | +| CART-15 | P1 | Slow price refresh while cart visible. | Not reached in this run — no blocker recorded. | + +### catalog-search.md (4) + +| ID | P | Case | Note | +|---|---|---|---| +| CAT-08 | P1 | Multi-SKU product detail; select each variant and quantity. | Not reached in this run — no blocker recorded. | +| CAT-09 | P1 | Missing MRP/image/description/slot; zero data sets. | Not reached in this run — no blocker recorded. | +| CAT-17 | P1 | Available product loses all valid slots. | Not reached in this run — no blocker recorded. | +| CAT-15 | P2 | Missing/deleted product direct URL, browser back/reload. | Not reached in this run — no blocker recorded. | + +### combos.md (8) + +| ID | P | Case | Note | +|---|---|---|---| +| COMBO-12 | P0 | Coupon targets combo SKU vs component SKU only. | Not reached in this run — no blocker recorded. | +| COMBO-03 | P1 | Component marked combo-only. | Not reached in this run — no blocker recorded. | +| COMBO-10 | P1 | Attempt suspend component of active combo. | Not reached in this run — no blocker recorded. | +| COMBO-11 | P1 | Component regular-only but combo flash-enabled. | Not reached in this run — no blocker recorded. | +| COMBO-13 | P1 | Global combo shown in A/B with regional prices. | Not reached in this run — no blocker recorded. | +| COMBO-14 | P1 | Component product rename/delete after historical combo order. | Not reached in this run — no blocker recorded. | +| COMBO-15 | P1 | Long/missing features and missing component image. | Not reached in this run — no blocker recorded. | +| COMBO-16 | P1 | Save fails during component writes, retry. | Not reached in this run — no blocker recorded. | + +### complaints.md (2) + +| ID | P | Case | Note | +|---|---|---|---| +| SUPPORT-14 | P1 | Network loss during create/resolve, retry after checking state. | Not reached in this run — no blocker recorded. | +| SUPPORT-15 | P2 | Photos slow/broken, multiline response/text scale. | Not reached in this run — no blocker recorded. | + +### coupon-application.md (3) + +| ID | P | Case | Note | +|---|---|---|---| +| CPA-21 | P1 | Cancel only one sibling vs every sibling, then first-order/usage retry. | Not reached in this run — no blocker recorded. | +| CPA-26 | P1 | Coupon query fails, relogin U2, region changes. | Not reached in this run — no blocker recorded. | +| CPA-27 | P1 | Small target contribution rounds below minor unit. | Not reached in this run — no blocker recorded. | + +### coupon-stacking-and-cart-guards.md (5) + +| ID | P | Case | Note | +|---|---|---|---| +| USR-02 | P1 | Repeat without `--update`. | Blocked: same `bcryptjs`/`create-user` harness gap. | +| USR-03 | P1 | Repeat with `--update`. | Blocked: same `bcryptjs`/`create-user` harness gap. | +| USR-06 | P1 | Inspect the stored hash. | Blocked: same `bcryptjs`/`create-user` harness gap. | +| USR-04 | P2 | `--show-sql`. | Blocked: same `bcryptjs`/`create-user` harness gap. | +| USR-05 | P2 | `--remote`. | Blocked: same `bcryptjs`/`create-user` harness gap. | + +### customer-management-incidents.md (2) + +| ID | P | Case | Note | +|---|---|---|---| +| CUSTOMER-10 | P1 | User profile edited/soft-deleted after incident/order. | Not reached in this run — no blocker recorded. | +| CUSTOMER-16 | P2 | Search slow/error, large details/history, mobile number copy/link. | Not reached in this run — no blocker recorded. | + +### delivery-operations.md (2) + +| ID | P | Case | Note | +|---|---|---|---| +| DELIVERY-12 | P1 | Concurrent reorder/update and network failure. | Not reached in this run — no blocker recorded. | +| DELIVERY-13 | P2 | Map load failure, offline tiles, zoom/resize/back. | Not reached in this run — no blocker recorded. | + +### fulfillment.md (5) + +| ID | P | Case | Note | +|---|---|---|---| +| FUL-10 | P1 | Two admins toggle same item; cancel races with delivery. | Not reached in this run — no blocker recorded. | +| FUL-12 | P1 | Status filters/pagination change after action. | Not reached in this run — no blocker recorded. | +| FUL-13 | P1 | Mutation error, offline or timeout after commit. | Not reached in this run — no blocker recorded. | +| FUL-15 | P1 | Delivery timestamp around midnight. | Not reached in this run — no blocker recorded. | +| FUL-16 | P2 | Large order list, item switches, keyboard/dialog overlays. | Not reached in this run — no blocker recorded. | + +### global-products.md (3) + +| ID | P | Case | Note | +|---|---|---|---| +| GP-02 | P0 | Set different A/B prices, flash/stock/offer flags. | Not reached in this run — no blocker recorded. | +| GP-21 | P1 | Open global-product Create, type a draft, click Edit on another product, then click Create again. | Not reached in this run — no blocker recorded. | +| GP-20 | P2 | Regional readonly badge/details and superadmin image picker. | Not reached in this run — no blocker recorded. | + +### global-stores.md (7) + +| ID | P | Case | Note | +|---|---|---|---| +| GSTORE-06 | P0 | Assign global product to regional store. | Not reached in this run — no blocker recorded. | +| GSTORE-05 | P1 | Global store with no products, one global product, many variants. | Not reached in this run — no blocker recorded. | +| GSTORE-09 | P1 | Delete unused store then requery A/B. | Not reached in this run — no blocker recorded. | +| GSTORE-10 | P1 | Region created after global store. | Not reached in this run — no blocker recorded. | +| GSTORE-11 | P1 | Image URL already normalized vs asset key. | Not reached in this run — no blocker recorded. | +| GSTORE-12 | P1 | Concurrent edit/delete or upload failure. | Not reached in this run — no blocker recorded. | +| GSTORE-13 | P2 | Global badge/read-only affordance in regional UI. | Not reached in this run — no blocker recorded. | + +### location-region-switching.md (3) + +| ID | P | Case | Note | +|---|---|---|---| +| LOC-15 | P1 | Force-quit during confirmed switch/state clearing. | Not reached in this run — no blocker recorded. | +| LOC-16 | P1 | Resolve request offline/timeout, then restore network. | Not reached in this run — no blocker recorded. | +| LOC-14 | P2 | Browser refresh/SSR/private-mode. | Not reached in this run — no blocker recorded. | + +### order-edits-rebalance.md (1) + +| ID | P | Case | Note | +|---|---|---|---| +| EDIT-18 | P2 | Notes/rebalance confirmation cancel and reopen detail. | Not reached in this run — no blocker recorded. | + +### orders.md (2) + +| ID | P | Case | Note | +|---|---|---|---| +| ORDER-15 | P1 | Queue/Telegram/push fails after persistence. | Not reached in this run — no blocker recorded. | +| ORDER-20 | P2 | Native/browser deep links/back/reload to success/detail. | Not reached in this run — no blocker recorded. | + +### prices-stock-suspension.md (5) + +| ID | P | Case | Note | +|---|---|---|---| +| STOCK-08 | P0 | Reopen suspended global SKU, edit price only, save. | Not reached in this run — no blocker recorded. | +| STOCK-14 | P0 | Anonymous/customer/A admin supplies unauthorized SKU. | Not reached in this run — no blocker recorded. | +| STOCK-09 | P1 | Globally suspended SKU opened by regional admin. | Not reached in this run — no blocker recorded. | +| STOCK-19 | P1 | Stock/availability publication fails or delayed. | Not reached in this run — no blocker recorded. | +| STOCK-20 | P2 | Stock dialog cancel, scrolling variants, rapid taps. | Not reached in this run — no blocker recorded. | + +### pricing-delivery-fees.md (1) + +| ID | P | Case | Note | +|---|---|---|---| +| MONEY-08 | P1 | Equal-goods slots and reverse insertion order. | Not reached in this run — no blocker recorded. | + +### product-groups.md (1) + +| ID | P | Case | Note | +|---|---|---|---| +| GROUP-08 | P1 | Edit membership after slots reference the group. | Not reached in this run — no blocker recorded. | + +### product-tags-ordering.md (3) + +| ID | P | Case | Note | +|---|---|---|---| +| TAG-13 | P1 | Save order after some products deleted. | Not reached in this run — no blocker recorded. | +| TAG-14 | P1 | Rapid A/B tag edits; customer fresh/open sessions. | Not reached in this run — no blocker recorded. | +| TAG-15 | P2 | Drag reorder on native/web; scroll, cancel and reload. | Not reached in this run — no blocker recorded. | + +### regional-products.md (3) + +| ID | P | Case | Note | +|---|---|---|---| +| PROD-12 | P1 | Re-send owned image keys; change only one variant's image. | Not reached in this run — no blocker recorded. | +| PROD-14 | P1 | Duplicate SKU/feature IDs in payload; repeated component entry. | Not reached in this run — no blocker recorded. | +| PROD-15 | P1 | Cancel form, then reopen existing product. | Not reached in this run — no blocker recorded. | + +### regional-stores.md (2) + +| ID | P | Case | Note | +|---|---|---|---| +| STORE-11 | P1 | Large product list with deleted/hidden variants. | Not reached in this run — no blocker recorded. | +| STORE-14 | P2 | Deep link unknown/deleted store, refresh/back. | Not reached in this run — no blocker recorded. | + +### reserved-coupons.md (2) + +| ID | P | Case | Note | +|---|---|---|---| +| RES-15 | P1 | Repeat generation or concurrent admin requests. | Not reached in this run — no blocker recorded. | +| RES-16 | P1 | Cancel generated coupon use then fully cancel its order group. | Not reached in this run — no blocker recorded. | + +### reviews.md (1) + +| ID | P | Case | Note | +|---|---|---|---| +| REVIEW-10 | P1 | Text contains HTML/script/links. | Not reached in this run — no blocker recorded. | + +### scheduled-slots.md (4) + +| ID | P | Case | Note | +|---|---|---|---| +| SLOT-08 | P0 | Regular order sends null slot; flash order supplies arbitrary slots. | Not reached in this run — no blocker recorded. | +| SLOT-20 | P0 | Customer/anonymous/B admin attempts A slot mutation. | Not reached in this run — no blocker recorded. | +| SLOT-13 | P1 | Selected S1 removed/closed while S2 valid. | Not reached in this run — no blocker recorded. | +| SLOT-17 | P1 | Empty slot and slot with only hidden/deleted SKUs. | Not reached in this run — no blocker recorded. | + +### staff-management.md (1) + +| ID | P | Case | Note | +|---|---|---|---| +| STAFF-08 | P0 | Anonymous/customer calls staff CRUD or role mutation. | Not reached in this run — no blocker recorded. | + +### uploads-images.md (1) + +| ID | P | Case | Note | +|---|---|---|---| +| UPLOAD-18 | P1 | Public fetch caching after image replacement. | Not reached in this run — no blocker recorded. | + +### vendor-snippets.md (2) + +| ID | P | Case | Note | +|---|---|---|---| +| VENDOR-09 | P1 | Duplicate/empty SKUs, duplicate code and invalid expiry. | Not reached in this run — no blocker recorded. | +| VENDOR-13 | P1 | Packaging races admin cancellation/delivery. | Not reached in this run — no blocker recorded. | + +--- + +## 4. Resume instructions + +* **Results file:** `docs/test reports/full-regression-2026-10-18.md` (Run ID `FR-2026-10-18-01`) — append a new + numbered section; keep the tally line updated at the end. +* **Catalogue:** `docs/test-cases/*.md` — never delete a case; mark it `SKIPPED`/`PARTIAL` instead. +* **Environment:** backend `http://localhost:8787` (wrangler dev — do **not** restart), user-ui Metro `:8081`, + admin-ui Metro `:8082`, web `:4174`, superadmin `:4176`; admin-web and `apps/fallback-ui` are **not** running. + iOS simulator `5A64695E-F4D4-4E2E-90F3-EC3493A2B457`; Maestro app id `host.exp.Exponent`. +* **Harness:** `/tmp/freshyo/` (`client.mjs`, `tokens.json`, `fixtures.json`, `phase*.mjs`, `results/*.json`). +* **Method warning (cost us defect 35):** `inspect_screen` returns only nodes **in the viewport** — always scroll to + the end (or confirm via the API) before concluding "the app does not show X". +* **Repo rules:** log every non-`.md`/`.txt` file change in `change-log.txt` **before** editing; never run drizzle + migrations or the test suite unless asked; no git operations. diff --git a/docs/test-cases/README.md b/docs/test-cases/README.md index 1a05d22..b0763ca 100644 --- a/docs/test-cases/README.md +++ b/docs/test-cases/README.md @@ -52,10 +52,23 @@ Use unique run prefixes. Do not delete regions for cleanup: region deletion is u | Purchasing | [Slots](scheduled-slots.md), [Cart](cart.md), [Addresses](addresses.md), [Checkout](checkout.md), [Pricing](pricing-delivery-fees.md), [Flash](flash-delivery.md) | | Coupons | [Administration](coupon-management.md), [Eligibility/stacking](coupon-application.md), [Stacking & cart guards](coupon-stacking-and-cart-guards.md), [Reserved/cancellation coupons](reserved-coupons.md) | | Order operations | [Placement/history](orders.md), [Fulfillment](fulfillment.md), [Cancellation](cancellation.md), [Edits/rebalance](order-edits-rebalance.md), [Delivery sequence/maps](delivery-operations.md) | -| Support | [Complaints](complaints.md), [Customer operations/incidents](customer-management-incidents.md), [Notifications](notifications.md) | -| Infrastructure | [Uploads](uploads-images.md), [Cache publication](cache-publication.md), [Jobs/health](jobs-health.md), [Security](authorization-api-contracts.md), [Recovery/platform/accessibility](recovery-platform-accessibility.md) | -| Conditional/legacy | [Vendor snippets](vendor-snippets.md), [Reviews](reviews.md), [Fallback/legacy pages](fallback-legacy-pages.md) | +| Support | [Complaints](complaints.md), [Customer operations/incidents](customer-management-incidents.md), [Notifications](notifications.md) **(EXCLUDED from automated run — see below)** | +| Infrastructure | [Uploads](uploads-images.md), [Cache publication](cache-publication.md), [Jobs/health](jobs-health.md) **(queue/scheduler cases EXCLUDED — see below)**, [Security](authorization-api-contracts.md), [Recovery/platform/accessibility](recovery-platform-accessibility.md) | +| Conditional/legacy | [Vendor snippets](vendor-snippets.md), [Reviews](reviews.md), [Fallback/legacy pages](fallback-legacy-pages.md) **(EXCLUDED — see below)** | | Approval-required provider integration | [OTP authentication](otp-authentication.md) (isolated provider sandbox only; excluded from default password regression) | +| Excluded from automated regression | [Notifications/push](notifications.md) (**skipped by owner instruction** for the 2026-10-18 run; cases retained, marked `SKIPPED`, never `PASS`/`FAIL`) | + +## Excluded checklists + +The following checklists are **not** executed by the automated harness and their cases are reported as `SKIPPED` +(not `PASS`/`FAIL`/`NOT RUN`): + +- [OTP authentication](otp-authentication.md) — needs an isolated SMS/OTP provider sandbox; excluded from the default password suite. +- [Notifications / push](notifications.md) — needs real push delivery to devices/recipients; **excluded by owner instruction** (2026-10-18). The cases are retained verbatim so they can be run manually in an isolated provider sandbox when explicitly authorised. +- Queue / scheduled-job cases in [Jobs/health](jobs-health.md) (`JOB-03`–`JOB-10`, `JOB-12`–`JOB-15`) — **excluded by owner instruction** (2026-10-18); no scheduler/queue harness is exercised automatically. The health/startup cases `JOB-01`, `JOB-02`, `JOB-11` remain in scope. +- [Fallback/legacy standalone pages](fallback-legacy-pages.md) (`LEGACY-01`–`LEGACY-14`) — **excluded by owner instruction** (2026-10-18); `apps/fallback-ui` is out of scope for this release cycle and is not started. + +`SKIPPED` is neither a pass nor a failure and must not be counted as coverage. ## Policy checkpoints diff --git a/docs/test-cases/fallback-legacy-pages.md b/docs/test-cases/fallback-legacy-pages.md index 6899b05..8052809 100644 --- a/docs/test-cases/fallback-legacy-pages.md +++ b/docs/test-cases/fallback-legacy-pages.md @@ -2,6 +2,11 @@ Scope inventory: fallback login, user-home/user-details/order-details, location-marker, user-connect, create-coupon, vendor-order-list, super-admin, inauguration, home/demo. Presence of a route does not imply supported release functionality. Validate active ownership with product/operations; unsupported/demo pages are N/A with reason, not PASS. +> **STATUS: EXCLUDED from the automated run (2026-10-18).** +> The fallback/legacy standalone app (`apps/fallback-ui`) is **out of scope for this release cycle** (low priority — +> owner instruction). This surface is not started, and its cases are reported as `SKIPPED` rather than +> `PASS`/`FAIL`/`NOT RUN`. The cases below are **retained unchanged** (nothing removed). + | ID | Priority | Action / input | Expected result | |---|---|---|---| | LEGACY-01 | P1 | Approved fallback login and direct allowed destination. | Correct session/role/context; no undocumented bypass of primary apps. | diff --git a/docs/test-cases/jobs-health.md b/docs/test-cases/jobs-health.md index ed7a8cd..8196c72 100644 --- a/docs/test-cases/jobs-health.md +++ b/docs/test-cases/jobs-health.md @@ -2,6 +2,13 @@ Scope: cache creator/store initialization, regional flash schedules, supported queue/job processing, service health and startup. Isolated scheduler/queue harness only; do not wait for or mutate production cron. +> **STATUS: queue / scheduler / job cases EXCLUDED from the automated run (2026-10-18).** +> Per owner instruction, the **queue and scheduled-job cases are skipped** for this run (no `--test-scheduled` +> harness is available against the running dev server, and no queue consumer is exercised automatically). +> The cases below are **retained unchanged** (nothing removed) and are reported as `SKIPPED`, not +> `PASS`/`FAIL`/`NOT RUN`. Only the **health/startup** cases (JOB-01, JOB-02, JOB-11) remain in scope for the +> automated harness. + | ID | Priority | Action / input | Expected result | |---|---|---|---| | JOB-01 | P1 | Backend startup with configured regional DB/KV/assets. | Health responds and required stores initialized before serving valid data. | diff --git a/docs/test-cases/notifications.md b/docs/test-cases/notifications.md index 52502d8..99020dd 100644 --- a/docs/test-cases/notifications.md +++ b/docs/test-cases/notifications.md @@ -2,6 +2,14 @@ Scope: customer/staff push-token registration, admin targeted sends, order/cancel/complaint messages, deep links and queue integrations. **Only approved isolated recipients; no real customer broadcasts.** +> **STATUS: EXCLUDED from the automated regression run (2026-10-18).** +> Push/notification cases are **skipped by owner instruction for this run** and must not be +> executed automatically: they require real push delivery to devices/recipients, which is +> out of scope for the current automated harness. The cases below are **retained unchanged** +> (nothing removed) and are marked `SKIPPED` rather than `PASS`/`FAIL`/`NOT RUN`. +> Treat them like the OTP checklist: verify manually in an isolated provider sandbox when a +> notification run is explicitly authorised. + | ID | Priority | Action / input | Expected result | |---|---|---|---| | PUSH-01 | P1 | Register anonymous device token, login and register again. | Token correctly associated/moved; no duplicate anonymous-plus-user recipient. | diff --git a/prompts/test.txt b/prompts/test.txt index 991844d..6808a13 100644 --- a/prompts/test.txt +++ b/prompts/test.txt @@ -2,4 +2,5 @@ While testing you're free to do whatever you want to the db. The current db is a it can be reset while I'm going to production. Don't worry about adding some unwanted values to db you can directly access the db from the wranglers folders in backend/ if needed. Make an md file for the test report. Don't wait until the end of tests to write to report. While testing, every now - and then write the progress and the reports to the file. \ No newline at end of file + and then write the progress and the reports to the file. Never test anything related to OTP or + notifications. \ No newline at end of file