Skip to content
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
30 changes: 30 additions & 0 deletions src/features/projects/releases/createReleaseCommandV1.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import type { Client } from "../../../client";
import { CreateReleaseCommandV1 } from "./createReleaseCommandV1";
import { ReleaseRepository } from "./releaseRepository";

describe("CreateReleaseCommandV1", () => {
test("create posts GitResources in the create/v1 request body", async () => {
const doCreate = jest.fn().mockResolvedValue({ ReleaseId: "Releases-1", ReleaseVersion: "1.0.0" });
// A minimal stand-in for Client exercising only the members create() touches.
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
const client = {
getServerInformation: jest.fn().mockResolvedValue({ version: "2022.4.0" }),
debug: jest.fn(),
error: jest.fn(),
doCreate,
} as unknown as Client;

const command: CreateReleaseCommandV1 = {
spaceName: "Spaces-1",
ProjectName: "My Project",
GitResources: ["Update Argo Manifests:refs/heads/feature-x"],
};

await new ReleaseRepository(client, "Default").create(command);

expect(doCreate).toHaveBeenCalledTimes(1);
const [path, body] = doCreate.mock.calls[0];
expect(path).toContain("/releases/create/v1");
expect(body.GitResources).toEqual(["Update Argo Manifests:refs/heads/feature-x"]);
});
});
1 change: 1 addition & 0 deletions src/features/projects/releases/createReleaseCommandV1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface CreateReleaseCommandV1 extends SpaceScopedOperation {
ReleaseVersion?: string;
ChannelName?: string;
Packages?: string[];
GitResources?: string[];
ReleaseNotes?: string;
IgnoreIfAlreadyExists?: boolean;
IgnoreChannelRules?: boolean;
Expand Down
Loading