@@ -49,6 +49,7 @@ jest.mock('@actions/core', () => {
4949 return {
5050 getMultilineInput : jest . fn ( ) ,
5151 getBooleanInput : jest . fn ( ) ,
52+ getInput : jest . fn ( ) ,
5253 setFailed : jest . fn ( ) ,
5354 info : jest . fn ( ) ,
5455 debug : jest . fn ( ) ,
@@ -75,6 +76,7 @@ describe('Test main action', () => {
7576 const multilineInputSpy = jest . spyOn ( core , "getMultilineInput" ) . mockReturnValue (
7677 [ TEST_NAME , TEST_INPUT_3 , TEST_ARN_INPUT , BLANK_ALIAS_INPUT ]
7778 ) ;
79+ const nameTransformationSpy = jest . spyOn ( core , 'getInput' ) . mockReturnValue ( 'uppercase' ) ;
7880
7981 // Mock all Secrets Manager calls
8082 smMockClient
@@ -106,8 +108,8 @@ describe('Test main action', () => {
106108 . resolves ( { Name : BLANK_NAME , SecretString : SECRET_FOR_BLANK } ) ;
107109
108110 await run ( ) ;
109- expect ( core . exportVariable ) . toHaveBeenCalledTimes ( 10 ) ;
110111 expect ( core . setFailed ) . not . toHaveBeenCalled ( ) ;
112+ expect ( core . exportVariable ) . toHaveBeenCalledTimes ( 10 ) ;
111113
112114 // JSON secrets should be parsed
113115 expect ( core . exportVariable ) . toHaveBeenCalledWith ( 'TEST_ONE_USER' , 'admin' ) ;
@@ -137,6 +139,7 @@ describe('Test main action', () => {
137139
138140 booleanSpy . mockClear ( ) ;
139141 multilineInputSpy . mockClear ( ) ;
142+ nameTransformationSpy . mockClear ( ) ;
140143 } ) ;
141144
142145 test ( 'Defaults to correct behavior with empty string alias' , async ( ) => {
@@ -152,8 +155,8 @@ describe('Test main action', () => {
152155 . resolves ( { Name : BLANK_NAME_3 , SecretString : SECRET_FOR_BLANK_3 } ) ;
153156
154157 await run ( ) ;
155- expect ( core . exportVariable ) . toHaveBeenCalledTimes ( 3 ) ;
156158 expect ( core . setFailed ) . not . toHaveBeenCalled ( ) ;
159+ expect ( core . exportVariable ) . toHaveBeenCalledTimes ( 3 ) ;
157160
158161 // Case when alias is blank, but still comma delimited in workflow and no json is parsed
159162 // ex: ,test/blank2
@@ -192,6 +195,7 @@ describe('Test main action', () => {
192195 const multilineInputSpy = jest . spyOn ( core , "getMultilineInput" ) . mockReturnValue (
193196 [ TEST_NAME , TEST_INPUT_3 , TEST_ARN_INPUT ]
194197 ) ;
198+ const nameTransformationSpy = jest . spyOn ( core , 'getInput' ) . mockReturnValue ( 'uppercase' ) ;
195199
196200 smMockClient
197201 . on ( GetSecretValueCommand , { SecretId : TEST_NAME_1 } )
@@ -226,5 +230,6 @@ describe('Test main action', () => {
226230
227231 booleanSpy . mockClear ( ) ;
228232 multilineInputSpy . mockClear ( ) ;
233+ nameTransformationSpy . mockClear ( ) ;
229234 } ) ;
230235} ) ;
0 commit comments