swarm-ui: test which entries the egress card lists and the swarm-wide add body
This commit is contained in:
parent
ad76e7e937
commit
7122a3a36d
1 changed files with 30 additions and 3 deletions
|
|
@ -5,6 +5,7 @@ import { test } from "node:test";
|
|||
import {
|
||||
allowedSummary,
|
||||
entryGroups,
|
||||
swarmWideEntries,
|
||||
entriesFor,
|
||||
entryBody,
|
||||
} from "../src/agent/detail/allowed-domains.ts";
|
||||
|
|
@ -85,3 +86,21 @@ test("entries are grouped by source, empty sources left out", () => {
|
|||
);
|
||||
assert.deepEqual(entryGroups([]), []);
|
||||
});
|
||||
|
||||
test("the egress card lists only the entries that hold for every agent", () => {
|
||||
const entries = [
|
||||
{ domain: "crates.io" },
|
||||
{ domain: "docs.rs", agent: "iris" },
|
||||
{ domain: "api.example.com", derived: true },
|
||||
{ domain: "github.com" },
|
||||
];
|
||||
assert.deepEqual(
|
||||
swarmWideEntries(entries).map((e) => e.domain),
|
||||
["crates.io", "github.com"],
|
||||
);
|
||||
assert.deepEqual(swarmWideEntries([]), []);
|
||||
});
|
||||
|
||||
test("an add from the swarm page, with no agent, is a swarm-wide entry", () => {
|
||||
assert.deepEqual(entryBody("github.com", true, ""), { domain: "github.com" });
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue