const createLocalStorageMock = ( ) : any => { const storage = { } as any ; return { getItem ( key ) { return storage [ key ] ; } , setItem ( key , value ) { storage [ key ] = value . toString ( ) ; } , removeItem ( key ) { delete storage [ key ] ; } } ; } ; export const createAsyncStorageMock = ( ) : any => { const storage = createLocalStorageMock ( ) ; return { getItem : ( key ) : Promise < string > => { return new Promise ( ( resolve ) => { resolve ( storage . getItem ( key ) ) ; } ) ; } , setItem : ( key , item ) : Promise < void > => { return new Promise ( ( resolve ) => { resolve ( storage . setItem ( key , item ) ) ; } ) ; } , removeItem : ( key ) : Promise < void > => { return new Promise ( ( resolve ) => { resolve ( storage . removeItem ( key ) ) ; } ) ; } } ; } ;