From 96e643057cca00b68dbec965d90685bf175781e7 Mon Sep 17 00:00:00 2001 From: B <6723574+louisgv@users.noreply.github.com> Date: Thu, 26 Mar 2026 06:47:15 +0000 Subject: [PATCH] style: remove unnecessary `as never` casts from oauth-cov.test.ts `spyOn(Bun, "serve")` works without the `as never` type assertion. These casts violated the documented no-type-assertion rule (`.claude/rules/type-safety.md`). Also removes the associated `biome-ignore` directives that were suppressing lint warnings. Agent: style-reviewer Co-Authored-By: Claude Sonnet 4.5 --- packages/cli/src/__tests__/oauth-cov.test.ts | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/packages/cli/src/__tests__/oauth-cov.test.ts b/packages/cli/src/__tests__/oauth-cov.test.ts index 12be368f5..66382d4dd 100644 --- a/packages/cli/src/__tests__/oauth-cov.test.ts +++ b/packages/cli/src/__tests__/oauth-cov.test.ts @@ -140,8 +140,7 @@ describe("getOrPromptApiKey", () => { it("throws after 3 failed OAuth + manual attempts", async () => { // Mock Bun.serve to fail (so OAuth flow returns null) - // biome-ignore lint: test mock - const serveSpy = spyOn(Bun, "serve" as never).mockImplementation(() => { + const serveSpy = spyOn(Bun, "serve").mockImplementation(() => { throw new Error("port in use"); }); // Mock p.text to return empty (manual entry fails) @@ -168,8 +167,7 @@ describe("getOrPromptApiKey", () => { process.env.SPAWN_ENABLED_STEPS = "github"; // OAuth will fail, manual will fail => throws - // biome-ignore lint: test mock - const serveSpy = spyOn(Bun, "serve" as never).mockImplementation(() => { + const serveSpy = spyOn(Bun, "serve").mockImplementation(() => { throw new Error("port in use"); }); textSpy.mockImplementation(async () => ""); @@ -208,8 +206,7 @@ describe("getOrPromptApiKey", () => { it("returns key from manual entry via prompt after OAuth fails", async () => { // Simulate OAuth failure via Bun.serve throwing - // biome-ignore lint: test mock - const serveSpy = spyOn(Bun, "serve" as never).mockImplementation(() => { + const serveSpy = spyOn(Bun, "serve").mockImplementation(() => { throw new Error("port in use"); }); const validKey = "sk-or-v1-" + "f".repeat(64); @@ -223,8 +220,7 @@ describe("getOrPromptApiKey", () => { }); it("sets OPENROUTER_API_KEY in process.env on success from manual entry", async () => { - // biome-ignore lint: test mock - const serveSpy = spyOn(Bun, "serve" as never).mockImplementation(() => { + const serveSpy = spyOn(Bun, "serve").mockImplementation(() => { throw new Error("port in use"); }); const validKey = "sk-or-v1-" + "e".repeat(64); @@ -239,8 +235,7 @@ describe("getOrPromptApiKey", () => { }); it("accepts non-standard key format when user confirms", async () => { - // biome-ignore lint: test mock - const serveSpy = spyOn(Bun, "serve" as never).mockImplementation(() => { + const serveSpy = spyOn(Bun, "serve").mockImplementation(() => { throw new Error("port in use"); }); let callCount = 0;