Files
outline/server/utils/DocumentConverter.test.ts
Tom Moor 55ffd6d098 feat: Adds support for importing CSV files (#7912)
* feat: Adds support for importing CSV files

* test

* tsc
2024-11-07 19:09:02 -08:00

32 lines
683 B
TypeScript

import { DocumentConverter } from "./DocumentConverter";
describe("csvToMarkdown", () => {
it("should convert csv to markdown with comma", async () => {
const csv = `name,age
John,25
Jane,24`;
const markdown = `| name | age |
| --- | --- |
| John | 25 |
| Jane | 24 |
`;
expect(await DocumentConverter.csvToMarkdown(csv)).toEqual(markdown);
});
it("should convert csv to markdown with semicolon", async () => {
const csv = `name;age
John;25
"Joan ""the bone"", Anne";24`;
const markdown = `| name | age |
| --- | --- |
| John | 25 |
| Joan "the bone", Anne | 24 |
`;
expect(await DocumentConverter.csvToMarkdown(csv)).toEqual(markdown);
});
});