Skip to content

Commit 7ba5831

Browse files
committed
Update imports
1 parent 53e6624 commit 7ba5831

File tree

3 files changed

+3
-38
lines changed

3 files changed

+3
-38
lines changed

tests/useLocalStorageReducer.test.ts

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { act, renderHook } from '@testing-library/react-hooks';
2-
3-
import useLocalStorageReducer, { createLocalStorageDispatcher } from '../src/useLocalStorageReducer/useLocalStorageReducer';
2+
import { useLocalStorageReducer } from '../src';
43

54
describe('useLocalStorageReducer', () => {
65
it('dispatch calls the reducer with two arguments', () => {
@@ -234,36 +233,3 @@ describe('useLocalStorageReducer', () => {
234233
expect(localStorage.getItem('objects')).toBe(JSON.stringify(initialState));
235234
});
236235
});
237-
238-
describe('dispatch function', () => {
239-
it('updates localStorage', () => {
240-
localStorage.removeItem('number');
241-
242-
const reducer = jest.fn((state, type: string) => {
243-
switch(type) {
244-
case 'RESET':
245-
return 0;
246-
case 'INCREMENT':
247-
return state + 1;
248-
case 'DECREMENT':
249-
return state - 1;
250-
default:
251-
return -1;
252-
};
253-
});
254-
255-
const dispatcher = createLocalStorageDispatcher('number', reducer);
256-
257-
dispatcher('RESET');
258-
expect(localStorage.getItem('number')).toBe('0');
259-
260-
dispatcher('INCREMENT');
261-
expect(localStorage.getItem('number')).toBe('1');
262-
263-
dispatcher('INCREMENT');
264-
expect(localStorage.getItem('number')).toBe('2');
265-
266-
dispatcher('INVALID_OP');
267-
expect(localStorage.getItem('number')).toBe('-1');
268-
});
269-
});

tests/useLocalStorageSelector.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { act, renderHook } from '@testing-library/react-hooks';
2-
import useLocalStorageSelector from '../src/useLocalStorageSelector/useLocalStorageSelector';
2+
import { useLocalStorageSelector } from '../src';
33

44
describe('useLocalStorageSelector', () => {
55

tests/useLocalStorageState.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { act, renderHook } from '@testing-library/react-hooks';
2-
3-
import useLocalStorageState from '../src/useLocalStorageState/useLocalStorageState';
2+
import { useLocalStorageState } from '../src';
43

54
describe('useLocalStorageState', () => {
65
it('keeps localstorage to null if initialState is not set', () => {

0 commit comments

Comments
 (0)