Skip to content

Commit b3811a1

Browse files
authored
fix: `git.gists.update({ gist_id, files }) (#84)
1 parent 2dd3c00 commit b3811a1

File tree

3 files changed

+131
-4
lines changed

3 files changed

+131
-4
lines changed

package-lock.json

Lines changed: 89 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"author": "Gregor Martynus (https://twitter.com/gr2m)",
2525
"license": "MIT",
2626
"dependencies": {
27-
"@octokit/types": "^2.16.0",
27+
"@octokit/types": "^3.0.2",
2828
"deprecation": "^2.3.1"
2929
},
3030
"devDependencies": {

test/issues.test.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import fetchMock from "fetch-mock";
2+
import { Octokit } from "@octokit/core";
3+
4+
import { restEndpointMethods } from "../src";
5+
6+
describe("https://github.com/octokit/plugin-rest-endpoint-methods.js/issues/83", () => {
7+
it("git.gists.update({ gist_id, files })", async () => {
8+
const mock = fetchMock.sandbox().patchOnce(
9+
"path:/gists/gist123",
10+
{ ok: true },
11+
{
12+
body: {
13+
files: {
14+
"postcss.config.js": {
15+
content: "update from api",
16+
filename: "new-postcss.config.js",
17+
},
18+
},
19+
},
20+
}
21+
);
22+
23+
const MyOctokit = Octokit.plugin(restEndpointMethods);
24+
const octokit = new MyOctokit({
25+
auth: "secret123",
26+
request: {
27+
fetch: mock,
28+
},
29+
});
30+
31+
await octokit.gists.update({
32+
gist_id: "gist123",
33+
files: {
34+
"postcss.config.js": {
35+
content: "update from api",
36+
filename: "new-postcss.config.js",
37+
},
38+
},
39+
});
40+
});
41+
});

0 commit comments

Comments
 (0)