@@ -39,101 +39,30 @@ describe('Persistence', () => {
3939 } ) ;
4040
4141 describe ( '#update' , ( ) => {
42- describe ( 'noFunctional privacy flag set to true' , ( ) => {
43- beforeEach ( ( ) => {
44- store . setNoFunctional ( true ) ;
45- store . webviewBridgeEnabled = false ;
46- } ) ;
47-
48- it ( 'should NOT write to cookie and localStorage when useCookieStorage is true' , ( ) => {
49- store . SDKConfig . useCookieStorage = true ;
50-
51- const setCookieSpy = jest . spyOn ( persistence , 'setCookie' ) ;
52- const setLocalStorageSpy = jest . spyOn ( persistence , 'setLocalStorage' ) ;
53-
54- persistence . update ( ) ;
55-
56- expect ( setCookieSpy ) . not . toHaveBeenCalled ( ) ;
57- expect ( setLocalStorageSpy ) . not . toHaveBeenCalled ( ) ;
58- } ) ;
59-
60- it ( 'should NOT write to localStorage when useCookieStorage is false' , ( ) => {
61- store . SDKConfig . useCookieStorage = false ;
62-
63- const setCookieSpy = jest . spyOn ( persistence , 'setCookie' ) ;
64- const setLocalStorageSpy = jest . spyOn ( persistence , 'setLocalStorage' ) ;
65-
66- persistence . update ( ) ;
67-
68- expect ( setCookieSpy ) . not . toHaveBeenCalled ( ) ;
69- expect ( setLocalStorageSpy ) . not . toHaveBeenCalled ( ) ;
70- } ) ;
71- } ) ;
72-
73- describe ( 'noFunctional privacy flag set to false' , ( ) => {
74- beforeEach ( ( ) => {
75- store . setNoFunctional ( false ) ;
76- store . webviewBridgeEnabled = false ;
77- } ) ;
78-
79- it ( 'should write to cookie and localStorage when useCookieStorage is true' , ( ) => {
80- store . SDKConfig . useCookieStorage = true ;
81-
82- jest . spyOn ( persistence , 'getCookie' ) . mockReturnValue ( null ) ;
83-
84- const setCookieSpy = jest . spyOn ( persistence , 'setCookie' ) ;
85- const setLocalStorageSpy = jest . spyOn ( persistence , 'setLocalStorage' ) ;
86-
87- persistence . update ( ) ;
88-
89- expect ( setCookieSpy ) . toHaveBeenCalled ( ) ;
90- expect ( setLocalStorageSpy ) . toHaveBeenCalled ( ) ;
91- } ) ;
42+ it ( 'should write to cookie and localStorage by default when useCookieStorage is true' , ( ) => {
43+ store . SDKConfig . useCookieStorage = true ;
9244
93- it ( 'should write to localStorage when useCookieStorage is false' , ( ) => {
94- store . SDKConfig . useCookieStorage = false ;
45+ jest . spyOn ( persistence , 'getCookie' ) . mockReturnValue ( null ) ;
9546
96- const setCookieSpy = jest . spyOn ( persistence , 'setCookie' ) ;
97- const setLocalStorageSpy = jest . spyOn ( persistence , 'setLocalStorage' ) ;
47+ const setCookieSpy = jest . spyOn ( persistence , 'setCookie' ) ;
48+ const setLocalStorageSpy = jest . spyOn ( persistence , 'setLocalStorage' ) ;
9849
99- persistence . update ( ) ;
50+ persistence . update ( ) ;
10051
101- expect ( setCookieSpy ) . not . toHaveBeenCalled ( ) ;
102- expect ( setLocalStorageSpy ) . toHaveBeenCalled ( ) ;
103- } ) ;
52+ expect ( setCookieSpy ) . toHaveBeenCalled ( ) ;
53+ expect ( setLocalStorageSpy ) . toHaveBeenCalled ( ) ;
10454 } ) ;
10555
106- describe ( 'noFunctional privacy flag set to false by default' , ( ) => {
107- beforeEach ( ( ) => {
108- // default is false
109- store . webviewBridgeEnabled = false ;
110- } ) ;
111-
112- it ( 'should write to cookie and localStorage by default when useCookieStorage is true' , ( ) => {
113- store . SDKConfig . useCookieStorage = true ;
114-
115- jest . spyOn ( persistence , 'getCookie' ) . mockReturnValue ( null ) ;
116-
117- const setCookieSpy = jest . spyOn ( persistence , 'setCookie' ) ;
118- const setLocalStorageSpy = jest . spyOn ( persistence , 'setLocalStorage' ) ;
56+ it ( 'should write to localStorage by default when useCookieStorage is false' , ( ) => {
57+ store . SDKConfig . useCookieStorage = false ;
11958
120- persistence . update ( ) ;
121-
122- expect ( setCookieSpy ) . toHaveBeenCalled ( ) ;
123- expect ( setLocalStorageSpy ) . toHaveBeenCalled ( ) ;
124- } ) ;
125-
126- it ( 'should write to localStorage by default when useCookieStorage is false' , ( ) => {
127- store . SDKConfig . useCookieStorage = false ;
128-
129- const setCookieSpy = jest . spyOn ( persistence , 'setCookie' ) ;
130- const setLocalStorageSpy = jest . spyOn ( persistence , 'setLocalStorage' ) ;
59+ const setCookieSpy = jest . spyOn ( persistence , 'setCookie' ) ;
60+ const setLocalStorageSpy = jest . spyOn ( persistence , 'setLocalStorage' ) ;
13161
132- persistence . update ( ) ;
62+ persistence . update ( ) ;
13363
134- expect ( setCookieSpy ) . not . toHaveBeenCalled ( ) ;
135- expect ( setLocalStorageSpy ) . toHaveBeenCalled ( ) ;
136- } ) ;
64+ expect ( setCookieSpy ) . not . toHaveBeenCalled ( ) ;
65+ expect ( setLocalStorageSpy ) . toHaveBeenCalled ( ) ;
13766 } ) ;
13867
13968 it ( 'should NOT write to storage when webviewBridgeEnabled is true' , ( ) => {
0 commit comments