@@ -18,11 +18,11 @@ describe("Storage", () => {
1818 } ) ;
1919
2020 it ( "persists and restores messages" , ( ) => {
21- const history1 = new LocalHistory ( { storagePrefix : channelId } ) ;
21+ const history1 = new LocalHistory ( { storage : { prefix : channelId } } ) ;
2222 history1 . push ( createMessage ( "msg-1" , 1 ) ) ;
2323 history1 . push ( createMessage ( "msg-2" , 2 ) ) ;
2424
25- const history2 = new LocalHistory ( { storagePrefix : channelId } ) ;
25+ const history2 = new LocalHistory ( { storage : { prefix : channelId } } ) ;
2626
2727 expect ( history2 . length ) . to . equal ( 2 ) ;
2828 expect ( history2 . slice ( 0 ) . map ( ( msg ) => msg . messageId ) ) . to . deep . equal ( [
@@ -34,15 +34,15 @@ describe("Storage", () => {
3434 it ( "handles corrupt data gracefully" , ( ) => {
3535 localStorage . setItem ( `waku:sds:storage:${ channelId } ` , "{ invalid json }" ) ;
3636
37- const history = new LocalHistory ( { storagePrefix : channelId } ) ;
37+ const history = new LocalHistory ( { storage : { prefix : channelId } } ) ;
3838 expect ( history . length ) . to . equal ( 0 ) ;
3939 // Corrupt data is removed
4040 expect ( localStorage . getItem ( `waku:sds:storage:${ channelId } ` ) ) . to . be . null ;
4141 } ) ;
4242
4343 it ( "isolates history by channel ID" , ( ) => {
44- const history1 = new LocalHistory ( { storagePrefix : "channel-1" } ) ;
45- const history2 = new LocalHistory ( { storagePrefix : "channel-2" } ) ;
44+ const history1 = new LocalHistory ( { storage : { prefix : "channel-1" } } ) ;
45+ const history2 = new LocalHistory ( { storage : { prefix : "channel-2" } } ) ;
4646
4747 history1 . push ( createMessage ( "msg-1" , 1 ) ) ;
4848 history2 . push ( createMessage ( "msg-2" , 2 ) ) ;
@@ -57,7 +57,7 @@ describe("Storage", () => {
5757 } ) ;
5858
5959 it ( "saves messages after each push" , ( ) => {
60- const history = new LocalHistory ( { storagePrefix : channelId } ) ;
60+ const history = new LocalHistory ( { storage : { prefix : channelId } } ) ;
6161
6262 expect ( localStorage . getItem ( `waku:sds:storage:${ channelId } ` ) ) . to . be . null ;
6363
@@ -74,13 +74,13 @@ describe("Storage", () => {
7474 } ) ;
7575
7676 it ( "loads messages on initialization" , ( ) => {
77- const history1 = new LocalHistory ( { storagePrefix : channelId } ) ;
77+ const history1 = new LocalHistory ( { storage : { prefix : channelId } } ) ;
7878
7979 history1 . push ( createMessage ( "msg-1" , 1 ) ) ;
8080 history1 . push ( createMessage ( "msg-2" , 2 ) ) ;
8181 history1 . push ( createMessage ( "msg-3" , 3 ) ) ;
8282
83- const history2 = new LocalHistory ( { storagePrefix : channelId } ) ;
83+ const history2 = new LocalHistory ( { storage : { prefix : channelId } } ) ;
8484
8585 expect ( history2 . length ) . to . equal ( 3 ) ;
8686 expect ( history2 . slice ( 0 ) . map ( ( m ) => m . messageId ) ) . to . deep . equal ( [
0 commit comments