Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
hipstersmoothie committed Aug 13, 2020
1 parent 0944e8f commit 60a92af
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions plugins/upload-assets/__tests__/upload-assets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,45 @@ describe("Upload Assets Plugin", () => {
const hooks = makeHooks();
const uploadReleaseAsset = jest.fn();

plugin.apply(({
hooks,
logger: dummyLog(),
git: {
options: { ...options, baseUrl: "https://github.my.com/api/v3" },
github: { repos: { uploadReleaseAsset } },
},
} as unknown) as Auto);

await hooks.afterRelease.promise({
newVersion: "1.0.0",
lastRelease: "0.1.0",
commits: [],
releaseNotes: "",
response: {
data: { id: "123" },
} as any,
});

expect(uploadReleaseAsset).toHaveBeenCalledWith(
expect.objectContaining({
headers: {
"content-length": 14044,
"content-type": "application/octet-stream",
},
baseUrl: "https://github.my.com/api/uploads",
name: "macos",
release_id: "123",
})
);
});

test("should upload to enterprise", async () => {
const plugin = new UploadAssets([
path.join(__dirname, "./test-assets/macos"),
]);
const hooks = makeHooks();
const uploadReleaseAsset = jest.fn();

plugin.apply(({
hooks,
logger: dummyLog(),
Expand Down

0 comments on commit 60a92af

Please sign in to comment.