@@ -428,75 +428,52 @@ describe('Vault', () => {
428428 describe ( '#store' , ( ) => {
429429 it ( 'should NOT write to localStorage' , ( ) => {
430430 const storageKey = 'test-disabled-store-empty' ;
431- const vault = new DisabledVault < Dictionary < Dictionary < string > > > (
432- storageKey ,
433- ) ;
431+ const vault = new DisabledVault < string > ( storageKey ) ;
434432
435- vault . store ( testObject ) ;
433+ vault . store ( 'testString' ) ;
436434
437435 expect ( vault . contents ) . to . equal ( null ) ;
438436 expect ( window . localStorage . getItem ( storageKey ) ) . to . equal ( null ) ;
439437 } ) ;
440438
441439 it ( 'should NOT overwrite existing localStorage value and keep contents null' , ( ) => {
442440 const storageKey = 'test-disabled-store-existing' ;
443- window . localStorage . setItem (
444- storageKey ,
445- JSON . stringify ( testObject ) ,
446- ) ;
441+ window . localStorage . setItem ( storageKey , 'existingItem' ) ;
447442
448- const vault = new DisabledVault < Dictionary < Dictionary < string > > > (
449- storageKey ,
450- ) ;
443+ const vault = new DisabledVault < string > ( storageKey ) ;
451444
452- vault . store ( { pinky : { narf : 'poit' } } ) ;
445+ vault . store ( 'newValue' ) ;
453446
454447 expect ( vault . contents ) . to . equal ( null ) ;
455- expect ( window . localStorage . getItem ( storageKey ) ) . to . equal (
456- JSON . stringify ( testObject ) ,
457- ) ;
448+ expect ( window . localStorage . getItem ( storageKey ) ) . to . equal ( 'existingItem' ) ;
458449 } ) ;
459450 } ) ;
460451
461452 describe ( '#retrieve' , ( ) => {
462453 it ( 'should return null when nothing is stored' , ( ) => {
463454 const storageKey = 'test-disabled-retrieve-empty' ;
464- const vault = new DisabledVault < Dictionary < Dictionary < string > > > (
465- storageKey ,
466- ) ;
455+ const vault = new DisabledVault < string > ( storageKey ) ;
467456 const retrievedItem = vault . retrieve ( ) ;
468457 expect ( retrievedItem ) . to . equal ( null ) ;
469458 } ) ;
470459
471460 it ( 'should return null even if localStorage has a value' , ( ) => {
472461 const storageKey = 'test-disabled-retrieve-existing' ;
473- window . localStorage . setItem (
474- storageKey ,
475- JSON . stringify ( testObject ) ,
476- ) ;
462+ window . localStorage . setItem ( storageKey , 'existingItem' ) ;
477463
478- const vault = new DisabledVault < Dictionary < Dictionary < string > > > (
479- storageKey ,
480- ) ;
464+ const vault = new DisabledVault < string > ( storageKey ) ;
481465 const retrievedItem = vault . retrieve ( ) ;
482466 expect ( retrievedItem ) . to . equal ( null ) ;
483- expect ( window . localStorage . getItem ( storageKey ) ) . to . equal (
484- JSON . stringify ( testObject ) ,
485- ) ;
467+ expect ( window . localStorage . getItem ( storageKey ) ) . to . equal ( 'existingItem' ) ;
486468 } ) ;
487469 } ) ;
488470
489471 describe ( '#purge' , ( ) => {
490472 it ( 'should keep contents null when purging' , ( ) => {
491473 const storageKey = 'test-disabled-purge-existing' ;
492- window . localStorage . setItem (
493- storageKey ,
494- JSON . stringify ( testObject ) ,
495- ) ;
474+ window . localStorage . setItem ( storageKey , 'existing' ) ;
496475
497- const vault = new DisabledVault < Dictionary < Dictionary < string > > > (
498- storageKey ,
499- ) ;
476+ const vault = new DisabledVault < string > ( storageKey ) ;
500477
501478 vault . purge ( ) ;
502479
@@ -506,12 +483,9 @@ describe('Vault', () => {
506483
507484 it ( 'should keep contents null when purging an empty key' , ( ) => {
508485 const storageKey = 'test-disabled-purge-empty' ;
509- const vault = new DisabledVault < Dictionary < Dictionary < string > > > (
510- storageKey ,
511- ) ;
486+ const vault = new DisabledVault < string > ( storageKey ) ;
512487
513488 vault . purge ( ) ;
514- console . log ( window . localStorage . getItem ( storageKey ) ) ;
515489 expect ( vault . contents ) . to . equal ( null ) ;
516490 expect ( window . localStorage . getItem ( storageKey ) ) . to . equal ( null ) ;
517491 } ) ;
0 commit comments