@@ -28,11 +28,13 @@ test('should write filtered environment variables to file', async () => {
2828 process . env . OTHER_VAR = 'other'
2929
3030 mockGetInput . mockImplementation ( ( name : string ) => {
31- switch ( name as 'prefix' | 'output' ) {
31+ switch ( name as 'prefix' | 'output' | 'secrets' ) {
3232 case 'prefix' :
3333 return testPrefix
3434 case 'output' :
3535 return testOutput
36+ case 'secrets' :
37+ return '{"TEST_SECRET": "secret123"}'
3638 }
3739 } )
3840
@@ -46,7 +48,7 @@ test('should write filtered environment variables to file', async () => {
4648 expect ( mockGetBooleanInput ) . toHaveBeenCalledWith ( 'remove-prefix' )
4749 expect ( mockWriteFile ) . toHaveBeenCalledWith (
4850 testOutput ,
49- 'TEST_VAR1 =value1\nTEST_VAR2=value2' ,
51+ 'TEST_SECRET=secret123\nTEST_VAR1 =value1\nTEST_VAR2=value2' ,
5052 )
5153} )
5254
@@ -58,11 +60,13 @@ test('should handle writeFile error', async () => {
5860 process . env . TEST_VAR = 'value'
5961
6062 mockGetInput . mockImplementation ( ( name : string ) => {
61- switch ( name as 'prefix' | 'output' ) {
63+ switch ( name as 'prefix' | 'output' | 'secrets' ) {
6264 case 'prefix' :
6365 return testPrefix
6466 case 'output' :
6567 return testOutput
68+ case 'secrets' :
69+ return '{"TEST_SECRET": "secret123"}'
6670 }
6771 } )
6872
@@ -80,11 +84,13 @@ test('should handle empty environment variables', async () => {
8084 const testOutput = 'empty.env'
8185
8286 mockGetInput . mockImplementation ( ( name : string ) => {
83- switch ( name as 'prefix' | 'output' ) {
87+ switch ( name as 'prefix' | 'output' | 'secrets' ) {
8488 case 'prefix' :
8589 return testPrefix
8690 case 'output' :
8791 return testOutput
92+ case 'secrets' :
93+ return '{"TEST_SECRET": "secret123"}'
8894 }
8995 } )
9096
@@ -94,6 +100,7 @@ test('should handle empty environment variables', async () => {
94100 await run ( )
95101
96102 expect ( mockWriteFile ) . toHaveBeenCalledWith ( testOutput , '' )
103+ expect ( mockGetInput ) . toHaveBeenCalledWith ( 'secrets' )
97104} )
98105
99106test ( 'should filter environment variables by prefix' , async ( ) => {
@@ -106,11 +113,13 @@ test('should filter environment variables by prefix', async () => {
106113 process . env . API_TIMEOUT = '5000'
107114
108115 mockGetInput . mockImplementation ( ( name : string ) => {
109- switch ( name as 'prefix' | 'output' ) {
116+ switch ( name as 'prefix' | 'output' | 'secrets' ) {
110117 case 'prefix' :
111118 return testPrefix
112119 case 'output' :
113120 return testOutput
121+ case 'secrets' :
122+ return '{"TEST_SECRET": "secret123"}'
114123 }
115124 } )
116125
@@ -136,11 +145,13 @@ test('should remove prefix from environment variables', async () => {
136145 process . env . API_TIMEOUT = '5000'
137146
138147 mockGetInput . mockImplementation ( ( name : string ) => {
139- switch ( name as 'prefix' | 'output' ) {
148+ switch ( name as 'prefix' | 'output' | 'secrets' ) {
140149 case 'prefix' :
141150 return testPrefix
142151 case 'output' :
143152 return testOutput
153+ case 'secrets' :
154+ return '{"TEST_SECRET": "secret123"}'
144155 }
145156 } )
146157
0 commit comments