mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 09:30:31 +03:00
23 lines
591 B
TypeScript
23 lines
591 B
TypeScript
import { csvToJson, jsonToCsv } from '../../../src/utils/helpers/csvjson';
|
|
|
|
describe('csvjson', () => {
|
|
const csv = `"foo","bar","baz"
|
|
"hello","world","something"
|
|
"one","two","three"`;
|
|
const json = [
|
|
{ foo: 'hello', bar: 'world', baz: 'something' },
|
|
{ foo: 'one', bar: 'two', baz: 'three' },
|
|
];
|
|
|
|
describe('csvToJson', () => {
|
|
it('parses CSVs as expected', async () => {
|
|
expect(await csvToJson(csv)).toEqual(json);
|
|
});
|
|
});
|
|
|
|
describe('jsonToCsv', () => {
|
|
it('parses JSON as expected', () => {
|
|
expect(jsonToCsv(json)).toEqual(csv);
|
|
});
|
|
});
|
|
});
|