import { describe, expect, it } from "bun:test"; import { dataToCSV } from "./csv"; const data = [ { quote: "Please enter a valid\nvalue before proceeding\nto print the receipt.", name: "list", value: 47, bool: true, extra: "extra", }, { quote: "Without a receipt\nwe are unable to process\n\na return.\n", name: "anoteher", value: 47, bool: true, extra: "extra", }, ]; describe("CSVtoString", () => { it("should convert data to CSV", () => { const csv = dataToCSV(data, { quote: (row) => row.quote, name: (row) => row.name, value: (row) => row.value, bool: (row) => row.bool, }); expect(csv).toMatchInlineSnapshot(` "quote,name,value,bool "Please enter a valid value before proceeding to print the receipt.",list,47,true "Without a receipt we are unable to process a return.",anoteher,47,true" `); }); });