Download packages/core/test/model.test.ts from SaylorTwift/opencode: direct link, hf CLI and curl.
- Browser
- Download file 831 Bytes
-
https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/core/test/model.test.ts
- Command line
-
hf download hf://SaylorTwift/opencode/packages/core/test/model.test.ts
-
curl -L -o model.test.ts https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/core/test/model.test.ts
831 Bytes
| import { describe, expect, test } from "bun:test" | |
| import { Schema } from "effect" | |
| import { ModelV2 } from "@opencode-ai/core/model" | |
| import { ProviderV2 } from "@opencode-ai/core/provider" | |
| const decode = Schema.decodeUnknownSync(ModelV2.Ref) | |
| describe("ModelV2.Ref", () => { | |
| test("accepts a model selection without a variant", () => { | |
| expect(decode({ id: "claude-sonnet", providerID: "anthropic" })).toEqual({ | |
| id: ModelV2.ID.make("claude-sonnet"), | |
| providerID: ProviderV2.ID.make("anthropic"), | |
| }) | |
| }) | |
| test("preserves an explicit model variant", () => { | |
| expect(decode({ id: "claude-sonnet", providerID: "anthropic", variant: "high" })).toEqual({ | |
| id: ModelV2.ID.make("claude-sonnet"), | |
| providerID: ProviderV2.ID.make("anthropic"), | |
| variant: ModelV2.VariantID.make("high"), | |
| }) | |
| }) | |
| }) | |