Add mock fix

Signed-off-by: Lukas Fruntke (external expert on behalf of DB Netz) <lukas.fruntke-extern@deutschebahn.com>
This commit is contained in:
Lukas Fruntke (external expert on behalf of DB Netz)
2023-04-05 14:08:02 +02:00
parent 0e3f44132a
commit c92153205f
2 changed files with 10 additions and 4 deletions
@@ -52,6 +52,10 @@ import {
} from '../helpers';
import { createGithubRepoPushAction } from './githubRepoPush';
const initRepoAndPushMocked = initRepoAndPush as jest.Mock<
Promise<{ commitHash: string }>
>;
const mockOctokit = {
rest: {
repos: {
@@ -98,8 +102,7 @@ describe('github:repo:push', () => {
beforeEach(() => {
jest.resetAllMocks();
// @ts-ignore TS2339 Jest Mock is not detected by Typescript
initRepoAndPush.mockResolvedValue({ commitHash: 'test123' });
initRepoAndPushMocked.mockResolvedValue({ commitHash: 'test123' });
githubCredentialsProvider =
DefaultGithubCredentialsProvider.fromIntegrations(integrations);
@@ -31,6 +31,10 @@ import {
} from '../helpers';
import { createPublishGithubAction } from './github';
const initRepoAndPushMocked = initRepoAndPush as jest.Mock<
Promise<{ commitHash: string }>
>;
const mockOctokit = {
rest: {
users: {
@@ -87,8 +91,7 @@ describe('publish:github', () => {
beforeEach(() => {
jest.resetAllMocks();
// @ts-ignore TS2339 Jest Mock is not detected by Typescript
initRepoAndPush.mockResolvedValue({
initRepoAndPushMocked.mockResolvedValue({
commitHash: '220f19cc36b551763d157f1b5e4a4b446165dbd6',
});