Skip to content

Commit

Permalink
Revert "test(useStorageState): add test case (#2106)"
Browse files Browse the repository at this point in the history
This reverts commit 37749a3.
  • Loading branch information
liuyib committed Mar 20, 2023
1 parent 1140fb9 commit e77c4fc
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions packages/hooks/src/useLocalStorageState/__tests__/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { renderHook, act } from '@testing-library/react';
import useLocalStorageState from '../index';
import 'jest-localstorage-mock';

describe('useLocalStorageState', () => {
const setUp = <T>(key: string, value: T) =>
Expand Down Expand Up @@ -107,13 +106,4 @@ describe('useLocalStorageState', () => {
});
expect(hook.result.current.state).toBe('hello world, zhangsan');
});

it('should save the default value in localStorage', () => {
const LOCAL_STORAGE_KEY = 'test-default-value-key';
const defaultValue = 'Hello';
const hook = setUp(LOCAL_STORAGE_KEY, defaultValue);
expect(hook.result.current.state).toBe(defaultValue);
const localStorageValue = localStorage.getItem(LOCAL_STORAGE_KEY);
expect(localStorageValue).toBe(JSON.stringify(defaultValue));
});
});

0 comments on commit e77c4fc

Please sign in to comment.