Signed-off-by: Bogdan Nechyporenko <bnechyporenko@bol.com>
This commit is contained in:
Bogdan Nechyporenko
2025-01-30 22:22:53 +01:00
parent 01c542e5f1
commit 97497d056a
2 changed files with 12 additions and 4 deletions
@@ -48,7 +48,7 @@ const mockGitlabClient = {
}),
},
Commits: {
create: jest.fn(),
create: jest.fn(() => ({ id: 'mockId' })),
},
MergeRequests: {
create: jest.fn(async (repoId: string) => {
@@ -267,7 +267,10 @@ describe('createGitLabMergeRequest', () => {
irrelevant: { 'bar.txt': 'Nothing to see here' },
},
});
const ctx = createMockActionContext({ input, workspacePath });
const ctx = createMockActionContext({
input,
workspacePath,
});
await instance.handler(ctx);
expect(mockGitlabClient.Projects.show).not.toHaveBeenCalled();
@@ -21,7 +21,7 @@ import {
mockCredentials,
mockServices,
} from '@backstage/backend-test-utils';
import { JsonObject } from '@backstage/types';
import { JsonObject, JsonValue } from '@backstage/types';
import { ActionContext } from '@backstage/plugin-scaffolder-node';
/**
@@ -43,7 +43,12 @@ export const createMockActionContext = <
output: jest.fn(),
createTemporaryDirectory: jest.fn(),
input: {} as TActionInput,
checkpoint: jest.fn(),
async checkpoint<T extends JsonValue | void>(opts: {
key: string;
fn: () => Promise<T> | T;
}): Promise<T> {
return opts.fn();
},
getInitiatorCredentials: () => Promise.resolve(credentials),
task: {
id: 'mock-task-id',