Skip to content

Commit 49d1689

Browse files
committed
review comments
1 parent 6944134 commit 49d1689

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

modules/runners/lambdas/runners/src/scale-runners/scale-up.test.ts

+9-8
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ const TEST_DATA: scaleUpModule.ActionRequestMessage = {
3333
installationId: 2,
3434
};
3535

36-
const TEST_DATA_WITHOUT_INSTALL_ID: scaleUpModule.ActionRequestMessage = {
36+
// installationId 0 means no installationId is set.
37+
const TEST_DATA_WITH_ZERO_INSTALL_ID: scaleUpModule.ActionRequestMessage = {
3738
id: 3,
3839
eventType: 'workflow_job',
3940
repositoryName: 'hello-world',
@@ -178,7 +179,7 @@ describe('scaleUp with GHES', () => {
178179

179180
it('retrieves installation id if not set', async () => {
180181
const spy = jest.spyOn(ghAuth, 'createGithubAuth');
181-
await scaleUpModule.scaleUp('aws:sqs', TEST_DATA_WITHOUT_INSTALL_ID);
182+
await scaleUpModule.scaleUp('aws:sqs', TEST_DATA_WITH_ZERO_INSTALL_ID);
182183
expect(mockOctokit.apps.getRepoInstallation).not.toBeCalled();
183184
expect(spy).toHaveBeenNthCalledWith(1, undefined, 'app', 'https://github.enterprise.something/api/v3');
184185
expect(spy).toHaveBeenNthCalledWith(
@@ -278,7 +279,7 @@ describe('scaleUp with GHES', () => {
278279

279280
it('retrieves installation id if not set', async () => {
280281
const spy = jest.spyOn(ghAuth, 'createGithubAuth');
281-
await scaleUpModule.scaleUp('aws:sqs', TEST_DATA_WITHOUT_INSTALL_ID);
282+
await scaleUpModule.scaleUp('aws:sqs', TEST_DATA_WITH_ZERO_INSTALL_ID);
282283
expect(mockOctokit.apps.getOrgInstallation).not.toBeCalled();
283284
expect(spy).toHaveBeenNthCalledWith(1, undefined, 'app', 'https://github.enterprise.something/api/v3');
284285
expect(spy).toHaveBeenNthCalledWith(
@@ -346,7 +347,7 @@ describe('scaleUp with public GH', () => {
346347

347348
it('retrieves installation id if not set', async () => {
348349
const spy = jest.spyOn(ghAuth, 'createGithubAuth');
349-
await scaleUpModule.scaleUp('aws:sqs', TEST_DATA_WITHOUT_INSTALL_ID);
350+
await scaleUpModule.scaleUp('aws:sqs', TEST_DATA_WITH_ZERO_INSTALL_ID);
350351
expect(mockOctokit.apps.getRepoInstallation).not.toBeCalled();
351352
expect(spy).toHaveBeenNthCalledWith(1, undefined, 'app', '');
352353
expect(spy).toHaveBeenNthCalledWith(2, TEST_DATA.installationId, 'installation', '');
@@ -364,8 +365,8 @@ describe('scaleUp with public GH', () => {
364365
beforeEach(() => {
365366
process.env.ENABLE_ORGANIZATION_RUNNERS = 'true';
366367
expectedRunnerParams = { ...EXPECTED_RUNNER_PARAMS };
367-
// eslint-disable-next-line max-len
368-
expectedRunnerParams.runnerServiceConfig = `--url https://github.com/${TEST_DATA.repositoryOwner} --token 1234abcd `;
368+
expectedRunnerParams.runnerServiceConfig =
369+
`--url https://github.com/${TEST_DATA.repositoryOwner} ` + `--token 1234abcd `;
369370
});
370371

371372
it('gets the current org level runners', async () => {
@@ -427,7 +428,7 @@ describe('scaleUp with public GH', () => {
427428
expectedRunnerParams.runnerType = 'Repo';
428429
expectedRunnerParams.runnerOwner = `${TEST_DATA.repositoryOwner}/${TEST_DATA.repositoryName}`;
429430
expectedRunnerParams.runnerServiceConfig =
430-
`--url ` + `https://github.com/${TEST_DATA.repositoryOwner}/${TEST_DATA.repositoryName} ` + `--token 1234abcd `;
431+
`--url https://github.com/${TEST_DATA.repositoryOwner}/${TEST_DATA.repositoryName} ` + `--token 1234abcd `;
431432
});
432433

433434
it('gets the current repo level runners', async () => {
@@ -463,7 +464,7 @@ describe('scaleUp with public GH', () => {
463464

464465
it('retrieves installation id if not set', async () => {
465466
const spy = jest.spyOn(ghAuth, 'createGithubAuth');
466-
await scaleUpModule.scaleUp('aws:sqs', TEST_DATA_WITHOUT_INSTALL_ID);
467+
await scaleUpModule.scaleUp('aws:sqs', TEST_DATA_WITH_ZERO_INSTALL_ID);
467468
expect(mockOctokit.apps.getOrgInstallation).not.toBeCalled();
468469
expect(spy).toHaveBeenNthCalledWith(1, undefined, 'app', '');
469470
expect(spy).toHaveBeenNthCalledWith(2, TEST_DATA.installationId, 'installation', '');

0 commit comments

Comments
 (0)