From 5747ddb42ceaf92c65609b2d35ba2e7e0c789b42 Mon Sep 17 00:00:00 2001 From: gunshiz Date: Thu, 8 Oct 2026 18:57:09 +0700 Subject: [PATCH] test(notifications) : mock local storage for push subscription tests --- tests/site-push-client.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/site-push-client.test.ts b/tests/site-push-client.test.ts index 54b8fca..0cf15c7 100644 --- a/tests/site-push-client.test.ts +++ b/tests/site-push-client.test.ts @@ -1,5 +1,6 @@ -import { afterEach, describe, expect, it, vi } from 'vitest'; +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { syncSitePush } from '@/components/notifications/push-client'; +beforeEach(() => vi.stubGlobal('localStorage', { getItem: vi.fn().mockReturnValue(null) })); afterEach(() => vi.unstubAllGlobals()); describe('shared site push subscriptions', () => { for (const admin of [false, true]) it(`registers comments and commission with one ${admin ? 'admin' : 'customer'} browser subscription`, async () => {