Skip to content

Commit

Permalink
test with SELF whenever possible
Browse files Browse the repository at this point in the history
  • Loading branch information
Techatrix committed Jun 5, 2024
1 parent a56560a commit 8ae3ebd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
5 changes: 2 additions & 3 deletions test/publish.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,14 @@ async function searchZLSRelease(

async function sendPublishForm(form: FormData): Promise<Response> {
assert(typeof env.API_TOKEN === "string" && env.API_TOKEN);
return await handlePublish(
return await SELF.fetch(
new Request("https://example.com/v1/publish", {
body: form,
method: "POST",
headers: {
Authorization: `Basic ${Buffer.from(`admin:${env.API_TOKEN}`).toString("base64")}`,
},
}),
env,
);
}

Expand Down Expand Up @@ -234,7 +233,7 @@ describe("/v1/publish", () => {
artifacts: getSampleArtifacts("0.1.0"),
});

expect(response.body).toBe(null);
expect(await response.text()).toBe("");
expect(response.status).toBe(200);
});

Expand Down
7 changes: 3 additions & 4 deletions test/select-zls-version.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ async function selectZLSVersion(
url.searchParams.set("zig_version", zigVersion);
url.searchParams.set("compatibility", compatibility);

const response = await handleSelectZLSVersion(new Request(url, {}), env);
const response = await SELF.fetch(url);
expect(response.status).toBe(200);
return await response.json();
}
Expand Down Expand Up @@ -272,9 +272,8 @@ describe("/v1/select-zls-version", () => {
});

test("search without version", async () => {
const response = await handleSelectZLSVersion(
new Request("https://example.com/v1/select-zls-version"),
env,
const response = await SELF.fetch(
"https://example.com/v1/select-zls-version",
);
const body =
await response.json<SelectZLSVersionWithoutVersionResponse>();
Expand Down

0 comments on commit 8ae3ebd

Please sign in to comment.