options.test.ts 478 B

1234567891011121314
  1. import { expect, test } from "bun:test"
  2. import { ServerOptions } from "@opencode-ai/server/options"
  3. import { Option, Schema } from "effect"
  4. const decode = Schema.decodeUnknownOption(ServerOptions)
  5. test("accepts ephemeral port zero", () => {
  6. expect(Option.isSome(decode({ port: 0 }))).toBe(true)
  7. })
  8. test("rejects ports outside the valid range", () => {
  9. expect(Option.isNone(decode({ port: -1 }))).toBe(true)
  10. expect(Option.isNone(decode({ port: 65_536 }))).toBe(true)
  11. })