import { jsonPrettyPrint } from "./jsonPrettyPrint";

const json1 = { a: "a" };
const formatted1 = `{
  "a": "a"
}`;

const json2 = {};
const formatted2 = "{}";

describe("jsonPrettyPrint", () => {
  it("should work", () => {
    expect(jsonPrettyPrint(json1)).toEqual(formatted1);
    expect(jsonPrettyPrint(json2)).toEqual(formatted2);
    expect(jsonPrettyPrint(1)).toEqual("1");
    expect(jsonPrettyPrint("text")).toEqual('"text"');

    expect(jsonPrettyPrint("")).toEqual('""');
    expect(jsonPrettyPrint(null)).toEqual("null");
    expect(jsonPrettyPrint()).toEqual(undefined);
  });
});
