File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
test/unit/specs/local-cache Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,9 @@ export default class LocalCache {
99 constructor ( app ) {
1010 this . app = app
1111
12- this . storageName = `${ STORAGE_KEY_NAMESPACE } _${ this . app . appId } `
12+ this . storageName = this . app . appId
13+ ? `${ STORAGE_KEY_NAMESPACE } _${ this . app . appId } `
14+ : STORAGE_KEY_NAMESPACE
1315
1416 const Storage = Utils . isLocalStorageSupported
1517 ? LocalStorage
Original file line number Diff line number Diff line change @@ -29,8 +29,22 @@ describe('<LocalCache> Browser', function() {
2929 delete global . localStorage
3030 } )
3131
32- it ( 'has default storage name' , ( ) => {
32+ it ( 'has default storage name with app id ' , ( ) => {
3333 expect ( Backendless . LocalCache . storageName ) . to . be . equal ( `Backendless_${ APP_ID } ` )
34+
35+ Backendless . LocalCache . set ( 'foo' , 'bar' )
36+
37+ expect ( JSON . stringify ( global . localStorage ) ) . to . be . equal ( `{"Backendless_${ APP_ID } ":"{\\"foo\\":\\"bar\\"}"}` )
38+ } )
39+
40+ it ( 'has default storage name without app id' , ( ) => {
41+ Backendless . initApp ( 'https://foo.bar' )
42+
43+ expect ( Backendless . LocalCache . storageName ) . to . be . equal ( 'Backendless' )
44+
45+ Backendless . LocalCache . set ( 'foo' , 'bar' )
46+
47+ expect ( JSON . stringify ( global . localStorage ) ) . to . be . equal ( '{"Backendless":"{\\"foo\\":\\"bar\\"}"}' )
3448 } )
3549
3650 it ( 'should migrate legacy storage' , ( ) => {
You can’t perform that action at this time.
0 commit comments