fix(test): silence expected oauth login cli output
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { afterAll, describe, it, expect, beforeEach, afterEach, mock } from "bun:test"
|
import { afterAll, afterEach, beforeEach, describe, expect, it, mock, spyOn } from "bun:test"
|
||||||
|
|
||||||
const mockLogin = mock(() => Promise.resolve({ accessToken: "test-token", expiresAt: 1710000000 }))
|
const mockLogin = mock(() => Promise.resolve({ accessToken: "test-token", expiresAt: 1710000000 }))
|
||||||
|
|
||||||
@@ -18,12 +18,18 @@ afterAll(() => {
|
|||||||
const { login } = await import("./login")
|
const { login } = await import("./login")
|
||||||
|
|
||||||
describe("login command", () => {
|
describe("login command", () => {
|
||||||
|
let consoleErrorSpy: ReturnType<typeof spyOn>
|
||||||
|
let consoleLogSpy: ReturnType<typeof spyOn>
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
mockLogin.mockClear()
|
mockLogin.mockClear()
|
||||||
|
consoleErrorSpy = spyOn(console, "error").mockImplementation(() => {})
|
||||||
|
consoleLogSpy = spyOn(console, "log").mockImplementation(() => {})
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
// cleanup
|
consoleErrorSpy.mockRestore()
|
||||||
|
consoleLogSpy.mockRestore()
|
||||||
})
|
})
|
||||||
|
|
||||||
it("returns error code when server-url is not provided", async () => {
|
it("returns error code when server-url is not provided", async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user