Project Files
tests / flatten.test.cjs
const assert = require("node:assert/strict");
const { describe, it } = require("node:test");
const { flattenToMetadataList } = require("../dist/flatten.js");
describe("flattenToMetadataList", () => {
it("flattens nested objects and arrays like Python", () => {
const rows = flattenToMetadataList({ a: { b: 1 }, c: [10, 20] }, "root");
const paths = new Set(rows.map((r) => r.path));
assert.equal(paths.has("root.a.b"), true);
assert.equal(paths.has("root.c[0]"), true);
assert.equal(paths.has("root.c[1]"), true);
});
});