11'use strict' ; 
2+ const  init  =  require ( "../config.js" ) ; 
23
34const  Contentstack  =  require ( '../../dist/node/contentstack.js' ) ; 
45
56describe ( 'Contentstack Live Preview Tests' ,  ( )  =>  { 
67  test ( 'should check for values initialized' ,  ( )  =>  { 
8+     const  stack1  =  Contentstack . Stack ( init . stack ) 
79    const  stack  =  Contentstack . Stack ( { 
8-       'api_key' : process . env . region_API_KEY ,  
10+       'api_key' : process . env . API_KEY ,  
911      'delivery_token' : process . env . DELIVERY_TOKEN ,  
1012      'environment' : process . env . ENVIRONMENT 
1113    } ) ; 
@@ -16,15 +18,9 @@ describe('Contentstack Live Preview Tests', () => {
1618  } ) ; 
1719
1820  test ( 'should check host when live preview is enabled and management token is provided' ,  ( )  =>  { 
19-     const  stack  =  Contentstack . Stack ( { 
20-       'api_key' : process . env . API_KEY ,  
21-       'delivery_token' : process . env . DELIVERY_TOKEN ,  
22-       'environment' : process . env . ENVIRONMENT , 
23-       live_preview : { 
24-         enable : true , 
25-         management_token : 'management_token' 
26-       } 
27-     } ) ; 
21+     init . stack . live_preview . enable  =  true ; 
22+     init . stack . live_preview . management_token  =  'management_token' ; 
23+     const  stack  =  Contentstack . Stack ( init . stack ) ; 
2824
2925    const  livePreviewObject  =  stack . config . live_preview ; 
3026    expect ( livePreviewObject ) . not . toBe ( 'undefined' ) ; 
@@ -34,15 +30,9 @@ describe('Contentstack Live Preview Tests', () => {
3430  } ) ; 
3531
3632  test ( 'should check host when live preview is disabled and management token is provided' ,  ( )  =>  { 
37-     const  stack  =  Contentstack . Stack ( { 
38-       'api_key' : process . env . API_KEY ,  
39-       'delivery_token' : process . env . DELIVERY_TOKEN ,  
40-       'environment' : process . env . ENVIRONMENT , 
41-       live_preview : { 
42-         enable : false , 
43-         management_token : 'management_token' 
44-       } 
45-     } ) ; 
33+     init . stack . live_preview . enable  =  false ; 
34+     init . stack . live_preview . management_token  =  'management_token' ; 
35+     const  stack  =  Contentstack . Stack ( init . stack ) ; 
4636
4737    const  livePreviewObject  =  stack . config . live_preview ; 
4838    expect ( livePreviewObject ) . not . toBe ( 'undefined' ) ; 
@@ -51,15 +41,9 @@ describe('Contentstack Live Preview Tests', () => {
5141  } ) ; 
5242
5343  test ( 'should check host when live preview is enabled and preview token is provided' ,  ( )  =>  { 
54-     const  stack  =  Contentstack . Stack ( { 
55-       'api_key' : process . env . API_KEY ,  
56-       'delivery_token' : process . env . DELIVERY_TOKEN ,  
57-       'environment' : process . env . ENVIRONMENT , 
58-       live_preview : { 
59-         enable : true , 
60-         preview_token : 'preview_token' 
61-       } 
62-     } ) ; 
44+     init . stack . live_preview . enable  =  true ; 
45+     init . stack . live_preview . preview_token  =  'preview_token' ; 
46+     const  stack  =  Contentstack . Stack ( init . stack ) ; 
6347
6448    const  livePreviewObject  =  stack . config . live_preview ; 
6549    expect ( livePreviewObject ) . not . toBe ( 'undefined' ) ; 
@@ -70,15 +54,9 @@ describe('Contentstack Live Preview Tests', () => {
7054  } ) ; 
7155
7256  test ( 'should check host when live preview is disabled and preview token is provided' ,  ( )  =>  { 
73-     const  stack  =  Contentstack . Stack ( { 
74-       'api_key' : process . env . API_KEY ,  
75-       'delivery_token' : process . env . DELIVERY_TOKEN ,  
76-       'environment' : process . env . ENVIRONMENT , 
77-       live_preview : { 
78-         enable : false , 
79-         preview_token : 'preview_token' 
80-       } 
81-     } ) ; 
57+     init . stack . live_preview . enable  =  false ; 
58+     init . stack . live_preview . preview_token  =  'preview_token' ; 
59+     const  stack  =  Contentstack . Stack ( init . stack ) ; 
8260
8361    const  livePreviewObject  =  stack . config . live_preview ; 
8462    expect ( livePreviewObject ) . not . toBe ( 'undefined' ) ; 
0 commit comments