Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ui: turn an archetype agent into a custom one from its detail

This commit is contained in:
atlas 2026-11-01 12:08:38 +01:00 • committed by mara
commit 83bb47d134

View file

@ -3,7 +3,10 @@
// imported as it is.
import assert from "node:assert/strict";
import { test } from "node:test";
import { showsLoginNeeded } from "../src/agent/AgentTypes.ts";
import {
canTurnIntoCustom,
showsLoginNeeded,
} from "../src/agent/AgentTypes.ts";
test("an agent that says it needs a login gets the badge", () => {
assert.equal(showsLoginNeeded({ needs_login: true }), true);
@ -17,3 +20,25 @@ test("an agent that has not said gets none", () => {
assert.equal(showsLoginNeeded({ needs_login: null }), false);
assert.equal(showsLoginNeeded({}), false);
});
test("turn into custom is offered to a placed archetype agent only", () => {
const archetype = { source: "hyperhive", name: "reviewer" };
assert.equal(
canTurnIntoCustom({ archetype, hive: "alpha", wanted: "up" }),
true,
);
// A custom agent has no archetype to turn from.
assert.equal(
canTurnIntoCustom({ archetype: null, hive: "alpha", wanted: "up" }),
false,
);
// The controller places the conversion on a hive, so one is needed.
assert.equal(
canTurnIntoCustom({ archetype, hive: null, wanted: "up" }),
false,
);
assert.equal(
canTurnIntoCustom({ archetype, hive: "alpha", wanted: "destroyed" }),
false,
);
});