File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
modules/runners/lambdas/runners/src/scale-runners Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,34 @@ describe('Test createGithubAppAuth', () => {
7171 process . env . ENVIRONMENT = ENVIRONMENT ;
7272 } ) ;
7373
74+ test ( 'Creates auth object with line breaks in SSH key.' , async ( ) => {
75+ // Arrange
76+ const authOptions = {
77+ appId : parseInt ( GITHUB_APP_ID ) ,
78+ privateKey : `${ decryptedValue }
79+ ${ decryptedValue } `,
80+ installationId,
81+ } ;
82+
83+ const b64PrivateKeyWithLineBreaks = Buffer . from ( decryptedValue + '\n' + decryptedValue , 'binary' ) . toString (
84+ 'base64' ,
85+ ) ;
86+ mockedGet . mockResolvedValueOnce ( GITHUB_APP_ID ) . mockResolvedValueOnce ( b64PrivateKeyWithLineBreaks ) ;
87+
88+ const mockedAuth = jest . fn ( ) ;
89+ mockedAuth . mockResolvedValue ( { token } ) ;
90+ mockedCreatAppAuth . mockImplementation ( ( ) => {
91+ return mockedAuth ;
92+ } ) ;
93+
94+ // Act
95+ await createGithubAppAuth ( installationId ) ;
96+
97+ // Assert
98+ expect ( mockedCreatAppAuth ) . toBeCalledTimes ( 1 ) ;
99+ expect ( mockedCreatAppAuth ) . toBeCalledWith ( authOptions ) ;
100+ } ) ;
101+
74102 test ( 'Creates auth object for public GitHub' , async ( ) => {
75103 // Arrange
76104 const authOptions = {
You can’t perform that action at this time.
0 commit comments