Skip to content

chore: Ensure mockes are always loaded so tests can run in isolation #1454

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/lambda-runners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,9 @@ jobs:
run: yarn lint
- name: Run tests
run: yarn test
- name: Run two tests in isolation
run: |
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
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
- name: Build distribution
run: yarn build
36 changes: 18 additions & 18 deletions modules/runners/lambdas/runners/src/scale-runners/scale-up.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,28 +112,28 @@ beforeEach(() => {
owner: TEST_DATA.repositoryOwner,
},
]);

mockedAppAuth.mockResolvedValue({
type: 'app',
token: 'token',
appId: TEST_DATA.installationId,
expiresAt: 'some-date',
});
mockedInstallationAuth.mockResolvedValue({
type: 'token',
tokenType: 'installation',
token: 'token',
createdAt: 'some-date',
expiresAt: 'some-date',
permissions: {},
repositorySelection: 'all',
});

mockCreateClient.mockResolvedValue(new mocktokit());
});

describe('scaleUp with GHES', () => {
beforeEach(() => {
mockedAppAuth.mockResolvedValue({
type: 'app',
token: 'token',
appId: TEST_DATA.installationId,
expiresAt: 'some-date',
});
mockedInstallationAuth.mockResolvedValue({
type: 'token',
tokenType: 'installation',
token: 'token',
createdAt: 'some-date',
expiresAt: 'some-date',
permissions: {},
repositorySelection: 'all',
});

mockCreateClient.mockResolvedValue(new mocktokit());

process.env.GHES_URL = 'https://github.enterprise.something';
});

Expand Down