mirror of
https://github.com/moltbot/moltbot.git
synced 2026-03-21 16:41:56 +00:00
chore: Fix lint.
This commit is contained in:
@@ -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 });
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ function installFailingFetchCapture() {
|
||||
if (rawBody instanceof ArrayBuffer) {
|
||||
return Buffer.from(new Uint8Array(rawBody)).toString("utf8");
|
||||
}
|
||||
return String(rawBody);
|
||||
return null;
|
||||
})();
|
||||
lastBody = bodyText ? (JSON.parse(bodyText) as unknown) : undefined;
|
||||
throw new Error("intentional fetch abort (test)");
|
||||
|
||||
@@ -103,7 +103,7 @@ describe("acquireSessionWriteLock", () => {
|
||||
});
|
||||
it("cleans up locks on SIGINT without removing other handlers", async () => {
|
||||
const root = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-lock-"));
|
||||
const originalKill = process.kill.bind(process) as typeof process.kill;
|
||||
const originalKill = process.kill.bind(process);
|
||||
const killCalls: Array<NodeJS.Signals | undefined> = [];
|
||||
let otherHandlerCalled = false;
|
||||
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -2,7 +2,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { installProcessWarningFilter, shouldIgnoreWarning } from "./warning-filter.js";
|
||||
|
||||
const warningFilterKey = Symbol.for("openclaw.warning-filter");
|
||||
const baseEmitWarning = process.emitWarning.bind(process) as typeof process.emitWarning;
|
||||
const baseEmitWarning = process.emitWarning.bind(process);
|
||||
|
||||
function resetWarningFilterInstallState(): void {
|
||||
const globalState = globalThis as typeof globalThis & {
|
||||
|
||||
Reference in New Issue
Block a user