Skip to content

Commit 86e3e0e

Browse files
committed
test: octokit.repos.addProtectedBranchRequiredStatusChecksContexts(): contexts option value is sent as request body without namespace
1 parent a8fef84 commit 86e3e0e

File tree

1 file changed

+30
-31
lines changed

1 file changed

+30
-31
lines changed

test/rest-endpoint-methods.test.ts

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -134,37 +134,36 @@ describe("REST API endpoint methods", () => {
134134
});
135135
});
136136

137-
// TODO: will be resolved by https://github.com/github/rest-api-description/issues/88
138-
// it("octokit.repos.addProtectedBranchRequiredStatusChecksContexts(): `contexts` option value is sent as request body without namespace", async () => {
139-
// const mock = fetchMock.sandbox().postOnce(
140-
// "https://api.github.com/repos/octocat/hello-world/branches/latest/protection/required_status_checks/contexts",
141-
// { ok: true },
142-
// {
143-
// body: ["myci1", "myci2"],
144-
// }
145-
// );
146-
147-
// const MyOctokit = Octokit.plugin(restEndpointMethods);
148-
// const octokit = new MyOctokit({
149-
// auth: "secret123",
150-
// request: {
151-
// fetch: mock,
152-
// },
153-
// });
154-
155-
// return octokit.repos
156-
// .addStatusCheckContexts({
157-
// owner: "octocat",
158-
// repo: "hello-world",
159-
// branch: "latest",
160-
// // data: ["myci1", "myci2"],
161-
// })
162-
// .catch((error) => {
163-
// console.log(error);
164-
165-
// throw error;
166-
// });
167-
// });
137+
it("octokit.repos.addProtectedBranchRequiredStatusChecksContexts(): `contexts` option value is sent as request body without namespace", async () => {
138+
const mock = fetchMock.sandbox().postOnce(
139+
"https://api.github.com/repos/octocat/hello-world/branches/latest/protection/required_status_checks/contexts",
140+
{ ok: true },
141+
{
142+
body: ["myci1", "myci2"],
143+
}
144+
);
145+
146+
const MyOctokit = Octokit.plugin(restEndpointMethods);
147+
const octokit = new MyOctokit({
148+
auth: "secret123",
149+
request: {
150+
fetch: mock,
151+
},
152+
});
153+
154+
return octokit.repos
155+
.addStatusCheckContexts({
156+
owner: "octocat",
157+
repo: "hello-world",
158+
branch: "latest",
159+
contexts: ["myci1", "myci2"],
160+
})
161+
.catch((error) => {
162+
console.log(error);
163+
164+
throw error;
165+
});
166+
});
168167

169168
it("octokit.apps.listInstallations(): method without options (octokit/rest.js#818)", async () => {
170169
const mock = fetchMock

0 commit comments

Comments
 (0)