Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
hipstersmoothie committed Mar 29, 2021
1 parent b913f18 commit ab5d33b
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions packages/core/src/__tests__/auto.test.ts
Expand Up @@ -959,6 +959,35 @@ describe("Auto", () => {
);
});


test("should use --to commit target", async () => {
const auto = new Auto({ ...defaults, plugins: [] });
auto.logger = dummyLog();
await auto.loadConfig();
auto.git!.getLatestRelease = () => Promise.resolve("1.2.3");

jest.spyOn(auto.git!, "publish").mockReturnValueOnce({ data: {} } as any);
jest
.spyOn(auto.release!, "generateReleaseNotes")
.mockImplementation(() => Promise.resolve("releaseNotes"));
auto.release!.getCommitsInRelease = () =>
Promise.resolve([makeCommitFromMsg("Test Commit")]);

auto.hooks.getPreviousVersion.tap("test", () => "1.2.4");
const afterRelease = jest.fn();
auto.hooks.afterRelease.tap("test", afterRelease);
jest.spyOn(auto.release!, "getCommits").mockImplementation();

await auto.runRelease({ to: 'abc'});

expect(auto.git!.publish).toHaveBeenCalledWith(
"releaseNotes",
"v1.2.4",
false,
"abc"
);
});

test("should publish to a tag", async () => {
const auto = new Auto({ ...defaults, plugins: [] });
auto.logger = dummyLog();
Expand Down

0 comments on commit ab5d33b

Please sign in to comment.