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

@@ -6,10 +6,17 @@ import {
refreshChutesTokens,
} from "./chutes-oauth.js";
const urlToString = (url: Request | URL | string): string => {
if (typeof url === "string") {
return url;
}
return "url" in url ? url.url : String(url);
};
describe("chutes-oauth", () => {
it("exchanges code for tokens and stores username as email", async () => {
const fetchFn: typeof fetch = async (input, init) => {
const url = String(input);
const url = urlToString(input);
if (url === CHUTES_TOKEN_ENDPOINT) {
expect(init?.method).toBe("POST");
expect(
@@ -59,7 +66,7 @@ describe("chutes-oauth", () => {
it("refreshes tokens using stored client id and falls back to old refresh token", async () => {
const fetchFn: typeof fetch = async (input, init) => {
const url = String(input);
const url = urlToString(input);
if (url !== CHUTES_TOKEN_ENDPOINT) {
return new Response("not found", { status: 404 });
}