import { module, test } from "qunit"; import { jsonToHtml } from "discourse/plugins/discourse-ai/discourse/lib/utilities"; module("Unit | Utility | json-to-html", function () { test("it properly handles nulls", function (assert) { const input = null; const result = jsonToHtml(input).toString(); assert.equal(result, "null", "Null should be properly formatted"); }); test("it properly handles boolean", function (assert) { const input = true; const result = jsonToHtml(input).toString(); assert.equal(result, "true", "Boolean should be properly formatted"); }); test("it properly handles numbers", function (assert) { const input = 42.1; const result = jsonToHtml(input).toString(); assert.equal(result, "42.1", "Numbers should be properly formatted"); }); test("it properly handles undefined", function (assert) { const input = undefined; const result = jsonToHtml(input).toString(); assert.equal(result, "", "Undefined should be properly formatted"); }); test("it handles nested objects correctly", function (assert) { const input = { outer: { inner: { key: "value", }, }, }; const result = jsonToHtml(input).toString(); const expected = ""; assert.equal( result, expected, "Nested objects should be properly formatted" ); }); test("it handles arrays correctly", function (assert) { const input = { array: [1, 2, 3], }; const result = jsonToHtml(input).toString(); const expected = ""; assert.equal(result, expected, "Arrays should be properly formatted"); }); });