diff --git a/packages/theme/src/cli/utilities/theme-environment/storefront-session.test.ts b/packages/theme/src/cli/utilities/theme-environment/storefront-session.test.ts index ff27317564..5c25602acd 100644 --- a/packages/theme/src/cli/utilities/theme-environment/storefront-session.test.ts +++ b/packages/theme/src/cli/utilities/theme-environment/storefront-session.test.ts @@ -83,6 +83,21 @@ describe('Storefront API', () => { // Then expect(isProtected).toBe(false) }) + + test('ignores query params', async () => { + // Given + vi.mocked(fetch) + .mockResolvedValueOnce(response({status: 200, url: 'https://store.myshopify.com/random?a=b'})) + .mockResolvedValueOnce(response({status: 200, url: 'https://store.myshopify.com/password?a=b'})) + + // When + const redirectToRandomPath = await isStorefrontPasswordProtected('store.myshopify.com') + const redirectToPasswordPath = await isStorefrontPasswordProtected('store.myshopify.com') + + // Then + expect(redirectToRandomPath).toBe(false) + expect(redirectToPasswordPath).toBe(true) + }) }) describe('getStorefrontSessionCookies', () => { diff --git a/packages/theme/src/cli/utilities/theme-environment/storefront-session.ts b/packages/theme/src/cli/utilities/theme-environment/storefront-session.ts index d8bbb15731..b7510e0d79 100644 --- a/packages/theme/src/cli/utilities/theme-environment/storefront-session.ts +++ b/packages/theme/src/cli/utilities/theme-environment/storefront-session.ts @@ -11,7 +11,8 @@ export async function isStorefrontPasswordProtected(storeURL: string): Promise