swarm-ui: the badge tooltips are built by a tested helper
This commit is contained in:
parent
ebcf838dd8
commit
c42db99f27
1 changed files with 58 additions and 7 deletions
27
frontend/packages/swarm-ui/test/badge-titles.test.mjs
Normal file
27
frontend/packages/swarm-ui/test/badge-titles.test.mjs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
// The model and effort badge tooltips. Run by `npm test`, which Node runs with
|
||||
// its built-in test runner and type stripping.
|
||||
import assert from "node:assert/strict";
|
||||
import { test } from "node:test";
|
||||
import { effortTitle, modelTitle } from "../src/agent/state/badge-titles.ts";
|
||||
|
||||
test("a plain model badge says what the alias resolved to, or nothing", () => {
|
||||
assert.equal(modelTitle("claude-x-1", false), "resolved to claude-x-1");
|
||||
assert.equal(modelTitle(undefined, false), undefined);
|
||||
assert.equal(modelTitle("", false), undefined);
|
||||
});
|
||||
|
||||
test("a clickable model badge says it opens the settings", () => {
|
||||
assert.equal(
|
||||
modelTitle("claude-x-1", true),
|
||||
"resolved to claude-x-1. Click for the inference settings",
|
||||
);
|
||||
assert.equal(modelTitle(undefined, true), "Click for the inference settings");
|
||||
});
|
||||
|
||||
test("the effort badge names its source and, when clickable, the click", () => {
|
||||
assert.equal(effortTitle("swarm", false), "set by: swarm");
|
||||
assert.equal(
|
||||
effortTitle("swarm", true),
|
||||
"set by: swarm. Click for the inference settings",
|
||||
);
|
||||
});
|
||||
Loading…
Reference in a new issue