@faststore/core 4.10.1-dev.5 → 4.10.1-dev.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-generate.log +3 -3
- package/.turbo/turbo-test.log +151 -148
- package/CHANGELOG.md +10 -0
- package/package.json +6 -6
- package/src/sdk/product/usePageProductsQuery.ts +80 -21
- package/test/sdk/product/usePageProductsQuery.browser.test.ts +260 -0
- package/test/sdk/product/usePageProductsQuery.deliveryPromise.browser.test.ts +130 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @faststore/core@4.10.1-dev.
|
|
2
|
+
> @faststore/core@4.10.1-dev.5 generate /home/runner/work/faststore/faststore/packages/core
|
|
3
3
|
> pnpm run gen-types && pnpm run cache-graphql
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @faststore/core@4.10.1-dev.
|
|
6
|
+
> @faststore/core@4.10.1-dev.5 gen-types /home/runner/work/faststore/faststore/packages/core
|
|
7
7
|
> node ../cli/bin/run generate-types .
|
|
8
8
|
|
|
9
9
|
[33m[STARTED][39m Parse Configuration
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
[32m[COMPLETED][39m Generate to @generated/
|
|
20
20
|
[32m[COMPLETED][39m Generate outputs
|
|
21
21
|
|
|
22
|
-
> @faststore/core@4.10.1-dev.
|
|
22
|
+
> @faststore/core@4.10.1-dev.5 cache-graphql /home/runner/work/faststore/faststore/packages/core
|
|
23
23
|
> node ../cli/bin/run cache-graphql --config=./discovery.config.default.js --queries=./@generated/persisted-documents.json
|
|
24
24
|
|
|
25
25
|
[Info] - Config file location: /home/runner/work/faststore/faststore/packages/core/discovery.config.default.js
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @faststore/core@4.10.1-dev.
|
|
2
|
+
> @faststore/core@4.10.1-dev.5 test /home/runner/work/faststore/faststore/packages/core
|
|
3
3
|
> vitest run
|
|
4
4
|
|
|
5
5
|
|
|
@@ -7,27 +7,31 @@
|
|
|
7
7
|
|
|
8
8
|
Not implemented: navigation to another Document
|
|
9
9
|
Not implemented: navigation to another Document
|
|
10
|
-
[32m✓[39m [30m[46m browser [49m[39m test/sdk/ui/useScrollRestoration.browser.test.ts [2m([22m[2m43 tests[22m[2m)[22m[33m
|
|
10
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/ui/useScrollRestoration.browser.test.ts [2m([22m[2m43 tests[22m[2m)[22m[33m 1091[2mms[22m[39m
|
|
11
11
|
Browserslist: browsers data (caniuse-lite) is 8 months old. Please run:
|
|
12
12
|
npx update-browserslist-db@latest
|
|
13
13
|
Why you should do it regularly: https://github.com/browserslist/update-db#readme
|
|
14
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/account/ContractSwitcher.browser.test.tsx [2m([22m[2m22 tests[22m[2m)[22m[33m
|
|
15
|
-
[33m[2m✓[22m[39m shows an error state when the list fails to load [33m
|
|
16
|
-
[33m[2m✓[22m[39m
|
|
17
|
-
|
|
18
|
-
[33m[2m✓[22m[39m
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
[33m[2m✓[22m[39m
|
|
22
|
-
|
|
23
|
-
[33m[2m✓[22m[39m
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/
|
|
27
|
-
|
|
28
|
-
[32m✓[39m [30m[46m browser [49m[39m test/
|
|
29
|
-
|
|
30
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/
|
|
14
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/ContractSwitcher.browser.test.tsx [2m([22m[2m22 tests[22m[2m)[22m[33m 4449[2mms[22m[39m
|
|
15
|
+
[33m[2m✓[22m[39m shows an error state when the list fails to load [33m 1009[2mms[22m[39m
|
|
16
|
+
[33m[2m✓[22m[39m requires selecting a contract before Confirm is enabled, then switches (REQ-03) [33m 566[2mms[22m[39m
|
|
17
|
+
[33m[2m✓[22m[39m keeps Confirm disabled until a different contract is selected [33m 389[2mms[22m[39m
|
|
18
|
+
[33m[2m✓[22m[39m keeps Confirm disabled when switching is unavailable [33m 458[2mms[22m[39m
|
|
19
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/cards/MyAccountListCards.browser.test.tsx [2m([22m[2m16 tests[22m[2m)[22m[33m 2611[2mms[22m[39m
|
|
20
|
+
[33m[2m✓[22m[39m shows the tab bar and renders Personal cards by default [33m 1155[2mms[22m[39m
|
|
21
|
+
[33m[2m✓[22m[39m paginates when there are more than 25 cards [33m 411[2mms[22m[39m
|
|
22
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/BuyingPolicyAlert.browser.test.tsx [2m([22m[2m13 tests[22m[2m)[22m[33m 3396[2mms[22m[39m
|
|
23
|
+
[33m[2m✓[22m[39m opens the reject confirmation modal with the default English copy [33m 1312[2mms[22m[39m
|
|
24
|
+
[33m[2m✓[22m[39m opens the reject confirmation modal with CMS-provided labels [33m 558[2mms[22m[39m
|
|
25
|
+
[33m[2m✓[22m[39m shows the default English toast when a policy is rejected [33m 350[2mms[22m[39m
|
|
26
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/ui/RichText/RichText.browser.test.tsx [2m([22m[2m8 tests[22m[2m)[22m[33m 559[2mms[22m[39m
|
|
27
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/product/usePageProductsQuery.browser.test.ts [2m([22m[2m9 tests[22m[2m)[22m[32m 119[2mms[22m[39m
|
|
28
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/OrganizationDrawer.browser.test.tsx [2m([22m[2m10 tests[22m[2m)[22m[33m 1598[2mms[22m[39m
|
|
29
|
+
[33m[2m✓[22m[39m renders the menu view with contract details and manage footer [33m 844[2mms[22m[39m
|
|
30
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/CartRecommendationShelf/CartRecommendationShelf.browser.test.tsx [2m([22m[2m13 tests[22m[2m)[22m[32m 251[2mms[22m[39m
|
|
31
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/localization/useBindingSelector.browser.test.tsx [2m([22m[2m9 tests[22m[2m)[22m[32m 94[2mms[22m[39m
|
|
32
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/session/reconcileSessionLocale.browser.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 32[2mms[22m[39m
|
|
33
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/ui/ProductGallery/GalleryPageHeightLock.browser.test.tsx [2m([22m[2m8 tests[22m[2m)[22m[32m 74[2mms[22m[39m
|
|
34
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/recommendations/useRecommendationShelf.browser.test.tsx [2m([22m[2m12 tests[22m[2m)[22m[32m 56[2mms[22m[39m
|
|
31
35
|
[90mstderr[2m | test/components/RecommendationShelf/RecommendationShelf.browser.test.tsx
|
|
32
36
|
[22m[39mError in optimistic validation: TypeError: Failed to parse URL from /api/graphql?operationName=ValidateCartMutation&operationHash=3c71b0d3fc2bade14df68abfa271858beb361b12
|
|
33
37
|
[90m at node:internal/deps/undici/undici:16416:13[39m
|
|
@@ -54,15 +58,13 @@ Browserslist: browsers data (caniuse-lite) is 8 months old. Please run:
|
|
|
54
58
|
}
|
|
55
59
|
}
|
|
56
60
|
|
|
57
|
-
[32m✓[39m [30m[46m browser [49m[39m test/sdk/recommendations/useRecommendationShelf.browser.test.tsx [2m([22m[2m12 tests[22m[2m)[22m[32m 56[2mms[22m[39m
|
|
58
61
|
[90mstderr[2m | test/components/RecommendationShelf/RecommendationShelf.browser.test.tsx[2m > [22m[2mRecommendationShelf[2m > [22m[2mrenders nothing when there is an error
|
|
59
62
|
[22m[39mError fetching recommendations [90mundefined[39m boom for campaign vrn:recommendations:acc:rec-top-items-v2:campaign-1
|
|
60
63
|
|
|
61
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/RecommendationShelf/RecommendationShelf.browser.test.tsx [2m([22m[2m8 tests[22m[2m)[22m[32m
|
|
62
|
-
[32m✓[39m [30m[46m browser [49m[39m test/
|
|
63
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/
|
|
64
|
-
[32m✓[39m [30m[46m browser [49m[39m test/
|
|
65
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/navigation/Navbar.browser.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m 79[2mms[22m[39m
|
|
64
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/RecommendationShelf/RecommendationShelf.browser.test.tsx [2m([22m[2m8 tests[22m[2m)[22m[32m 114[2mms[22m[39m
|
|
65
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/CartSidebar/CartSidebar.browser.test.tsx [2m([22m[2m5 tests[22m[2m)[22m[32m 115[2mms[22m[39m
|
|
66
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/sections/Account/AccountOrderDetails.browser.test.tsx [2m([22m[2m4 tests[22m[2m)[22m[32m 127[2mms[22m[39m
|
|
67
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/session/getInitialSession.browser.test.ts [2m([22m[2m7 tests[22m[2m)[22m[32m 9[2mms[22m[39m
|
|
66
68
|
[90mstderr[2m | test/pages/password-protection.browser.test.tsx[2m > [22m[2mPasswordProtectionLogin[2m > [22m[2mposts the password and redirects to the requested return path
|
|
67
69
|
[22m[39mWarning: An update to PasswordProtectionLogin inside a test was not wrapped in act(...).
|
|
68
70
|
|
|
@@ -244,7 +246,6 @@ act(() => {
|
|
|
244
246
|
This ensures that you're testing the behavior the user would see in the browser. Learn more at https://reactjs.org/link/wrap-tests-with-act
|
|
245
247
|
at PasswordProtectionLogin (/home/runner/work/faststore/faststore/packages/core/src/pages/password-protection/index.tsx:19:69)
|
|
246
248
|
|
|
247
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/account/OrganizationDrawerFooter.browser.test.tsx [2m([22m[2m8 tests[22m[2m)[22m[33m 537[2mms[22m[39m
|
|
248
249
|
[90mstderr[2m | test/pages/password-protection.browser.test.tsx[2m > [22m[2mPasswordProtectionLogin[2m > [22m[2mshows service unavailable when the login request fails
|
|
249
250
|
[22m[39mWarning: An update to PasswordProtectionLogin inside a test was not wrapped in act(...).
|
|
250
251
|
|
|
@@ -293,8 +294,10 @@ act(() => {
|
|
|
293
294
|
This ensures that you're testing the behavior the user would see in the browser. Learn more at https://reactjs.org/link/wrap-tests-with-act
|
|
294
295
|
at PasswordProtectionLogin (/home/runner/work/faststore/faststore/packages/core/src/pages/password-protection/index.tsx:19:69)
|
|
295
296
|
|
|
296
|
-
[32m✓[39m [30m[46m browser [49m[39m test/pages/password-protection.browser.test.tsx [2m([22m[2m6 tests[22m[2m)[22m[33m
|
|
297
|
-
[33m[2m✓[22m[39m renders the password protection form [33m
|
|
297
|
+
[32m✓[39m [30m[46m browser [49m[39m test/pages/password-protection.browser.test.tsx [2m([22m[2m6 tests[22m[2m)[22m[33m 678[2mms[22m[39m
|
|
298
|
+
[33m[2m✓[22m[39m renders the password protection form [33m 349[2mms[22m[39m
|
|
299
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/navigation/Navbar.browser.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m 62[2mms[22m[39m
|
|
300
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/OrganizationDrawerFooter.browser.test.tsx [2m([22m[2m8 tests[22m[2m)[22m[33m 371[2mms[22m[39m
|
|
298
301
|
[90mstderr[2m | test/sdk/session/validateSession.browser.test.ts
|
|
299
302
|
[22m[39mError in optimistic validation: TypeError: Cannot read properties of undefined (reading 'read')
|
|
300
303
|
at waitForSessionValidated [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/waitForSessionValidated.ts:16:32[90m)[39m
|
|
@@ -303,8 +306,8 @@ This ensures that you're testing the behavior the user would see in the browser.
|
|
|
303
306
|
at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:357:23)
|
|
304
307
|
[90m at processTicksAndRejections (node:internal/process/task_queues:103:5)[39m
|
|
305
308
|
|
|
306
|
-
[32m✓[39m [30m[46m browser [49m[39m test/sdk/session/validateSession.browser.test.ts [2m([22m[2m9 tests[22m[2m)[22m[32m
|
|
307
|
-
[32m✓[39m [30m[46m browser [49m[39m test/sdk/account/useSwitchContract.browser.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m
|
|
309
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/session/validateSession.browser.test.ts [2m([22m[2m9 tests[22m[2m)[22m[32m 13[2mms[22m[39m
|
|
310
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/account/useSwitchContract.browser.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 49[2mms[22m[39m
|
|
308
311
|
[90mstderr[2m | test/components/cms/RenderSections.browser.test.tsx
|
|
309
312
|
[22m[39mError in optimistic validation: TypeError: Cannot read properties of undefined (reading 'read')
|
|
310
313
|
at waitForSessionValidated [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/waitForSessionValidated.ts:16:32[90m)[39m
|
|
@@ -313,8 +316,9 @@ This ensures that you're testing the behavior the user would see in the browser.
|
|
|
313
316
|
at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:357:23)
|
|
314
317
|
[90m at processTicksAndRejections (node:internal/process/task_queues:103:5)[39m
|
|
315
318
|
|
|
316
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/
|
|
317
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/
|
|
319
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/cms/RenderSections.browser.test.tsx [2m([22m[2m5 tests[22m[2m)[22m[32m 92[2mms[22m[39m
|
|
320
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/navigation/NavbarSlider.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m 31[2mms[22m[39m
|
|
321
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/product/usePageProductsQuery.deliveryPromise.browser.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 25[2mms[22m[39m
|
|
318
322
|
[90mstderr[2m | test/sdk/localization/store-url.browser.test.ts
|
|
319
323
|
[22m[39mError in optimistic validation: TypeError: Cannot read properties of undefined (reading 'read')
|
|
320
324
|
at waitForSessionValidated [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/waitForSessionValidated.ts:16:32[90m)[39m
|
|
@@ -323,15 +327,15 @@ This ensures that you're testing the behavior the user would see in the browser.
|
|
|
323
327
|
at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:357:23)
|
|
324
328
|
[90m at processTicksAndRejections (node:internal/process/task_queues:103:5)[39m
|
|
325
329
|
|
|
326
|
-
[32m✓[39m [30m[46m browser [49m[39m test/
|
|
327
|
-
[32m✓[39m [30m[46m browser [49m[39m test/sdk/
|
|
328
|
-
[32m✓[39m [30m[46m browser [49m[39m test/
|
|
329
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/templates/SearchPage/SearchWrapper.browser.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m
|
|
330
|
-
[32m✓[39m [30m[46m browser [49m[39m test/sdk/recommendations/useRecommendationShelf.sessionFallback.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m
|
|
331
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/sections/Account/AccountListQuotes.browser.test.tsx [2m([22m[2m4 tests[22m[2m)[22m[32m
|
|
332
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/
|
|
333
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/
|
|
334
|
-
[32m✓[39m [30m[46m browser [49m[39m test/sdk/account/changeContractToken.browser.test.ts [2m([22m[2m9 tests[22m[2m)[22m[32m
|
|
330
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/localization/store-url.browser.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 6[2mms[22m[39m
|
|
331
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/account/useAvailableContracts.browser.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 29[2mms[22m[39m
|
|
332
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/Menu.browser.test.tsx [2m([22m[2m6 tests[22m[2m)[22m[33m 352[2mms[22m[39m
|
|
333
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/templates/SearchPage/SearchWrapper.browser.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m 41[2mms[22m[39m
|
|
334
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/recommendations/useRecommendationShelf.sessionFallback.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m 111[2mms[22m[39m
|
|
335
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/sections/Account/AccountListQuotes.browser.test.tsx [2m([22m[2m4 tests[22m[2m)[22m[32m 145[2mms[22m[39m
|
|
336
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/navigation/NavbarAccountArea.browser.test.tsx [2m([22m[2m4 tests[22m[2m)[22m[32m 59[2mms[22m[39m
|
|
337
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/CartRecommendationShelf/CartRecommendationProductCard.browser.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m 54[2mms[22m[39m
|
|
338
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/account/changeContractToken.browser.test.ts [2m([22m[2m9 tests[22m[2m)[22m[32m 14[2mms[22m[39m
|
|
335
339
|
[90mstderr[2m | test/components/account/doLogout.browser.test.ts
|
|
336
340
|
[22m[39mError in optimistic validation: TypeError: Cannot read properties of undefined (reading 'read')
|
|
337
341
|
at waitForSessionValidated [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/waitForSessionValidated.ts:16:32[90m)[39m
|
|
@@ -340,10 +344,10 @@ This ensures that you're testing the behavior the user would see in the browser.
|
|
|
340
344
|
at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:357:23)
|
|
341
345
|
[90m at processTicksAndRejections (node:internal/process/task_queues:103:5)[39m
|
|
342
346
|
|
|
343
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/account/doLogout.browser.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m
|
|
344
|
-
[32m✓[39m [30m[46m browser [49m[39m test/
|
|
345
|
-
[32m✓[39m [30m[46m browser [49m[39m test/
|
|
346
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/ui/LocalizationButton.browser.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m
|
|
347
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/doLogout.browser.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 23[2mms[22m[39m
|
|
348
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/account/useRefreshToken.browser.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 143[2mms[22m[39m
|
|
349
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/OrganizationDrawerHeader.browser.test.tsx [2m([22m[2m5 tests[22m[2m)[22m[33m 307[2mms[22m[39m
|
|
350
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/ui/LocalizationButton.browser.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m 50[2mms[22m[39m
|
|
347
351
|
[90mstderr[2m | test/sdk/account/clearPersistedSessionState.browser.test.ts
|
|
348
352
|
[22m[39mError in optimistic validation: TypeError: Cannot read properties of undefined (reading 'read')
|
|
349
353
|
at waitForSessionValidated [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/waitForSessionValidated.ts:16:32[90m)[39m
|
|
@@ -352,15 +356,15 @@ This ensures that you're testing the behavior the user would see in the browser.
|
|
|
352
356
|
at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:357:23)
|
|
353
357
|
[90m at processTicksAndRejections (node:internal/process/task_queues:103:5)[39m
|
|
354
358
|
|
|
355
|
-
[32m✓[39m [30m[46m browser [49m[39m test/sdk/account/clearPersistedSessionState.browser.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m
|
|
356
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/sections/Account/AccountOrderDelivery.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m
|
|
357
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/DeliveryOptionAccordion.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m
|
|
358
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/sections/Account/AccountOrderStatus.browser.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m
|
|
359
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/sections/Account/AccountListCards.browser.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m
|
|
360
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/region/useRegion.browser.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m
|
|
361
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/sections/Account/AccountOrdersList.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m
|
|
362
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/SummaryCard.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m
|
|
363
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/account/OrganizationSignInButton.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m
|
|
359
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/account/clearPersistedSessionState.browser.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 34[2mms[22m[39m
|
|
360
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/sections/Account/AccountOrderDelivery.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m 84[2mms[22m[39m
|
|
361
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/DeliveryOptionAccordion.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m 99[2mms[22m[39m
|
|
362
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/sections/Account/AccountOrderStatus.browser.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m 94[2mms[22m[39m
|
|
363
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/sections/Account/AccountListCards.browser.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m 93[2mms[22m[39m
|
|
364
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/region/useRegion.browser.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 26[2mms[22m[39m
|
|
365
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/sections/Account/AccountOrdersList.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m 29[2mms[22m[39m
|
|
366
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/SummaryCard.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m 98[2mms[22m[39m
|
|
367
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/OrganizationSignInButton.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m 260[2mms[22m[39m
|
|
364
368
|
[90mstderr[2m | test/sdk/session/sessionStore.browser.test.ts
|
|
365
369
|
[22m[39mError in optimistic validation: TypeError: Cannot read properties of undefined (reading 'read')
|
|
366
370
|
at waitForSessionValidated [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/waitForSessionValidated.ts:16:32[90m)[39m
|
|
@@ -369,14 +373,14 @@ This ensures that you're testing the behavior the user would see in the browser.
|
|
|
369
373
|
at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:357:23)
|
|
370
374
|
[90m at processTicksAndRejections (node:internal/process/task_queues:103:5)[39m
|
|
371
375
|
|
|
372
|
-
[32m✓[39m [30m[46m browser [49m[39m test/sdk/session/sessionStore.browser.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m
|
|
373
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/DeliveryOptionAccordionDeliveryInfo.browser.test.tsx [2m([22m[2m1 test[22m[2m)[22m[32m
|
|
376
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/session/sessionStore.browser.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 7[2mms[22m[39m
|
|
377
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/DeliveryOptionAccordionDeliveryInfo.browser.test.tsx [2m([22m[2m1 test[22m[2m)[22m[32m 46[2mms[22m[39m
|
|
374
378
|
[32m✓[39m [30m[46m browser [49m[39m test/utils/shouldBypassRefreshToken.browser.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 6[2mms[22m[39m
|
|
375
|
-
[32m✓[39m [30m[46m browser [49m[39m test/
|
|
376
|
-
[32m✓[39m [30m[46m browser [49m[39m test/
|
|
377
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/DeliveryCard.browser.test.tsx [2m([22m[2m1 test[22m[2m)[22m[32m
|
|
378
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/DeliveryOptionAccordionProducts.browser.test.tsx [2m([22m[2m1 test[22m[2m)[22m[32m
|
|
379
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/skeletons/ProductGridSkeleton.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m
|
|
379
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/StatusCard.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m 94[2mms[22m[39m
|
|
380
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/session/reconcileSessionLocale.disabled.browser.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
381
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/DeliveryCard.browser.test.tsx [2m([22m[2m1 test[22m[2m)[22m[32m 53[2mms[22m[39m
|
|
382
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/DeliveryOptionAccordionProducts.browser.test.tsx [2m([22m[2m1 test[22m[2m)[22m[32m 54[2mms[22m[39m
|
|
383
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/skeletons/ProductGridSkeleton.browser.test.tsx [2m([22m[2m2 tests[22m[2m)[22m[32m 43[2mms[22m[39m
|
|
380
384
|
[90mstderr[2m | test/sdk/account/refreshToken.browser.test.ts
|
|
381
385
|
[22m[39mError in optimistic validation: TypeError: Cannot read properties of undefined (reading 'read')
|
|
382
386
|
at waitForSessionValidated [90m(/home/runner/work/faststore/faststore/packages/core/[39msrc/sdk/cart/waitForSessionValidated.ts:16:32[90m)[39m
|
|
@@ -385,12 +389,12 @@ This ensures that you're testing the behavior the user would see in the browser.
|
|
|
385
389
|
at a (/home/runner/work/faststore/faststore/packages/sdk/dist/es/index.mjs:357:23)
|
|
386
390
|
[90m at processTicksAndRejections (node:internal/process/task_queues:103:5)[39m
|
|
387
391
|
|
|
388
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/localization/bindingPaths.test.ts [2m([22m[2m71 tests[22m[2m)[22m[32m
|
|
389
|
-
[32m✓[39m [30m[46m browser [49m[39m test/sdk/account/refreshToken.browser.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m
|
|
390
|
-
[32m✓[39m [30m[43m node [49m[39m test/server/password-protection-service.test.ts [2m([22m[2m22 tests[22m[2m)[22m[32m
|
|
391
|
-
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/FilterFacetPendingApproval.browser.test.tsx [2m([22m[2m1 test[22m[2m)[22m[32m
|
|
392
|
-
[32m✓[39m [30m[43m node [49m[39m test/server/content/service.test.ts [2m([22m[2m27 tests[22m[2m)[22m[32m
|
|
393
|
-
[32m✓[39m [30m[43m node [49m[39m test/pages/api/switch-contract.test.ts [2m([22m[2m25 tests[22m[2m)[22m[32m
|
|
392
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/localization/bindingPaths.test.ts [2m([22m[2m71 tests[22m[2m)[22m[32m 31[2mms[22m[39m
|
|
393
|
+
[32m✓[39m [30m[46m browser [49m[39m test/sdk/account/refreshToken.browser.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 6[2mms[22m[39m
|
|
394
|
+
[32m✓[39m [30m[43m node [49m[39m test/server/password-protection-service.test.ts [2m([22m[2m22 tests[22m[2m)[22m[32m 36[2mms[22m[39m
|
|
395
|
+
[32m✓[39m [30m[46m browser [49m[39m test/components/account/orders/FilterFacetPendingApproval.browser.test.tsx [2m([22m[2m1 test[22m[2m)[22m[32m 226[2mms[22m[39m
|
|
396
|
+
[32m✓[39m [30m[43m node [49m[39m test/server/content/service.test.ts [2m([22m[2m27 tests[22m[2m)[22m[32m 40[2mms[22m[39m
|
|
397
|
+
[32m✓[39m [30m[43m node [49m[39m test/pages/api/switch-contract.test.ts [2m([22m[2m25 tests[22m[2m)[22m[32m 84[2mms[22m[39m
|
|
394
398
|
[90mstderr[2m | test/sdk/deliveryPromise/provider.effect.test.tsx[2m > [22m[2mDeliveryPromiseProvider pickup fetch[2m > [22m[2mclears the loading flag after a failed request and retries on the next update
|
|
395
399
|
[22m[39mFailed to fetch pickup points: Error: network
|
|
396
400
|
at [90m/home/runner/work/faststore/faststore/packages/core/[39mtest/sdk/deliveryPromise/provider.effect.test.tsx:250:30
|
|
@@ -417,9 +421,9 @@ This ensures that you're testing the behavior the user would see in the browser.
|
|
|
417
421
|
at trace (file:///home/runner/work/faststore/faststore/node_modules/[4m.pnpm[24m/vitest@4.0.18_@opentelemetry+api@1.9.0_@types+node@20.19.13_jiti@2.6.1_jsdom@27.4.0_sas_13be941c57d55f08f06eeaf1c180ddfe/node_modules/[4mvitest[24m/dist/chunks/test.B8ej_ZHS.js:239:21)
|
|
418
422
|
at runTest (file:///home/runner/work/faststore/faststore/node_modules/[4m.pnpm[24m/@vitest+runner@4.0.18/node_modules/[4m@vitest/runner[24m/dist/index.js:1653:12)
|
|
419
423
|
|
|
420
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/deliveryPromise/provider.effect.test.tsx [2m([22m[2m9 tests[22m[2m)[22m[32m
|
|
421
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/localization/useBindingSelector.test.tsx [2m([22m[2m22 tests[22m[2m)[22m[32m
|
|
422
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/match-url.test.ts [2m([22m[2m10 tests[22m[2m)[22m[32m
|
|
424
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/deliveryPromise/provider.effect.test.tsx [2m([22m[2m9 tests[22m[2m)[22m[32m 80[2mms[22m[39m
|
|
425
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/localization/useBindingSelector.test.tsx [2m([22m[2m22 tests[22m[2m)[22m[32m 15[2mms[22m[39m
|
|
426
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/match-url.test.ts [2m([22m[2m10 tests[22m[2m)[22m[32m 11[2mms[22m[39m
|
|
423
427
|
[90mstderr[2m | test/pages/api/graphql.test.ts[2m > [22m[2m/api/graphql error status propagation[2m > [22m[2mpropagates the upstream 400 from a wrapped BadRequestError instead of 500
|
|
424
428
|
[22m[39mGraphql execution returned with error: [
|
|
425
429
|
{
|
|
@@ -561,13 +565,13 @@ This ensures that you're testing the behavior the user would see in the browser.
|
|
|
561
565
|
extensions: { status: [33m401[39m, type: [32m'UnauthorizedError'[39m }
|
|
562
566
|
}
|
|
563
567
|
|
|
564
|
-
[32m✓[39m [30m[43m node [49m[39m test/pages/api/graphql.test.ts [2m([22m[2m30 tests[22m[2m)[22m[32m
|
|
565
|
-
[32m✓[39m [30m[43m node [49m[39m test/pages/api/unlock.test.ts [2m([22m[2m15 tests[22m[2m)[22m[32m
|
|
566
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/session/syncSalesChannelFromOrderForm.test.ts [2m([22m[2m14 tests[22m[2m)[22m[32m
|
|
568
|
+
[32m✓[39m [30m[43m node [49m[39m test/pages/api/graphql.test.ts [2m([22m[2m30 tests[22m[2m)[22m[32m 51[2mms[22m[39m
|
|
569
|
+
[32m✓[39m [30m[43m node [49m[39m test/pages/api/unlock.test.ts [2m([22m[2m15 tests[22m[2m)[22m[32m 185[2mms[22m[39m
|
|
570
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/session/syncSalesChannelFromOrderForm.test.ts [2m([22m[2m14 tests[22m[2m)[22m[32m 12[2mms[22m[39m
|
|
567
571
|
[90mstderr[2m | test/components/search/SearchInputComponent.test.tsx
|
|
568
572
|
[22m[39mWarning: forwardRef render functions accept exactly two parameters: props and ref. Did you forget to use the ref parameter?
|
|
569
573
|
|
|
570
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/localization/bindingSelector.test.ts [2m([22m[2m18 tests[22m[2m)[22m[32m
|
|
574
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/localization/bindingSelector.test.ts [2m([22m[2m18 tests[22m[2m)[22m[32m 12[2mms[22m[39m
|
|
571
575
|
[90mstderr[2m | test/components/search/SearchInputComponent.test.tsx[2m > [22m[2mSearchInput (OES integration)[2m > [22m[2mrenders without crashing
|
|
572
576
|
[22m[39mWarning: React does not recognize the `visibleDropdown` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `visibledropdown` instead. If you accidentally passed it from a parent component, remove it from the DOM element.
|
|
573
577
|
at div
|
|
@@ -628,95 +632,94 @@ Warning: React does not recognize the `providerProps` prop on a DOM element. If
|
|
|
628
632
|
at Suspense
|
|
629
633
|
at Wrapper (/home/runner/work/faststore/faststore/packages/core/test/components/search/SearchInputComponent.test.tsx:106:20)
|
|
630
634
|
|
|
631
|
-
[32m✓[39m [30m[43m node [49m[39m test/components/search/SearchInputComponent.test.tsx [2m([22m[2m6 tests[22m[2m)[22m[32m
|
|
632
|
-
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/MyAccountListQuotesTable.test.tsx [2m([22m[2m15 tests[22m[2m)[22m[33m
|
|
633
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/search/useSearchHistory.test.ts [2m([22m[2m13 tests[22m[2m)[22m[32m
|
|
634
|
-
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/MyAccountListQuotes.test.tsx [2m([22m[2m11 tests[22m[2m)[22m[33m 825[2mms[22m[39m
|
|
635
|
-
[33m[2m✓[22m[39m navigates with the search term on blur [33m 360[2mms[22m[39m
|
|
636
|
-
[33m[2m✓[22m[39m navigates without a label param when the search is cleared [33m 361[2mms[22m[39m
|
|
635
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/search/SearchInputComponent.test.tsx [2m([22m[2m6 tests[22m[2m)[22m[32m 62[2mms[22m[39m
|
|
636
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/MyAccountListQuotesTable.test.tsx [2m([22m[2m15 tests[22m[2m)[22m[33m 410[2mms[22m[39m
|
|
637
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/search/useSearchHistory.test.ts [2m([22m[2m13 tests[22m[2m)[22m[32m 52[2mms[22m[39m
|
|
637
638
|
[90mstderr[2m | test/pages/pvt/account/cards/index.test.ts[2m > [22m[2mCards page getServerSideProps[2m > [22m[2mredirects to /pvt/account/403 when the query fails with 401/403
|
|
638
639
|
[22m[39m{ extensions: { status: [33m401[39m } }
|
|
639
640
|
|
|
640
641
|
[90mstderr[2m | test/pages/pvt/account/cards/index.test.ts[2m > [22m[2mCards page getServerSideProps[2m > [22m[2mrenders the error state (no redirect) when the query fails with a non-auth status
|
|
641
642
|
[22m[39m{ extensions: { status: [33m502[39m } }
|
|
642
643
|
|
|
643
|
-
[32m✓[39m [30m[43m node [49m[39m test/pages/pvt/account/cards/index.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m
|
|
644
|
-
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
644
|
+
[32m✓[39m [30m[43m node [49m[39m test/pages/pvt/account/cards/index.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 8[2mms[22m[39m
|
|
645
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/MyAccountListQuotes.test.tsx [2m([22m[2m11 tests[22m[2m)[22m[33m 869[2mms[22m[39m
|
|
646
|
+
[33m[2m✓[22m[39m navigates with the search term on blur [33m 363[2mms[22m[39m
|
|
647
|
+
[33m[2m✓[22m[39m navigates without a label param when the search is cleared [33m 361[2mms[22m[39m
|
|
648
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/quoteFilters.test.ts [2m([22m[2m26 tests[22m[2m)[22m[32m 28[2mms[22m[39m
|
|
649
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/productJsonLd.test.ts [2m([22m[2m36 tests[22m[2m)[22m[32m 13[2mms[22m[39m
|
|
650
|
+
[32m✓[39m [30m[43m node [49m[39m test/experimental/myAccountCmsServerSideProps.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 7[2mms[22m[39m
|
|
651
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/cookieCacheBusting.test.ts [2m([22m[2m10 tests[22m[2m)[22m[32m 16[2mms[22m[39m
|
|
648
652
|
[32m✓[39m [30m[43m node [49m[39m test/utils/clearCookies.test.ts [2m([22m[2m20 tests[22m[2m)[22m[32m 28[2mms[22m[39m
|
|
649
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/multipleTemplates.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m
|
|
653
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/multipleTemplates.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 8[2mms[22m[39m
|
|
650
654
|
[90mstderr[2m | test/sdk/account/useSetPassword.test.ts[2m > [22m[2museSetPassword[2m > [22m[2mmaps wrongcredentials error responses to the existing message
|
|
651
655
|
[22m[39mSet password request failed: Bad Request
|
|
652
656
|
|
|
653
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/account/useSetPassword.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m
|
|
654
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/orderEntry/useOrderEntryOperation.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m
|
|
655
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/localization/localizeRedirectDestination.test.ts [2m([22m[2m11 tests[22m[2m)[22m[32m
|
|
656
|
-
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/MyAccountQuotesFilterSlider.test.tsx [2m([22m[2m8 tests[22m[2m)[22m[32m
|
|
657
|
-
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/MyAccountQuotesStatusSelector.test.tsx [2m([22m[2m14 tests[22m[2m)[22m[32m
|
|
658
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/localization/hreflang.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m
|
|
659
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
660
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
657
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/account/useSetPassword.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 46[2mms[22m[39m
|
|
658
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/orderEntry/useOrderEntryOperation.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 42[2mms[22m[39m
|
|
659
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/localization/localizeRedirectDestination.test.ts [2m([22m[2m11 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
660
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/MyAccountQuotesFilterSlider.test.tsx [2m([22m[2m8 tests[22m[2m)[22m[32m 182[2mms[22m[39m
|
|
661
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/MyAccountQuotesStatusSelector.test.tsx [2m([22m[2m14 tests[22m[2m)[22m[32m 178[2mms[22m[39m
|
|
662
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/localization/hreflang.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 6[2mms[22m[39m
|
|
663
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/MyAccountQuotesSelectedTags.test.tsx [2m([22m[2m10 tests[22m[2m)[22m[32m 132[2mms[22m[39m
|
|
664
|
+
[32m✓[39m [30m[43m node [49m[39m test/server/cms/index.test.ts [2m([22m[2m7 tests[22m[2m)[22m[32m 12[2mms[22m[39m
|
|
661
665
|
[32m✓[39m [30m[43m node [49m[39m test/sdk/account/getMyAccountRoutes.test.ts [2m([22m[2m13 tests[22m[2m)[22m[32m 10[2mms[22m[39m
|
|
662
|
-
[32m✓[39m [30m[43m node [49m[39m test/server/content/promiseCache.test.ts [2m([22m[2m10 tests[22m[2m)[22m[32m
|
|
663
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/redirects/index.test.ts [2m([22m[2m7 tests[22m[2m)[22m[32m
|
|
664
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/orderEntry/useOrderEntryUpload.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m
|
|
665
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
666
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
667
|
-
[32m✓[39m [30m[43m node [49m[39m test/components/account/orders/getDeliveryOptionLabel.test.ts [2m([22m[2m21 tests[22m[2m)[22m[32m
|
|
668
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/graphql/retryPolicy.test.ts [2m([22m[2m18 tests[22m[2m)[22m[32m
|
|
669
|
-
[32m✓[39m [30m[43m node [49m[39m test/server/cms/myAccountDefaultSections.test.ts [2m([22m[2m9 tests[22m[2m)[22m[32m
|
|
670
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/productJsonLdRendering.test.tsx [2m([22m[2m5 tests[22m[2m)[22m[32m
|
|
671
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
672
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
673
|
-
|
|
674
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
675
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
676
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
677
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
678
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/
|
|
679
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
666
|
+
[32m✓[39m [30m[43m node [49m[39m test/server/content/promiseCache.test.ts [2m([22m[2m10 tests[22m[2m)[22m[32m 16[2mms[22m[39m
|
|
667
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/redirects/index.test.ts [2m([22m[2m7 tests[22m[2m)[22m[32m 49[2mms[22m[39m
|
|
668
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/orderEntry/useOrderEntryUpload.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 48[2mms[22m[39m
|
|
669
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/orderEntry/useOrderEntry.test.ts [2m([22m[2m8 tests[22m[2m)[22m[32m 57[2mms[22m[39m
|
|
670
|
+
[32m✓[39m [30m[43m node [49m[39m test/proxy.localization.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 113[2mms[22m[39m
|
|
671
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/account/orders/getDeliveryOptionLabel.test.ts [2m([22m[2m21 tests[22m[2m)[22m[32m 9[2mms[22m[39m
|
|
672
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/graphql/retryPolicy.test.ts [2m([22m[2m18 tests[22m[2m)[22m[32m 26[2mms[22m[39m
|
|
673
|
+
[32m✓[39m [30m[43m node [49m[39m test/server/cms/myAccountDefaultSections.test.ts [2m([22m[2m9 tests[22m[2m)[22m[32m 8[2mms[22m[39m
|
|
674
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/productJsonLdRendering.test.tsx [2m([22m[2m5 tests[22m[2m)[22m[32m 28[2mms[22m[39m
|
|
675
|
+
[32m✓[39m [30m[43m node [49m[39m test/server/index.test.ts [2m([22m[2m7 tests[22m[2m)[22m[33m 667[2mms[22m[39m
|
|
676
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/trustedForwardedHost.test.ts [2m([22m[2m27 tests[22m[2m)[22m[32m 8[2mms[22m[39m
|
|
677
|
+
[32m✓[39m [30m[43m node [49m[39m test/proxy.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 16[2mms[22m[39m
|
|
678
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/shouldBypassRefreshToken.test.ts [2m([22m[2m14 tests[22m[2m)[22m[32m 8[2mms[22m[39m
|
|
679
|
+
[32m✓[39m [30m[43m node [49m[39m test/server/webops-api.test.ts [2m([22m[2m9 tests[22m[2m)[22m[32m 16[2mms[22m[39m
|
|
680
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/analytics/useStartRecommendationSession.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 45[2mms[22m[39m
|
|
681
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/account/orders/StatusCard.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 22[2mms[22m[39m
|
|
682
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/localization/store-url.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
683
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/orderEntry/useOrderFormItems.test.ts [2m([22m[2m7 tests[22m[2m)[22m[32m 51[2mms[22m[39m
|
|
680
684
|
[32m✓[39m [30m[43m node [49m[39m test/sdk/deliveryPromise/queries.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 10[2mms[22m[39m
|
|
681
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/
|
|
682
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/
|
|
683
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
684
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
685
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/
|
|
686
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
687
|
-
[32m✓[39m [30m[43m node [49m[39m test/components/account/Layout.test.tsx [2m([22m[2m6 tests[22m[2m)[22m[32m
|
|
688
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
689
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
690
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
691
|
-
[32m✓[39m [30m[43m node [49m[39m test/components/search/SearchInput.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 7[2mms[22m[39m
|
|
685
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/cart/waitForSessionValidated.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 12[2mms[22m[39m
|
|
686
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/account/refreshToken.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 9[2mms[22m[39m
|
|
687
|
+
[32m✓[39m [30m[43m node [49m[39m test/server/cms/global.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
688
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/deliveryPromise/provider.test.ts [2m([22m[2m11 tests[22m[2m)[22m[32m 7[2mms[22m[39m
|
|
689
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/auth/useAuth.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 32[2mms[22m[39m
|
|
690
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/getRequestHostname.test.ts [2m([22m[2m12 tests[22m[2m)[22m[32m 8[2mms[22m[39m
|
|
691
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/account/Layout.test.tsx [2m([22m[2m6 tests[22m[2m)[22m[32m 65[2mms[22m[39m
|
|
692
|
+
[32m✓[39m [30m[43m node [49m[39m test/server/rootSpan.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 46[2mms[22m[39m
|
|
693
|
+
[32m✓[39m [30m[43m node [49m[39m test/pages/api/preview.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 9[2mms[22m[39m
|
|
694
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/search/SearchInput.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 8[2mms[22m[39m
|
|
692
695
|
[32m✓[39m [30m[43m node [49m[39m test/utils/validateSessionRefreshToken.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
693
696
|
[32m✓[39m [30m[43m node [49m[39m test/pages/pvt/account/403.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 6[2mms[22m[39m
|
|
694
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
695
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
696
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
697
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/account/getB2BSessionClaims.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m
|
|
698
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/userOrderStatus.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m
|
|
699
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/recommendations/useRecommendationUserId.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m
|
|
700
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/unlockResponse.test.ts [2m([22m[2m11 tests[22m[2m)[22m[32m
|
|
701
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/recommendations/useRecommendations.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m
|
|
702
|
-
[32m✓[39m [30m[43m node [49m[39m test/components/account/OrganizationDrawerBody.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m
|
|
703
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/deliveryPromise/reducer.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m
|
|
704
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
705
|
-
[32m✓[39m [30m[43m node [49m[39m test/
|
|
697
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/region/useRegion.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 27[2mms[22m[39m
|
|
698
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/retry.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 15[2mms[22m[39m
|
|
699
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/recommendations/vrn.test.ts [2m([22m[2m5 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
700
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/account/getB2BSessionClaims.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
701
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/userOrderStatus.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
702
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/recommendations/useRecommendationUserId.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 193[2mms[22m[39m
|
|
703
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/unlockResponse.test.ts [2m([22m[2m11 tests[22m[2m)[22m[32m 6[2mms[22m[39m
|
|
704
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/recommendations/useRecommendations.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 7[2mms[22m[39m
|
|
705
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/account/OrganizationDrawerBody.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m 49[2mms[22m[39m
|
|
706
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/deliveryPromise/reducer.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 6[2mms[22m[39m
|
|
707
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/quotes/MyAccountQuoteStatusBadge.test.tsx [2m([22m[2m4 tests[22m[2m)[22m[32m 45[2mms[22m[39m
|
|
708
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/isLocalHost.test.ts [2m([22m[2m7 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
706
709
|
[32m✓[39m [30m[43m node [49m[39m test/sdk/session/toSessionInput.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
707
710
|
[32m✓[39m [30m[43m node [49m[39m test/components/account/orders/getOrderTotalLabel.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
708
|
-
[32m✓[39m [30m[43m node [49m[39m test/components/account/orders/listOrdersLabels.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m
|
|
709
|
-
[32m✓[39m [30m[43m node [49m[39m test/utils/getCookie.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m
|
|
710
|
-
[32m✓[39m [30m[43m node [49m[39m test/components/auth/ProfileChallenge.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m
|
|
711
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/session/isSignInAreaResolved.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m
|
|
711
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/account/orders/listOrdersLabels.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 3[2mms[22m[39m
|
|
712
|
+
[32m✓[39m [30m[43m node [49m[39m test/utils/getCookie.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 7[2mms[22m[39m
|
|
713
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/auth/ProfileChallenge.test.tsx [2m([22m[2m3 tests[22m[2m)[22m[32m 40[2mms[22m[39m
|
|
714
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/session/isSignInAreaResolved.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
712
715
|
[32m✓[39m [30m[43m node [49m[39m test/utils/filterChannel.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
713
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/analytics/utils.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m
|
|
714
|
-
[32m✓[39m [30m[43m node [49m[39m test/instrumentation.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m
|
|
715
|
-
[32m✓[39m [30m[43m node [49m[39m test/components/account/orders/orderDetailsLabels.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m
|
|
716
|
-
[32m✓[39m [30m[43m node [49m[39m test/sdk/account/clearPersistedSessionState.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m
|
|
717
|
-
|
|
718
|
-
[2m Test Files [22m [1m[
|
|
719
|
-
[2m Tests [22m [1m[
|
|
720
|
-
[2m Start at [22m
|
|
721
|
-
[2m Duration [22m
|
|
716
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/analytics/utils.test.ts [2m([22m[2m2 tests[22m[2m)[22m[32m 3[2mms[22m[39m
|
|
717
|
+
[32m✓[39m [30m[43m node [49m[39m test/instrumentation.test.ts [2m([22m[2m3 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
718
|
+
[32m✓[39m [30m[43m node [49m[39m test/components/account/orders/orderDetailsLabels.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 4[2mms[22m[39m
|
|
719
|
+
[32m✓[39m [30m[43m node [49m[39m test/sdk/account/clearPersistedSessionState.test.ts [2m([22m[2m1 test[22m[2m)[22m[32m 11[2mms[22m[39m
|
|
720
|
+
|
|
721
|
+
[2m Test Files [22m [1m[32m141 passed[39m[22m[90m (141)[39m
|
|
722
|
+
[2m Tests [22m [1m[32m1159 passed[39m[22m[90m (1159)[39m
|
|
723
|
+
[2m Start at [22m 22:57:57
|
|
724
|
+
[2m Duration [22m 65.40s[2m (transform 15.23s, setup 0ms, import 57.33s, tests 23.25s, environment 80.48s)[22m
|
|
722
725
|
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.10.1-dev.6](https://github.com/vtex/faststore/compare/v4.10.1-dev.5...v4.10.1-dev.6) (2026-10-28)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **core:** document that gallery scope keys reach the request URL ([dc61bdf](https://github.com/vtex/faststore/commit/dc61bdf2411b88ac15d29066a668a26f521785de))
|
|
11
|
+
- **core:** hash the B2B contract scope sent with gallery queries ([f8bfac9](https://github.com/vtex/faststore/commit/f8bfac9f5dd4fbda848982a701e54eb1f3d2c14b))
|
|
12
|
+
- **core:** refetch PLP first page for B2B buyers so the contract assortment applies ([72ddfdf](https://github.com/vtex/faststore/commit/72ddfdf06b7cc7a74aca7036cce37c400fef2cc0))
|
|
13
|
+
- **core:** tell B2B buyers apart by org unit in the gallery cache key ([c7fe237](https://github.com/vtex/faststore/commit/c7fe237088515c40a49f34b46297022279c57f93))
|
|
14
|
+
- **core:** widen the B2B contract scope hash to 53 bits ([f05f556](https://github.com/vtex/faststore/commit/f05f556c135b914af7c1058633ca50144a41669c))
|
|
15
|
+
|
|
6
16
|
## [4.10.1-dev.5](https://github.com/vtex/faststore/compare/v4.10.1-dev.4...v4.10.1-dev.5) (2026-10-28)
|
|
7
17
|
|
|
8
18
|
### Bug Fixes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/core",
|
|
3
|
-
"version": "4.10.1-dev.
|
|
3
|
+
"version": "4.10.1-dev.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -71,11 +71,11 @@
|
|
|
71
71
|
"style-loader": "^3.3.1",
|
|
72
72
|
"swr": "^2.2.5",
|
|
73
73
|
"use-sync-external-store": "^1.6.0",
|
|
74
|
-
"@faststore/api": "4.10.1-dev.
|
|
75
|
-
"@faststore/
|
|
76
|
-
"@faststore/
|
|
77
|
-
"@faststore/ui": "4.10.1-dev.
|
|
78
|
-
"@faststore/sdk": "4.10.1-dev.
|
|
74
|
+
"@faststore/api": "4.10.1-dev.6",
|
|
75
|
+
"@faststore/lighthouse": "4.10.1-dev.6",
|
|
76
|
+
"@faststore/diagnostics": "4.10.1-dev.6",
|
|
77
|
+
"@faststore/ui": "4.10.1-dev.6",
|
|
78
|
+
"@faststore/sdk": "4.10.1-dev.6"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@cypress/code-coverage": "^3.12.1",
|
|
@@ -69,6 +69,69 @@ export const query = gql(`
|
|
|
69
69
|
|
|
70
70
|
const getKey = (object: any) => JSON.stringify(object)
|
|
71
71
|
|
|
72
|
+
const isDeliveryPromiseEnabled = storeConfig.deliveryPromise?.enabled ?? false
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Cache-only keys that scope gallery pages to the shopper context. They make
|
|
76
|
+
* the local cache comparison (and the SWR key) miss when a page was loaded for
|
|
77
|
+
* another context (e.g. the anonymous SSG page). They are not declared by the
|
|
78
|
+
* operation, so the API ignores them, but they are still sent with the
|
|
79
|
+
* variables, which go in the URL because this query is a GET operation.
|
|
80
|
+
* - `_postalCode`: pages are invalidated on region change. Only applied when
|
|
81
|
+
* deliveryPromise is enabled to avoid unnecessary cache fragmentation.
|
|
82
|
+
* - `_contract`: the B2B contract assortment is applied server-side from the
|
|
83
|
+
* session cookie, so it never shows up in the query variables. Keyed off
|
|
84
|
+
* the presence of a `b2b` session (not `customerId`'s value) because
|
|
85
|
+
* `customerId` can resolve to an empty string for a legitimate B2B buyer
|
|
86
|
+
* (see `buildB2bSession` in `@faststore/api`). The fallback chain still
|
|
87
|
+
* forces the re-fetch for them: the real `customerId`, when present, keeps
|
|
88
|
+
* invalidating the cache on contract switch; otherwise the organizational
|
|
89
|
+
* unit (`unitId`) tells buyers of different units apart; a generic marker is
|
|
90
|
+
* the last resort. Since the value ends up in the URL, it is hashed so the
|
|
91
|
+
* raw contract or unit id is not written to access, CDN or RUM logs as is.
|
|
92
|
+
* These ids are not secrets (the session already hands them to the
|
|
93
|
+
* browser), so the hash is cosmetic, not a privacy control: it is unkeyed
|
|
94
|
+
* and a guessable id can be recovered from it. The URL still differs per
|
|
95
|
+
* contract, so a contract page is never served from the anonymous page's
|
|
96
|
+
* cache entry.
|
|
97
|
+
*/
|
|
98
|
+
const getShopperScope = ({
|
|
99
|
+
postalCode,
|
|
100
|
+
contract,
|
|
101
|
+
}: {
|
|
102
|
+
postalCode?: string | null
|
|
103
|
+
contract?: string | null
|
|
104
|
+
}) => ({
|
|
105
|
+
...(isDeliveryPromiseEnabled && { _postalCode: postalCode ?? '' }),
|
|
106
|
+
...(contract && { _contract: hashContractScope(contract) }),
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
/** The id a B2B session is scoped by, or `null` outside a B2B session. */
|
|
110
|
+
const getContractScope = (
|
|
111
|
+
b2b?: { customerId?: string | null; unitId?: string | null } | null
|
|
112
|
+
) => (b2b ? b2b.customerId || b2b.unitId || 'b2b' : null)
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* 53-bit string hash (cyrb53): wide enough that two contracts in the same
|
|
116
|
+
* browser never share a cache key in practice, without exposing the raw id.
|
|
117
|
+
*/
|
|
118
|
+
export function hashContractScope(value: string) {
|
|
119
|
+
let h1 = 0xdeadbeef
|
|
120
|
+
let h2 = 0x41c6ce57
|
|
121
|
+
for (const char of value) {
|
|
122
|
+
const code = char.codePointAt(0) ?? 0
|
|
123
|
+
h1 = Math.imul(h1 ^ code, 2654435761)
|
|
124
|
+
h2 = Math.imul(h2 ^ code, 1597334677)
|
|
125
|
+
}
|
|
126
|
+
h1 =
|
|
127
|
+
Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^
|
|
128
|
+
Math.imul(h2 ^ (h2 >>> 13), 3266489909)
|
|
129
|
+
h2 =
|
|
130
|
+
Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^
|
|
131
|
+
Math.imul(h1 ^ (h1 >>> 13), 3266489909)
|
|
132
|
+
return (4294967296 * (2097151 & h2) + (h1 >>> 0)).toString(36)
|
|
133
|
+
}
|
|
134
|
+
|
|
72
135
|
interface UseCreateUseGalleryPageProps {
|
|
73
136
|
initialPages: ClientManyProductsQueryWithSearchIdQuery
|
|
74
137
|
serverManyProductsVariables: ClientManyProductsQueryWithSearchIdQueryVariables
|
|
@@ -82,21 +145,17 @@ export const useCreateUseGalleryPage = (
|
|
|
82
145
|
) => {
|
|
83
146
|
const initialPages = params?.initialPages?.search ? [params.initialPages] : []
|
|
84
147
|
|
|
85
|
-
// Seed the cache with the same
|
|
86
|
-
//
|
|
87
|
-
//
|
|
88
|
-
|
|
148
|
+
// Seed the cache with the same key shape that useGalleryPage uses, so
|
|
149
|
+
// hasSameVariables matches on first mount and avoids an unnecessary re-fetch
|
|
150
|
+
// of the SSR-loaded page. The SSG page is built without a buyer, so it is
|
|
151
|
+
// seeded without a contract: B2B buyers re-fetch it with their assortment.
|
|
89
152
|
const { postalCode } = useSession()
|
|
90
153
|
const initialVariables = params?.serverManyProductsVariables
|
|
91
154
|
? [
|
|
92
|
-
getKey(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
_postalCode: postalCode ?? '',
|
|
97
|
-
}
|
|
98
|
-
: params.serverManyProductsVariables
|
|
99
|
-
),
|
|
155
|
+
getKey({
|
|
156
|
+
...params.serverManyProductsVariables,
|
|
157
|
+
...getShopperScope({ postalCode }),
|
|
158
|
+
}),
|
|
100
159
|
]
|
|
101
160
|
: []
|
|
102
161
|
|
|
@@ -113,7 +172,7 @@ export const useCreateUseGalleryPage = (
|
|
|
113
172
|
itemsPerPage,
|
|
114
173
|
} = useSearch()
|
|
115
174
|
|
|
116
|
-
const { postalCode, isValidating: isSessionValidating } = useSession()
|
|
175
|
+
const { postalCode, b2b, isValidating: isSessionValidating } = useSession()
|
|
117
176
|
|
|
118
177
|
const localizedVariables = useLocalizedVariables({
|
|
119
178
|
first: itemsPerPage,
|
|
@@ -123,15 +182,15 @@ export const useCreateUseGalleryPage = (
|
|
|
123
182
|
selectedFacets,
|
|
124
183
|
})
|
|
125
184
|
|
|
126
|
-
//
|
|
127
|
-
//
|
|
128
|
-
|
|
185
|
+
// Keyed on the contract id, not the `b2b` object, which is rebuilt on
|
|
186
|
+
// every session update.
|
|
187
|
+
const contract = getContractScope(b2b)
|
|
129
188
|
const localizedVariablesWithRegion = useMemo(
|
|
130
|
-
() =>
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
[localizedVariables, postalCode]
|
|
189
|
+
() => ({
|
|
190
|
+
...localizedVariables,
|
|
191
|
+
...getShopperScope({ postalCode, contract }),
|
|
192
|
+
}),
|
|
193
|
+
[localizedVariables, postalCode, contract]
|
|
135
194
|
)
|
|
136
195
|
|
|
137
196
|
const hasSameVariables = deepEquals(
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vitest-environment jsdom
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { renderHook } from '@testing-library/react'
|
|
6
|
+
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
7
|
+
|
|
8
|
+
const mockUseSession = vi.hoisted(() => vi.fn())
|
|
9
|
+
const mockUseQuery = vi.hoisted(() => vi.fn())
|
|
10
|
+
const mockUseLocalizedVariables = vi.hoisted(() => vi.fn())
|
|
11
|
+
|
|
12
|
+
vi.mock('@generated', () => ({ gql: (query: unknown) => query }))
|
|
13
|
+
vi.mock('discovery.config', () => ({
|
|
14
|
+
default: { deliveryPromise: { enabled: false } },
|
|
15
|
+
}))
|
|
16
|
+
vi.mock('@faststore/sdk', () => ({
|
|
17
|
+
useSearch: () => ({
|
|
18
|
+
state: { sort: 'score_desc', term: '', selectedFacets: [] },
|
|
19
|
+
itemsPerPage: 12,
|
|
20
|
+
}),
|
|
21
|
+
}))
|
|
22
|
+
vi.mock('src/sdk/session', () => ({ useSession: mockUseSession }))
|
|
23
|
+
vi.mock('src/sdk/graphql/useQuery', () => ({ useQuery: mockUseQuery }))
|
|
24
|
+
vi.mock('src/sdk/product/useLocalizedVariables', () => ({
|
|
25
|
+
useLocalizedVariables: mockUseLocalizedVariables,
|
|
26
|
+
}))
|
|
27
|
+
|
|
28
|
+
import {
|
|
29
|
+
hashContractScope,
|
|
30
|
+
useCreateUseGalleryPage,
|
|
31
|
+
} from '../../../src/sdk/product/usePageProductsQuery'
|
|
32
|
+
|
|
33
|
+
const serverManyProductsVariables = {
|
|
34
|
+
first: 12,
|
|
35
|
+
after: '0',
|
|
36
|
+
sort: 'score_desc' as const,
|
|
37
|
+
term: '',
|
|
38
|
+
selectedFacets: [
|
|
39
|
+
{ key: 'category-1', value: 'computers---tablets' },
|
|
40
|
+
{ key: 'channel', value: '{"salesChannel":"1"}' },
|
|
41
|
+
{ key: 'locale', value: 'en-CA' },
|
|
42
|
+
],
|
|
43
|
+
sponsoredCount: 3,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
type GalleryProps = NonNullable<Parameters<typeof useCreateUseGalleryPage>[0]>
|
|
47
|
+
|
|
48
|
+
const initialPages = {
|
|
49
|
+
search: { products: { pageInfo: { totalCount: 2 }, edges: [] } },
|
|
50
|
+
} as unknown as GalleryProps['initialPages']
|
|
51
|
+
|
|
52
|
+
const renderFirstGalleryPage = () => {
|
|
53
|
+
const { result: created } = renderHook(() =>
|
|
54
|
+
useCreateUseGalleryPage({ initialPages, serverManyProductsVariables })
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
return renderHook(() => created.current.useGalleryPage(0))
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
describe('useCreateUseGalleryPage', () => {
|
|
61
|
+
afterEach(() => {
|
|
62
|
+
vi.clearAllMocks()
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
it('reuses the SSG first page for anonymous shoppers', () => {
|
|
66
|
+
mockUseSession.mockReturnValue({
|
|
67
|
+
postalCode: null,
|
|
68
|
+
b2b: null,
|
|
69
|
+
isValidating: false,
|
|
70
|
+
})
|
|
71
|
+
mockUseLocalizedVariables.mockReturnValue(serverManyProductsVariables)
|
|
72
|
+
mockUseQuery.mockReturnValue({ data: null })
|
|
73
|
+
|
|
74
|
+
const { result } = renderFirstGalleryPage()
|
|
75
|
+
|
|
76
|
+
expect(mockUseQuery).toHaveBeenCalledWith(
|
|
77
|
+
expect.anything(),
|
|
78
|
+
serverManyProductsVariables,
|
|
79
|
+
expect.objectContaining({ doNotRun: true })
|
|
80
|
+
)
|
|
81
|
+
expect(result.current.data).toBe(initialPages)
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
it('re-fetches the first page for B2B buyers so the contract assortment applies', () => {
|
|
85
|
+
mockUseSession.mockReturnValue({
|
|
86
|
+
postalCode: null,
|
|
87
|
+
b2b: { customerId: 'contract-137' },
|
|
88
|
+
isValidating: false,
|
|
89
|
+
})
|
|
90
|
+
mockUseLocalizedVariables.mockReturnValue(serverManyProductsVariables)
|
|
91
|
+
mockUseQuery.mockReturnValue({ data: null })
|
|
92
|
+
|
|
93
|
+
renderFirstGalleryPage()
|
|
94
|
+
|
|
95
|
+
expect(mockUseQuery).toHaveBeenCalledWith(
|
|
96
|
+
expect.anything(),
|
|
97
|
+
{
|
|
98
|
+
...serverManyProductsVariables,
|
|
99
|
+
_contract: hashContractScope('contract-137'),
|
|
100
|
+
},
|
|
101
|
+
expect.objectContaining({ doNotRun: false })
|
|
102
|
+
)
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
it('still re-fetches for B2B buyers whose customerId resolves to an empty string', () => {
|
|
106
|
+
// `buildB2bSession` in @faststore/api can resolve `customerId` to `''`
|
|
107
|
+
// (see validateSessionHelpers.ts) even for a representative with an
|
|
108
|
+
// active contract. The fix must not depend on the value being truthy —
|
|
109
|
+
// only on the `b2b` session existing — or it silently falls back to the
|
|
110
|
+
// anonymous behavior (reusing the unfiltered SSG page).
|
|
111
|
+
mockUseSession.mockReturnValue({
|
|
112
|
+
postalCode: null,
|
|
113
|
+
b2b: { customerId: '' },
|
|
114
|
+
isValidating: false,
|
|
115
|
+
})
|
|
116
|
+
mockUseLocalizedVariables.mockReturnValue(serverManyProductsVariables)
|
|
117
|
+
mockUseQuery.mockReturnValue({ data: null })
|
|
118
|
+
|
|
119
|
+
renderFirstGalleryPage()
|
|
120
|
+
|
|
121
|
+
expect(mockUseQuery).toHaveBeenCalledWith(
|
|
122
|
+
expect.anything(),
|
|
123
|
+
{ ...serverManyProductsVariables, _contract: hashContractScope('b2b') },
|
|
124
|
+
expect.objectContaining({ doNotRun: false })
|
|
125
|
+
)
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
it('hashes the contract scope to a stable value', () => {
|
|
129
|
+
// Golden value: catches a change to the hash itself, which the other
|
|
130
|
+
// tests miss because they derive their expectations from it.
|
|
131
|
+
expect(hashContractScope('contract-137')).toBe('185k3l4sd4t')
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
it('keeps the raw contract id out of the query variables', () => {
|
|
135
|
+
mockUseSession.mockReturnValue({
|
|
136
|
+
postalCode: null,
|
|
137
|
+
b2b: { customerId: 'contract-137', unitId: 'unit-42' },
|
|
138
|
+
isValidating: false,
|
|
139
|
+
})
|
|
140
|
+
mockUseLocalizedVariables.mockReturnValue(serverManyProductsVariables)
|
|
141
|
+
mockUseQuery.mockReturnValue({ data: null })
|
|
142
|
+
|
|
143
|
+
renderFirstGalleryPage()
|
|
144
|
+
|
|
145
|
+
// The variables go in the GET URL, so they must not carry the raw ids.
|
|
146
|
+
const variables = JSON.stringify(mockUseQuery.mock.calls.at(-1)?.[1])
|
|
147
|
+
expect(variables).not.toContain('contract-137')
|
|
148
|
+
expect(variables).not.toContain('unit-42')
|
|
149
|
+
expect(hashContractScope('contract-a')).not.toBe(
|
|
150
|
+
hashContractScope('contract-b')
|
|
151
|
+
)
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
it('tells B2B buyers apart by organizational unit when customerId is empty', () => {
|
|
155
|
+
mockUseSession.mockReturnValue({
|
|
156
|
+
postalCode: null,
|
|
157
|
+
b2b: { customerId: '', unitId: 'unit-42' },
|
|
158
|
+
isValidating: false,
|
|
159
|
+
})
|
|
160
|
+
mockUseLocalizedVariables.mockReturnValue(serverManyProductsVariables)
|
|
161
|
+
mockUseQuery.mockReturnValue({ data: null })
|
|
162
|
+
|
|
163
|
+
renderFirstGalleryPage()
|
|
164
|
+
|
|
165
|
+
expect(mockUseQuery).toHaveBeenCalledWith(
|
|
166
|
+
expect.anything(),
|
|
167
|
+
{
|
|
168
|
+
...serverManyProductsVariables,
|
|
169
|
+
_contract: hashContractScope('unit-42'),
|
|
170
|
+
},
|
|
171
|
+
expect.objectContaining({ doNotRun: false })
|
|
172
|
+
)
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
it('re-fetches the first page when the buyer switches contract', () => {
|
|
176
|
+
const contractPage = {
|
|
177
|
+
search: { products: { pageInfo: { totalCount: 1 }, edges: [] } },
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
mockUseSession.mockReturnValue({
|
|
181
|
+
postalCode: null,
|
|
182
|
+
b2b: { customerId: 'contract-a' },
|
|
183
|
+
isValidating: false,
|
|
184
|
+
})
|
|
185
|
+
mockUseLocalizedVariables.mockReturnValue(serverManyProductsVariables)
|
|
186
|
+
mockUseQuery.mockReturnValue({ data: contractPage })
|
|
187
|
+
|
|
188
|
+
const { result: created } = renderHook(() =>
|
|
189
|
+
useCreateUseGalleryPage({ initialPages, serverManyProductsVariables })
|
|
190
|
+
)
|
|
191
|
+
const { rerender } = renderHook(() => created.current.useGalleryPage(0))
|
|
192
|
+
|
|
193
|
+
mockUseSession.mockReturnValue({
|
|
194
|
+
postalCode: null,
|
|
195
|
+
b2b: { customerId: 'contract-b' },
|
|
196
|
+
isValidating: false,
|
|
197
|
+
})
|
|
198
|
+
rerender()
|
|
199
|
+
|
|
200
|
+
expect(mockUseQuery).toHaveBeenLastCalledWith(
|
|
201
|
+
expect.anything(),
|
|
202
|
+
{
|
|
203
|
+
...serverManyProductsVariables,
|
|
204
|
+
_contract: hashContractScope('contract-b'),
|
|
205
|
+
},
|
|
206
|
+
expect.objectContaining({ doNotRun: false })
|
|
207
|
+
)
|
|
208
|
+
})
|
|
209
|
+
|
|
210
|
+
it('stops scoping the first page once the B2B session ends', () => {
|
|
211
|
+
const contractPage = {
|
|
212
|
+
search: { products: { pageInfo: { totalCount: 1 }, edges: [] } },
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
mockUseSession.mockReturnValue({
|
|
216
|
+
postalCode: null,
|
|
217
|
+
b2b: { customerId: 'contract-a' },
|
|
218
|
+
isValidating: false,
|
|
219
|
+
})
|
|
220
|
+
mockUseLocalizedVariables.mockReturnValue(serverManyProductsVariables)
|
|
221
|
+
mockUseQuery.mockReturnValue({ data: contractPage })
|
|
222
|
+
|
|
223
|
+
const { result: created } = renderHook(() =>
|
|
224
|
+
useCreateUseGalleryPage({ initialPages, serverManyProductsVariables })
|
|
225
|
+
)
|
|
226
|
+
const { rerender } = renderHook(() => created.current.useGalleryPage(0))
|
|
227
|
+
|
|
228
|
+
mockUseSession.mockReturnValue({
|
|
229
|
+
postalCode: null,
|
|
230
|
+
b2b: null,
|
|
231
|
+
isValidating: false,
|
|
232
|
+
})
|
|
233
|
+
rerender()
|
|
234
|
+
|
|
235
|
+
expect(mockUseQuery).toHaveBeenLastCalledWith(
|
|
236
|
+
expect.anything(),
|
|
237
|
+
serverManyProductsVariables,
|
|
238
|
+
expect.objectContaining({ doNotRun: false })
|
|
239
|
+
)
|
|
240
|
+
})
|
|
241
|
+
|
|
242
|
+
it('ignores the postal code while deliveryPromise is disabled', () => {
|
|
243
|
+
mockUseSession.mockReturnValue({
|
|
244
|
+
postalCode: '01310-100',
|
|
245
|
+
b2b: null,
|
|
246
|
+
isValidating: false,
|
|
247
|
+
})
|
|
248
|
+
mockUseLocalizedVariables.mockReturnValue(serverManyProductsVariables)
|
|
249
|
+
mockUseQuery.mockReturnValue({ data: null })
|
|
250
|
+
|
|
251
|
+
const { result } = renderFirstGalleryPage()
|
|
252
|
+
|
|
253
|
+
expect(mockUseQuery).toHaveBeenCalledWith(
|
|
254
|
+
expect.anything(),
|
|
255
|
+
serverManyProductsVariables,
|
|
256
|
+
expect.objectContaining({ doNotRun: true })
|
|
257
|
+
)
|
|
258
|
+
expect(result.current.data).toBe(initialPages)
|
|
259
|
+
})
|
|
260
|
+
})
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vitest-environment jsdom
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { renderHook } from '@testing-library/react'
|
|
6
|
+
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
7
|
+
|
|
8
|
+
const mockUseSession = vi.hoisted(() => vi.fn())
|
|
9
|
+
const mockUseQuery = vi.hoisted(() => vi.fn())
|
|
10
|
+
const mockUseLocalizedVariables = vi.hoisted(() => vi.fn())
|
|
11
|
+
|
|
12
|
+
vi.mock('@generated', () => ({ gql: (query: unknown) => query }))
|
|
13
|
+
vi.mock('discovery.config', () => ({
|
|
14
|
+
default: { deliveryPromise: { enabled: true } },
|
|
15
|
+
}))
|
|
16
|
+
vi.mock('@faststore/sdk', () => ({
|
|
17
|
+
useSearch: () => ({
|
|
18
|
+
state: { sort: 'score_desc', term: '', selectedFacets: [] },
|
|
19
|
+
itemsPerPage: 12,
|
|
20
|
+
}),
|
|
21
|
+
}))
|
|
22
|
+
vi.mock('src/sdk/session', () => ({ useSession: mockUseSession }))
|
|
23
|
+
vi.mock('src/sdk/graphql/useQuery', () => ({ useQuery: mockUseQuery }))
|
|
24
|
+
vi.mock('src/sdk/product/useLocalizedVariables', () => ({
|
|
25
|
+
useLocalizedVariables: mockUseLocalizedVariables,
|
|
26
|
+
}))
|
|
27
|
+
|
|
28
|
+
import {
|
|
29
|
+
hashContractScope,
|
|
30
|
+
useCreateUseGalleryPage,
|
|
31
|
+
} from '../../../src/sdk/product/usePageProductsQuery'
|
|
32
|
+
|
|
33
|
+
const serverManyProductsVariables = {
|
|
34
|
+
first: 12,
|
|
35
|
+
after: '0',
|
|
36
|
+
sort: 'score_desc' as const,
|
|
37
|
+
term: '',
|
|
38
|
+
selectedFacets: [
|
|
39
|
+
{ key: 'category-1', value: 'computers---tablets' },
|
|
40
|
+
{ key: 'channel', value: '{"salesChannel":"1"}' },
|
|
41
|
+
{ key: 'locale', value: 'en-CA' },
|
|
42
|
+
],
|
|
43
|
+
sponsoredCount: 3,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
type GalleryProps = NonNullable<Parameters<typeof useCreateUseGalleryPage>[0]>
|
|
47
|
+
|
|
48
|
+
const initialPages = {
|
|
49
|
+
search: { products: { pageInfo: { totalCount: 2 }, edges: [] } },
|
|
50
|
+
} as unknown as GalleryProps['initialPages']
|
|
51
|
+
|
|
52
|
+
const renderFirstGalleryPage = () => {
|
|
53
|
+
const { result: created } = renderHook(() =>
|
|
54
|
+
useCreateUseGalleryPage({ initialPages, serverManyProductsVariables })
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
return renderHook(() => created.current.useGalleryPage(0))
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// `isDeliveryPromiseEnabled` is read when the module loads, so this scenario
|
|
61
|
+
// needs its own file with the flag mocked on.
|
|
62
|
+
describe('useCreateUseGalleryPage with deliveryPromise enabled', () => {
|
|
63
|
+
afterEach(() => {
|
|
64
|
+
vi.clearAllMocks()
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
it('scopes the page by postal code and contract together for B2B buyers', () => {
|
|
68
|
+
mockUseSession.mockReturnValue({
|
|
69
|
+
postalCode: '01310-100',
|
|
70
|
+
b2b: { customerId: 'contract-137' },
|
|
71
|
+
isValidating: false,
|
|
72
|
+
})
|
|
73
|
+
mockUseLocalizedVariables.mockReturnValue(serverManyProductsVariables)
|
|
74
|
+
mockUseQuery.mockReturnValue({ data: null })
|
|
75
|
+
|
|
76
|
+
renderFirstGalleryPage()
|
|
77
|
+
|
|
78
|
+
expect(mockUseQuery).toHaveBeenCalledWith(
|
|
79
|
+
expect.anything(),
|
|
80
|
+
{
|
|
81
|
+
...serverManyProductsVariables,
|
|
82
|
+
_postalCode: '01310-100',
|
|
83
|
+
_contract: hashContractScope('contract-137'),
|
|
84
|
+
},
|
|
85
|
+
expect.objectContaining({ doNotRun: false })
|
|
86
|
+
)
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
it('still reuses the SSG page for an anonymous shopper with a postal code', () => {
|
|
90
|
+
mockUseSession.mockReturnValue({
|
|
91
|
+
postalCode: '01310-100',
|
|
92
|
+
b2b: null,
|
|
93
|
+
isValidating: false,
|
|
94
|
+
})
|
|
95
|
+
mockUseLocalizedVariables.mockReturnValue(serverManyProductsVariables)
|
|
96
|
+
mockUseQuery.mockReturnValue({ data: null })
|
|
97
|
+
|
|
98
|
+
const { result } = renderFirstGalleryPage()
|
|
99
|
+
|
|
100
|
+
expect(mockUseQuery).toHaveBeenCalledWith(
|
|
101
|
+
expect.anything(),
|
|
102
|
+
{ ...serverManyProductsVariables, _postalCode: '01310-100' },
|
|
103
|
+
expect.objectContaining({ doNotRun: true })
|
|
104
|
+
)
|
|
105
|
+
expect(result.current.data).toBe(initialPages)
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
it('re-fetches when the postal code changed after the SSG page was seeded', () => {
|
|
109
|
+
mockUseSession.mockReturnValueOnce({
|
|
110
|
+
postalCode: null,
|
|
111
|
+
b2b: null,
|
|
112
|
+
isValidating: false,
|
|
113
|
+
})
|
|
114
|
+
mockUseSession.mockReturnValue({
|
|
115
|
+
postalCode: '01310-100',
|
|
116
|
+
b2b: null,
|
|
117
|
+
isValidating: false,
|
|
118
|
+
})
|
|
119
|
+
mockUseLocalizedVariables.mockReturnValue(serverManyProductsVariables)
|
|
120
|
+
mockUseQuery.mockReturnValue({ data: null })
|
|
121
|
+
|
|
122
|
+
renderFirstGalleryPage()
|
|
123
|
+
|
|
124
|
+
expect(mockUseQuery).toHaveBeenCalledWith(
|
|
125
|
+
expect.anything(),
|
|
126
|
+
{ ...serverManyProductsVariables, _postalCode: '01310-100' },
|
|
127
|
+
expect.objectContaining({ doNotRun: false })
|
|
128
|
+
)
|
|
129
|
+
})
|
|
130
|
+
})
|