Skip to content

Commit 07c16ca

Browse files
committed
test: adapt for latest OpenAPI spec
1 parent 1ea8d5a commit 07c16ca

File tree

2 files changed

+35
-38
lines changed

2 files changed

+35
-38
lines changed

test/rest-endpoint-methods.test.ts

Lines changed: 34 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ describe("REST API endpoint methods", () => {
3333

3434
it("Required preview header", async () => {
3535
const mock = fetchMock.sandbox().getOnce(
36-
"path:/repos/octocat/hello-world/check-runs/123",
36+
"path:/codes_of_conduct",
3737
{ ok: true },
3838
{
3939
headers: {
40-
accept: "application/vnd.github.antiope-preview+json",
40+
accept: "application/vnd.github.scarlet-witch-preview+json",
4141
},
4242
}
4343
);
@@ -50,11 +50,7 @@ describe("REST API endpoint methods", () => {
5050
});
5151

5252
// See https://developer.github.com/v3/repos/#create-a-repository-dispatch-event
53-
const { data } = await octokit.checks.get({
54-
owner: "octocat",
55-
repo: "hello-world",
56-
check_run_id: 123,
57-
});
53+
const { data } = await octokit.codesOfConduct.getAllCodesOfConduct();
5854

5955
expect(data).toStrictEqual({ ok: true });
6056
});
@@ -138,36 +134,37 @@ describe("REST API endpoint methods", () => {
138134
});
139135
});
140136

141-
it("octokit.repos.addProtectedBranchRequiredStatusChecksContexts(): `contexts` option value is sent as request body without namespace", async () => {
142-
const mock = fetchMock.sandbox().postOnce(
143-
"https://api.github.com/repos/octocat/hello-world/branches/latest/protection/required_status_checks/contexts",
144-
{ ok: true },
145-
{
146-
body: ["myci1", "myci2"],
147-
}
148-
);
149-
150-
const MyOctokit = Octokit.plugin(restEndpointMethods);
151-
const octokit = new MyOctokit({
152-
auth: "secret123",
153-
request: {
154-
fetch: mock,
155-
},
156-
});
157-
158-
return octokit.repos
159-
.addStatusCheckContexts({
160-
owner: "octocat",
161-
repo: "hello-world",
162-
branch: "latest",
163-
contexts: ["myci1", "myci2"],
164-
})
165-
.catch((error) => {
166-
console.log(error);
167-
168-
throw error;
169-
});
170-
});
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+
// });
171168

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

test/typescript.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe("Smoke test", () => {
2626
name: "bug",
2727
url: "",
2828
},
29-
status: 201,
29+
status: 200,
3030
url: "",
3131
};
3232
}

0 commit comments

Comments
 (0)