chore: Fix lint.

This commit is contained in:
cpojer
2026-02-09 09:55:48 +09:00
parent 0497bb0544
commit 6614c3f932
5 changed files with 22 additions and 8 deletions

View File

@@ -19,13 +19,20 @@ async function getFreePort(): Promise<number> {
});
}
const urlToString = (url: Request | URL | string): string => {
if (typeof url === "string") {
return url;
}
return "url" in url ? url.url : String(url);
};
describe("loginChutes", () => {
it("captures local redirect and exchanges code for tokens", async () => {
const port = await getFreePort();
const redirectUri = `http://127.0.0.1:${port}/oauth-callback`;
const fetchFn: typeof fetch = async (input, init) => {
const url = String(input);
const url = urlToString(input);
if (url === CHUTES_TOKEN_ENDPOINT) {
return new Response(
JSON.stringify({
@@ -68,7 +75,7 @@ describe("loginChutes", () => {
it("supports manual flow with pasted code", async () => {
const fetchFn: typeof fetch = async (input) => {
const url = String(input);
const url = urlToString(input);
if (url === CHUTES_TOKEN_ENDPOINT) {
return new Response(
JSON.stringify({
@@ -107,7 +114,7 @@ describe("loginChutes", () => {
it("does not reuse code_verifier as state", async () => {
const fetchFn: typeof fetch = async (input) => {
const url = String(input);
const url = urlToString(input);
if (url === CHUTES_TOKEN_ENDPOINT) {
return new Response(
JSON.stringify({