Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
hipstersmoothie committed Feb 1, 2021
1 parent 18db4df commit 5a4eceb
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions plugins/released/__tests__/released-label.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,32 @@ describe("release label plugin", () => {
expect(comment).not.toHaveBeenCalled();
});

test("should do nothing with PR that doesn't exist", async () => {
const releasedLabel = new ReleasedLabelPlugin();
const autoHooks = makeHooks();
releasedLabel.apply(({
hooks: autoHooks,
labels: defaultLabels,
logger: dummyLog(),
options: {},
comment,
git,
} as unknown) as Auto);

getPr.mockRejectedValueOnce(new Error("PR dont exist"));
const commit = makeCommitFromMsg("normal commit with no bump (#123)");
await autoHooks.afterRelease.promise({
newVersion: "1.0.0",
lastRelease: "0.1.0",
commits: await log.normalizeCommits([commit]),
releaseNotes: "",
// @ts-ignore
response: mockResponse,
});

expect(comment).not.toHaveBeenCalled();
});

test("should do nothing without commits", async () => {
const releasedLabel = new ReleasedLabelPlugin();
const autoHooks = makeHooks();
Expand Down

0 comments on commit 5a4eceb

Please sign in to comment.