@@ -37,7 +37,8 @@ const TEST_DATA: scaleUpModule.ActionRequestMessage = {
37
37
installationId : 2 ,
38
38
} ;
39
39
40
- const TEST_DATA_WITHOUT_INSTALL_ID : scaleUpModule . ActionRequestMessage = {
40
+ // installationId 0 means no installationId is set.
41
+ const TEST_DATA_WITH_ZERO_INSTALL_ID : scaleUpModule . ActionRequestMessage = {
41
42
id : 3 ,
42
43
eventType : 'workflow_job' ,
43
44
repositoryName : 'hello-world' ,
@@ -191,7 +192,7 @@ describe('scaleUp with GHES', () => {
191
192
192
193
it ( 'retrieves installation id if not set' , async ( ) => {
193
194
const spy = jest . spyOn ( ghAuth , 'createGithubAuth' ) ;
194
- await scaleUpModule . scaleUp ( 'aws:sqs' , TEST_DATA_WITHOUT_INSTALL_ID ) ;
195
+ await scaleUpModule . scaleUp ( 'aws:sqs' , TEST_DATA_WITH_ZERO_INSTALL_ID ) ;
195
196
expect ( mockOctokit . apps . getRepoInstallation ) . not . toBeCalled ( ) ;
196
197
expect ( spy ) . toHaveBeenNthCalledWith ( 1 , undefined , 'app' , 'https://github.enterprise.something/api/v3' ) ;
197
198
expect ( spy ) . toHaveBeenNthCalledWith (
@@ -300,7 +301,7 @@ describe('scaleUp with GHES', () => {
300
301
301
302
it ( 'retrieves installation id if not set' , async ( ) => {
302
303
const spy = jest . spyOn ( ghAuth , 'createGithubAuth' ) ;
303
- await scaleUpModule . scaleUp ( 'aws:sqs' , TEST_DATA_WITHOUT_INSTALL_ID ) ;
304
+ await scaleUpModule . scaleUp ( 'aws:sqs' , TEST_DATA_WITH_ZERO_INSTALL_ID ) ;
304
305
expect ( mockOctokit . apps . getOrgInstallation ) . not . toBeCalled ( ) ;
305
306
expect ( spy ) . toHaveBeenNthCalledWith ( 1 , undefined , 'app' , 'https://github.enterprise.something/api/v3' ) ;
306
307
expect ( spy ) . toHaveBeenNthCalledWith (
@@ -368,7 +369,7 @@ describe('scaleUp with public GH', () => {
368
369
369
370
it ( 'retrieves installation id if not set' , async ( ) => {
370
371
const spy = jest . spyOn ( ghAuth , 'createGithubAuth' ) ;
371
- await scaleUpModule . scaleUp ( 'aws:sqs' , TEST_DATA_WITHOUT_INSTALL_ID ) ;
372
+ await scaleUpModule . scaleUp ( 'aws:sqs' , TEST_DATA_WITH_ZERO_INSTALL_ID ) ;
372
373
expect ( mockOctokit . apps . getRepoInstallation ) . not . toBeCalled ( ) ;
373
374
expect ( spy ) . toHaveBeenNthCalledWith ( 1 , undefined , 'app' , '' ) ;
374
375
expect ( spy ) . toHaveBeenNthCalledWith ( 2 , TEST_DATA . installationId , 'installation' , '' ) ;
@@ -387,7 +388,7 @@ describe('scaleUp with public GH', () => {
387
388
process . env . ENABLE_ORGANIZATION_RUNNERS = 'true' ;
388
389
expectedRunnerParams = { ...EXPECTED_RUNNER_PARAMS } ;
389
390
expectedRunnerParams . runnerServiceConfig =
390
- `--url https://github.com/${ TEST_DATA . repositoryOwner } ` + ' --token 1234abcd ' ;
391
+ `--url https://github.com/${ TEST_DATA . repositoryOwner } ` + ` --token 1234abcd ` ;
391
392
} ) ;
392
393
393
394
it ( 'gets the current org level runners' , async ( ) => {
@@ -449,7 +450,7 @@ describe('scaleUp with public GH', () => {
449
450
expectedRunnerParams . runnerType = 'Repo' ;
450
451
expectedRunnerParams . runnerOwner = `${ TEST_DATA . repositoryOwner } /${ TEST_DATA . repositoryName } ` ;
451
452
expectedRunnerParams . runnerServiceConfig =
452
- `--url ` + ` https://github.com/${ TEST_DATA . repositoryOwner } /${ TEST_DATA . repositoryName } ` + `--token 1234abcd ` ;
453
+ `--url https://github.com/${ TEST_DATA . repositoryOwner } /${ TEST_DATA . repositoryName } ` + `--token 1234abcd ` ;
453
454
} ) ;
454
455
455
456
it ( 'gets the current repo level runners' , async ( ) => {
@@ -485,7 +486,7 @@ describe('scaleUp with public GH', () => {
485
486
486
487
it ( 'retrieves installation id if not set' , async ( ) => {
487
488
const spy = jest . spyOn ( ghAuth , 'createGithubAuth' ) ;
488
- await scaleUpModule . scaleUp ( 'aws:sqs' , TEST_DATA_WITHOUT_INSTALL_ID ) ;
489
+ await scaleUpModule . scaleUp ( 'aws:sqs' , TEST_DATA_WITH_ZERO_INSTALL_ID ) ;
489
490
expect ( mockOctokit . apps . getOrgInstallation ) . not . toBeCalled ( ) ;
490
491
expect ( spy ) . toHaveBeenNthCalledWith ( 1 , undefined , 'app' , '' ) ;
491
492
expect ( spy ) . toHaveBeenNthCalledWith ( 2 , TEST_DATA . installationId , 'installation' , '' ) ;
0 commit comments