import truncateCSV from "./truncateCSV";

const tests = [
  [["ocean", "pear", "ronin", "alaska"], 4, "ocean, pear, ronin, alaska"],
  [["ocean", "pear", "ronin", "alaska"], 3, "ocean, pear, ronin, +1 more"],
  [["ocean", "pear", "ronin", "alaska"], 2, "ocean, pear, +2 more"],
  [["ocean", "pear", "ronin", "alaska"], 0, "4"],
  [["ocean", "pear", "ronin", "alaska"], 6, "ocean, pear, ronin, alaska"],
  [["ocean", "pear", "ronin", "alaska"], Infinity, "ocean, pear, ronin, alaska"],
];

describe("truncateCSV", () => {
  it("properly concatenates", () => {
    tests.forEach(([strings, max, expected]) => {
      expect(truncateCSV(strings, max)).toBe(expected);
    });
  });
});
