@@ -15,25 +15,37 @@ describe('loading configuration via command or environment variable', () => {
1515 } )
1616
1717 test ( 'the configuration can be loaded' , async ( ) => {
18- mockTempestConfiguration ( )
18+ const mockData = {
19+ build_directory : 'build' ,
20+ bridge_file_name : '.tempest' ,
21+ manifest : 'manifest.json' ,
22+ entrypoints : [ 'resources/js/app.js' ] ,
23+ }
24+ mockTempestConfiguration ( mockData )
1925
2026 const config = await loadTempestConfiguration ( )
27+
2128 expect ( config . build_directory ) . toBe ( 'build' )
29+ expect ( config . bridge_file_name ) . toBe ( '.tempest' )
30+ expect ( config . manifest ) . toBe ( 'manifest.json' )
31+ expect ( config . entrypoints ) . toEqual ( [ 'resources/js/app.js' ] )
2232 } )
2333
24- test ( 'the configuration can be overriden with an environment variable ' , async ( ) => {
25- const execSpy = vi . spyOn ( utils , 'exec' )
26- process . env . TEMPEST_PLUGIN_CONFIGURATION_OVERRIDE = JSON . stringify ( {
27- build_directory : 'build/from-env ' ,
28- bridge_file_name : 'vite-tempest ' ,
29- manifest : 'manifest.json' ,
30- entrypoints : [ ] ,
31- } )
34+ test ( 'the configuration can be overriden' , async ( ) => {
35+ const overrideData = {
36+ build_directory : 'build-override' ,
37+ bridge_file_name : '.tempest-override ' ,
38+ manifest : 'manifest-override.json ' ,
39+ entrypoints : [ 'resources/js/override.js' ] ,
40+ }
41+ process . env . TEMPEST_PLUGIN_CONFIGURATION_OVERRIDE = JSON . stringify ( overrideData )
3242
3343 const config = await loadTempestConfiguration ( )
3444
35- expect ( config . build_directory ) . toBe ( 'build/from-env' )
36- expect ( execSpy ) . not . toHaveBeenCalled ( )
45+ expect ( config . build_directory ) . toBe ( 'build-override' )
46+ expect ( config . bridge_file_name ) . toBe ( '.tempest-override' )
47+ expect ( config . manifest ) . toBe ( 'manifest-override.json' )
48+ expect ( config . entrypoints ) . toEqual ( [ 'resources/js/override.js' ] )
3749 } )
3850} )
3951
@@ -61,6 +73,8 @@ describe('loading configuration from a file', () => {
6173 } )
6274
6375 expect ( config . build_directory ) . toBe ( 'build/from-file' )
76+ expect ( config . bridge_file_name ) . toBe ( 'test-bridge' )
77+ expect ( config . manifest ) . toBe ( 'test-manifest.json' )
6478 expect ( config . entrypoints ) . toEqual ( [ 'resources/js/test.js' ] )
6579 } )
6680
0 commit comments