mirror of
https://github.com/anomalyco/opencode.git
synced 2026-09-07 10:35:55 +00:00
15 lines
504 B
TypeScript
15 lines
504 B
TypeScript
import { expect, test } from "bun:test"
|
|
import { recentModels } from "../../src/context/local"
|
|
|
|
test("moves a model to the front, deduplicates, and limits recents", () => {
|
|
const recent = Array.from({ length: 12 }, (_, index) => ({
|
|
providerID: "provider",
|
|
modelID: `model-${index}`,
|
|
}))
|
|
|
|
expect(recentModels({ providerID: "provider", modelID: "model-5" }, recent)).toEqual([
|
|
{ providerID: "provider", modelID: "model-5" },
|
|
...recent.slice(0, 5),
|
|
...recent.slice(6, 10),
|
|
])
|
|
})
|