smartcsv/test/test.ts
2018-05-10 19:47:14 +02:00

22 lines
624 B
TypeScript

// tslint:disable-next-line:no-implicit-dependencies
import { expect, tap } from 'tapbundle';
import * as smartcsv from '../ts/index';
// tslint:disable-next-line:no-implicit-dependencies
import * as smartfile from 'smartfile';
let fileString: string;
let testCsv: smartcsv.Csv;
tap.test('should read a file', async (tools) => {
fileString = smartfile.fs.toStringSync('./test/sample.csv');
});
tap.test('should create a valid csv', async () => {
testCsv = await smartcsv.Csv.createCsvFromString(fileString, {headers: true});
const result = await testCsv.exportAsObject();
console.log(result);
});
tap.start();