mirror of
https://github.com/t8y2/dbx.git
synced 2026-11-02 08:30:35 +00:00
fix(packages): polish cli and mcp package contracts
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import type { ConnectionConfig } from "@dbx-app/node-core";
|
||||
import { connectionSummary, csvTable, errorPayload, formatErrorMessage, mdTable } from "../src/cli-format.js";
|
||||
import { connectionSummary, csvTable, errorPayload, formatCell, formatErrorMessage, mdTable } from "../src/cli-format.js";
|
||||
|
||||
const connection: ConnectionConfig = {
|
||||
id: "1",
|
||||
@@ -37,6 +37,11 @@ test("formats markdown tables", () => {
|
||||
assert.match(table, /postgres/);
|
||||
});
|
||||
|
||||
test("formats database cell values with shared formatter", () => {
|
||||
assert.equal(formatCell(null), "NULL");
|
||||
assert.equal(formatCell({ ok: true }), "{\"ok\":true}");
|
||||
});
|
||||
|
||||
test("builds stable error payloads", () => {
|
||||
assert.deepEqual(errorPayload("SQL_BLOCKED", "read-only"), {
|
||||
error: { code: "SQL_BLOCKED", message: "read-only" },
|
||||
|
||||
Reference in New Issue
Block a user