From 9fbb2028d351e7effc2c02c0c43507760da01da7 Mon Sep 17 00:00:00 2001 From: Mehul Aggarwal <88583647+AceHunterr@users.noreply.github.com> Date: Wed, 25 Dec 2024 03:52:24 +0530 Subject: [PATCH] Refactored .\src\utils\useLocalstorage.test.ts from Jest to Vitest (#2844) --- ...seLocalstorage.test.ts => useLocalstorage.spec.ts} | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) rename src/utils/{useLocalstorage.test.ts => useLocalstorage.spec.ts} (91%) diff --git a/src/utils/useLocalstorage.test.ts b/src/utils/useLocalstorage.spec.ts similarity index 91% rename from src/utils/useLocalstorage.test.ts rename to src/utils/useLocalstorage.spec.ts index 7483da4da2..b84cbd86cf 100644 --- a/src/utils/useLocalstorage.test.ts +++ b/src/utils/useLocalstorage.spec.ts @@ -1,3 +1,5 @@ +// SKIP_LOCALSTORAGE_CHECK + import { getStorageKey, getItem, @@ -5,6 +7,7 @@ import { removeItem, useLocalStorage, } from './useLocalstorage'; +import { describe, it, expect, beforeEach, vi } from 'vitest'; describe('Storage Helper Functions', () => { beforeEach(() => { @@ -95,7 +98,7 @@ describe('Storage Helper Functions', () => { const storageHelper = useLocalStorage(customPrefix); const key = 'testKey'; - const spyGetStorageKey = jest.spyOn(storageHelper, 'getStorageKey'); + const spyGetStorageKey = vi.spyOn(storageHelper, 'getStorageKey'); storageHelper.getStorageKey(key); expect(spyGetStorageKey).toHaveBeenCalledWith(key); @@ -106,7 +109,7 @@ describe('Storage Helper Functions', () => { const storageHelper = useLocalStorage(customPrefix); const key = 'testKey'; - const spyGetItem = jest.spyOn(storageHelper, 'getItem'); + const spyGetItem = vi.spyOn(storageHelper, 'getItem'); storageHelper.getItem(key); expect(spyGetItem).toHaveBeenCalledWith(key); @@ -118,7 +121,7 @@ describe('Storage Helper Functions', () => { const key = 'testKey'; const value = 'data'; - const spySetItem = jest.spyOn(storageHelper, 'setItem'); + const spySetItem = vi.spyOn(storageHelper, 'setItem'); storageHelper.setItem(key, value); expect(spySetItem).toHaveBeenCalledWith(key, value); @@ -129,7 +132,7 @@ describe('Storage Helper Functions', () => { const storageHelper = useLocalStorage(customPrefix); const key = 'testKey'; - const spyRemoveItem = jest.spyOn(storageHelper, 'removeItem'); + const spyRemoveItem = vi.spyOn(storageHelper, 'removeItem'); storageHelper.removeItem(key); expect(spyRemoveItem).toHaveBeenCalledWith(key);