Skip to content

Commit

Permalink
test: octokit.repos.uploadReleaseAsset with owner, repo and release…
Browse files Browse the repository at this point in the history
…_id options
  • Loading branch information
gr2m committed Jan 31, 2020
1 parent 94f78c1 commit d3bd732
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions test/rest-endpoint-methods.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,46 @@ describe("REST API endpoint methods", () => {
const octokit = new MyOctokit();
expect(typeof octokit.teams.listMembersLegacy.endpoint).toEqual("function");
});

it.only("octokit.repos.uploadReleaseAsset()", async () => {
const mock = fetchMock.sandbox().postOnce(
"https://uploads.github.com/repos/octocat/hello-world/releases/123/assets",
{ ok: true },
{
headers: {
"content-type": "text/plain"
},
query: {
name: "test.txt",
label: "test"
}
}
);

const MyOctokit = Octokit.plugin(restEndpointMethods);
const octokit = new MyOctokit({
auth: "secret123",
request: {
fetch: mock
}
});

return octokit.repos
.uploadReleaseAsset({
headers: {
"content-type": "text/plain"
},
owner: "octocat",
repo: "hello-world",
release_id: 123,
file: "test 1, 2",
name: "test.txt",
label: "test"
})
.catch(error => {
console.log(error);

throw error;
});
});
});

0 comments on commit d3bd732

Please sign in to comment.