@@ -8,7 +8,7 @@ beforeEach(() => {
8
8
} ) ;
9
9
10
10
describe ( "useLocalState()" , ( ) => {
11
- it ( "uses initial value as string" , async ( ) => {
11
+ it ( "stores initial value as string" , async ( ) => {
12
12
const key = "key" ;
13
13
const value = "something" ;
14
14
const { result } = renderHook ( ( ) => useLocalState ( key , value ) ) ;
@@ -17,7 +17,7 @@ describe("useLocalState()", () => {
17
17
expect ( values ) . toEqual ( value ) ;
18
18
} ) ;
19
19
20
- it ( `initial value isn't written into localStorage` , async ( ) => {
20
+ it ( `initial value isn't stored into localStorage` , async ( ) => {
21
21
if ( ! SUPPORTED ) return ;
22
22
23
23
const key = "key" ;
@@ -27,7 +27,7 @@ describe("useLocalState()", () => {
27
27
expect ( localStorage . getItem ( key ) ) . toEqual ( null ) ;
28
28
} ) ;
29
29
30
- it ( "uses initial value as boolean" , async ( ) => {
30
+ it ( "stores initial value as boolean" , async ( ) => {
31
31
const key = "key" ;
32
32
const value = false ;
33
33
const { result } = renderHook ( ( ) => useLocalState ( key , value ) ) ;
@@ -36,7 +36,7 @@ describe("useLocalState()", () => {
36
36
expect ( values ) . toEqual ( value ) ;
37
37
} ) ;
38
38
39
- it ( "uses initial value as object" , async ( ) => {
39
+ it ( "stores initial value as object" , async ( ) => {
40
40
const key = "key" ;
41
41
const value = {
42
42
something : "else" ,
@@ -47,7 +47,7 @@ describe("useLocalState()", () => {
47
47
expect ( values ) . toEqual ( value ) ;
48
48
} ) ;
49
49
50
- it ( "uses initial value as array" , async ( ) => {
50
+ it ( "stores initial value as array" , async ( ) => {
51
51
const key = "todos" ;
52
52
const values = [ "first" , "second" ] ;
53
53
const { result } = renderHook ( ( ) => useLocalState ( key , values ) ) ;
@@ -102,7 +102,7 @@ describe("useLocalState()", () => {
102
102
expect ( values ) . toEqual ( newValue ) ;
103
103
} ) ;
104
104
105
- it ( "can update value as list " , async ( ) => {
105
+ it ( "can update value as array " , async ( ) => {
106
106
const key = "todos" ;
107
107
const values = [ "first" , "second" ] ;
108
108
const { result } = renderHook ( ( ) => useLocalState ( key , values ) ) ;
@@ -158,7 +158,8 @@ describe("useLocalState()", () => {
158
158
159
159
localStorage . setItem ( key , JSON . stringify ( values ) ) ;
160
160
161
- const { result } = renderHook ( ( ) => useLocalState ( key , values ) ) ;
161
+ const newValues = [ "third" , "fourth" ] ;
162
+ const { result } = renderHook ( ( ) => useLocalState ( key , newValues ) ) ;
162
163
163
164
const [ todos ] = result . current ;
164
165
expect ( todos ) . toEqual ( values ) ;
0 commit comments