forked from anomalyco/opencode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror.test.ts
More file actions
16 lines (13 loc) · 728 Bytes
/
Copy patherror.test.ts
File metadata and controls
16 lines (13 loc) · 728 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { describe, expect, test } from "bun:test"
import { NamedError } from "@opencode-ai/core/util/error"
import { MessageError } from "../../src/session/message-error"
describe("util.error", () => {
test("schema-backed named errors are real NamedError instances", () => {
const error = new MessageError.AuthError({ providerID: "anthropic", message: "boom" })
expect(error).toBeInstanceOf(NamedError)
expect(error.toObject()).toEqual({ name: "ProviderAuthError", data: { providerID: "anthropic", message: "boom" } })
})
test("named errors without fields serialize data", () => {
expect(new MessageError.OutputLengthError({}).toObject()).toEqual({ name: "MessageOutputLengthError", data: {} })
})
})