style: remove unnecessary as never casts from oauth-cov.test.ts (#3002)

`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: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
A 2026-03-26 00:33:58 -07:00 committed by GitHub
parent 7378cab0b2
commit af37ad2db5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;