Skip to content
This repository was archived by the owner on Jan 16, 2025. It is now read-only.

Commit e8166b9

Browse files
authored
chore: Ensure mockes are always loaded so tests can run in isolation (#1454)
* Ensure mockes are always loaded so tests can run in isolation * please the linter * Add CI check two test 2 tests of both suites in isolation * Add CI check two test 2 tests of both suites in isolation * Add CI check two test 2 tests of both suites in isolation
1 parent 5b68b7b commit e8166b9

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

.github/workflows/lambda-runners.yml

+4
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,9 @@ jobs:
2626
run: yarn lint
2727
- name: Run tests
2828
run: yarn test
29+
- name: Run two tests in isolation
30+
run: |
31+
yarn run test src/scale-runners/scale-up.test.ts -t 'scaleUp with GHES on org level creates a runner with labels in s specific group' --coverage=false
32+
yarn run test src/scale-runners/scale-up.test.ts -t 'scaleUp with public GH on org level creates a runner with labels in s specific group' --coverage=false
2933
- name: Build distribution
3034
run: yarn build

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

+18-18
Original file line numberDiff line numberDiff line change
@@ -112,28 +112,28 @@ beforeEach(() => {
112112
owner: TEST_DATA.repositoryOwner,
113113
},
114114
]);
115+
116+
mockedAppAuth.mockResolvedValue({
117+
type: 'app',
118+
token: 'token',
119+
appId: TEST_DATA.installationId,
120+
expiresAt: 'some-date',
121+
});
122+
mockedInstallationAuth.mockResolvedValue({
123+
type: 'token',
124+
tokenType: 'installation',
125+
token: 'token',
126+
createdAt: 'some-date',
127+
expiresAt: 'some-date',
128+
permissions: {},
129+
repositorySelection: 'all',
130+
});
131+
132+
mockCreateClient.mockResolvedValue(new mocktokit());
115133
});
116134

117135
describe('scaleUp with GHES', () => {
118136
beforeEach(() => {
119-
mockedAppAuth.mockResolvedValue({
120-
type: 'app',
121-
token: 'token',
122-
appId: TEST_DATA.installationId,
123-
expiresAt: 'some-date',
124-
});
125-
mockedInstallationAuth.mockResolvedValue({
126-
type: 'token',
127-
tokenType: 'installation',
128-
token: 'token',
129-
createdAt: 'some-date',
130-
expiresAt: 'some-date',
131-
permissions: {},
132-
repositorySelection: 'all',
133-
});
134-
135-
mockCreateClient.mockResolvedValue(new mocktokit());
136-
137137
process.env.GHES_URL = 'https://github.enterprise.something';
138138
});
139139

0 commit comments

Comments
 (0)