This repository was archived by the owner on Jan 16, 2025. It is now read-only.
File tree 1 file changed +28
-0
lines changed
modules/runners/lambdas/runners/src/scale-runners
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,34 @@ describe('Test createGithubAppAuth', () => {
71
71
process . env . ENVIRONMENT = ENVIRONMENT ;
72
72
} ) ;
73
73
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
+
74
102
test ( 'Creates auth object for public GitHub' , async ( ) => {
75
103
// Arrange
76
104
const authOptions = {
You can’t perform that action at this time.
0 commit comments