15 lines
552 B
TypeScript
15 lines
552 B
TypeScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
import { formatCell, mdTable } from "../src/format.js";
|
|
|
|
test("formats markdown tables", () => {
|
|
assert.equal(mdTable(["Name", "Type"], [["local", "postgres"]]), "| Name | Type |\n| ----- | -------- |\n| local | postgres |");
|
|
});
|
|
|
|
test("formats database cell values", () => {
|
|
assert.equal(formatCell(null), "NULL");
|
|
assert.equal(formatCell(undefined), "NULL");
|
|
assert.equal(formatCell({ ok: true }), "{\"ok\":true}");
|
|
assert.equal(formatCell("hello"), "hello");
|
|
});
|