diff --git a/src/pages/StorageCleaner/__tests__/index.test.tsx b/src/pages/StorageCleaner/__tests__/index.test.tsx index bf5f345..4431570 100644 --- a/src/pages/StorageCleaner/__tests__/index.test.tsx +++ b/src/pages/StorageCleaner/__tests__/index.test.tsx @@ -12,7 +12,6 @@ vi.mock('@/utils/chromeStorage', () => ({ vi.mock('@/utils/storageCleaner', () => ({ getCurrentTab: vi.fn().mockResolvedValue({ id: 1, url: 'https://example.com' }), - isRestrictedUrl: vi.fn().mockReturnValue(false), getCookieSize: vi.fn().mockResolvedValue(0), getLocalStorageSize: vi.fn().mockResolvedValue(0), getSessionStorageSize: vi.fn().mockResolvedValue(0), diff --git a/src/pages/StorageCleaner/useStorageCleaner.ts b/src/pages/StorageCleaner/useStorageCleaner.ts index f4ef60c..5d5bd43 100644 --- a/src/pages/StorageCleaner/useStorageCleaner.ts +++ b/src/pages/StorageCleaner/useStorageCleaner.ts @@ -14,8 +14,8 @@ import { getOriginStorageEstimate, getServiceWorkerCount, getSessionStorageSize, - isRestrictedUrl, } from '@/utils/storageCleaner'; +import { isRestrictedUrl } from '@/utils/restrictedUrls'; import { toast } from 'sonner'; const DEFAULT_OPTIONS: StorageCleanerOptions = { diff --git a/src/utils/__tests__/storageCleaner.test.ts b/src/utils/__tests__/storageCleaner.test.ts index 9137a38..a4e9787 100644 --- a/src/utils/__tests__/storageCleaner.test.ts +++ b/src/utils/__tests__/storageCleaner.test.ts @@ -1,54 +1,8 @@ import { describe, expect, it } from 'vitest'; -import { clearCookies, isRestrictedUrl } from '@/utils/storageCleaner'; +import { clearCookies } from '@/utils/storageCleaner'; import { formatBytes } from '@/utils/format'; describe('storageCleaner utils', () => { - describe('isRestrictedUrl', () => { - it('should return true for chrome:// URLs', () => { - expect(isRestrictedUrl('chrome://settings')).toBe(true); - }); - - it('should return true for chrome-extension:// URLs', () => { - expect(isRestrictedUrl('chrome-extension://abc123/background.html')).toBe(true); - }); - - it('should return true for about:// URLs', () => { - expect(isRestrictedUrl('about:blank')).toBe(true); - }); - - it('should return true for edge:// URLs', () => { - expect(isRestrictedUrl('edge://settings')).toBe(true); - }); - - it('should return true for view-source:// URLs', () => { - expect(isRestrictedUrl('view-source:https://example.com')).toBe(true); - }); - - it('should return true for file:// URLs', () => { - expect(isRestrictedUrl('file:///path/to/file')).toBe(true); - }); - - it('should return true for data:// URLs', () => { - expect(isRestrictedUrl('data:text/html,

Hello

')).toBe(true); - }); - - it('should return false for http:// URLs', () => { - expect(isRestrictedUrl('http://example.com')).toBe(false); - }); - - it('should return false for https:// URLs', () => { - expect(isRestrictedUrl('https://example.com')).toBe(false); - }); - - it('should return true for undefined URL', () => { - expect(isRestrictedUrl(undefined)).toBe(true); - }); - - it('should return true for empty string', () => { - expect(isRestrictedUrl('')).toBe(true); - }); - }); - describe('formatBytes', () => { it('should return "0 B" for 0 bytes', () => { expect(formatBytes(0)).toBe('0 B'); diff --git a/src/utils/storageCleaner.ts b/src/utils/storageCleaner.ts index fecaf39..9c23099 100644 --- a/src/utils/storageCleaner.ts +++ b/src/utils/storageCleaner.ts @@ -1,6 +1,5 @@ import type { CleaningResult, StorageCleanerOptions, StorageCleanResult } from '@/types/storage'; import { CLEAN_OPTION_KEYS, OPTION_LABELS } from '@/pages/StorageCleaner/constants'; -export { isRestrictedUrl } from '@/utils/restrictedUrls'; export async function getCurrentTab() { // For popup pages, we need to get the active tab from the browser window that triggered the popup.