import { readFileSync } from 'fs' import { join } from 'path' import { csvToJSON } from './csv_to_json' describe('csvToJSON', () => { let file: Buffer beforeAll(() => { file = readFileSync(join(__dirname, '..', '..', '..', '..', 'test', 'support', 'bioimpedances_valid.csv')) }) it('transform a csv to JSON with correct rows', async () => { expect(await csvToJSON({ file })).toHaveLength(2) }) it('transform a csv to JSON', async () => { expect((await csvToJSON({ file }))[0]).toMatchObject({ '1. Name': '022.266434-78' }) }) })