fix(cli): map timeseries element types for backend
This commit is contained in:
@@ -262,6 +262,26 @@ test("uses project scoped headers for realtime data commands", async () => {
|
||||
}
|
||||
});
|
||||
|
||||
test("maps CLI pipe and junction types to backend link and node types", async () => {
|
||||
const server = await startJsonServer({ accepted: true });
|
||||
const auth = { server: server.url, access_token: "token-3", project_id: "project-1" };
|
||||
const at = "2025-01-02T03:30:00+08:00";
|
||||
try {
|
||||
for (const args of [
|
||||
["data", "timeseries", "realtime", "simulation-by-id-time", "--id", "J1", "--type", "junction", "--time", at],
|
||||
["data", "timeseries", "realtime", "simulation-by-time-property", "--type", "pipe", "--time", at, "--property", "flow"],
|
||||
["data", "timeseries", "scheme", "simulation", "--query", "by-id-time", "--id", "P1", "--type", "pipe", "--time", at, "--scheme", "scheme_case"],
|
||||
]) {
|
||||
const result = await runCli(["--auth-stdin", ...args], auth);
|
||||
assert.equal(result.exitCode, 0, result.stderr);
|
||||
}
|
||||
const queries = server.seen.map(normalizeSeenRequest).map((request) => request.query.type);
|
||||
assert.deepEqual(queries, ["node", "link", "link"]);
|
||||
} finally {
|
||||
await server.close();
|
||||
}
|
||||
});
|
||||
|
||||
test("matches Python CLI backend request shape for every command and key variants", async () => {
|
||||
const tempDir = await mkdtemp(join(tmpdir(), "tjwater-cli-parity-"));
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user