mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-04-28 03:49:31 +00:00
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:
parent
7378cab0b2
commit
af37ad2db5
1 changed files with 5 additions and 10 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue