Versions 154 to 155
new file, 218 lines
2+// - every command is sorted: one that works on this machine only takes no --server and says so; every other one
4+// - a missing, empty or malformed value is refused before anything is sent, for every family of command;
5+// - in a joined folder, --server naming the folder's own server reaches it; another server is refused, never
6+// swapped in, and nothing is sent; outside a joined folder a folder command with --server is refused too;
7+// - an explicit --server goes to that server's own Issues Worker, which ABSO_ISSUES_SERVER doesn't redirect;
8+// - a command that picks its server (whoami, box, logout) uses the one named, even inside a folder on another.
9+
20+
23+
29+
30+/** A server that notes each path it is asked for and answers 500, so a command stops after its first call. */
41+
48+
53+
62+
67+
73+
76+
80+
84+
86+ it("sorts every command: local ones take no --server, every other one does, and help says so alike", async () => {
98+ assert.ok(help.stdout.includes(` ${serverHelp(name)}\n`), `abso ${name} --help names --server`);
103+ for (const c of data.commands.filter((c) => c.name in table)) assert.equal(c.server, serverHelp(c.name), c.name);
107+
116+ assert.match(r.stderr, /works on this machine only and talks to no server, so it takes no --server/);
121+
122+ it("refuses a missing, empty or malformed value before anything is sent, in every family", async () => {
142+ assert.match(empty.stderr, /--server needs a server's URL, like https:\/\/api\.abso\.dev/, argv.join(" "));
143+ for (const bad of ["api.abso.dev", "ftp://api.abso.dev", "https://me@api.abso.dev", "https://x.example/?a=1"]) {
146+ assert.match(r.stderr, /--server takes an http or https URL with no user name, query or fragment/);
151+
152+ it("in a joined folder, reaches the folder's own server and refuses another without sending anything", async () => {
154+ for (const argv of [["status"], ["log"], ["issues"], ["issue", "1"], ["news"], ["waiting"], ["ci"]]) {
156+ const same = await run(root, [...argv, "--server", `${home.url.toUpperCase().replace("HTTP", "http")}/`]);
166+ `this folder is joined on ${home.url}, not ${other.url}, so abso ${argv[0]} won't send its work or key there`,
172+
173+ it("outside a joined folder, a folder command with --server says how to join one there", async () => {
175+ for (const argv of [["status"], ["issue", "new", "A title"], ["ask", "bob", "Why?"], ["news"]]) {
182+
183+ it("an explicit --server takes issues to that server's own Issues Worker, past ABSO_ISSUES_SERVER", async () => {
188+ assert.ok(issuesElsewhere.paths.length > 0, "without --server, ABSO_ISSUES_SERVER names the Issues Worker");
199+
200+ it("a command that picks its server uses the one named, even in a folder on another", async () => {
209+ assert.equal(other.paths.filter((p) => p === "/version").length, 0, "doctor didn't swap in the folder's server");
211+
212+ it("counts two spellings of one server as the same, and different ports or paths as different", () => {
- MCP
- compare on this site's /mcp
- CLI
- abso diff 154 155 client/test/server-flag.test.ts --json
- JSON
- /christopher/abso-core/compare/154..155?file=client%2Ftest%2Fserver-flag.test.ts&format=json