smartcsv/test/test.ts

22 lines
645 B
TypeScript
Raw Normal View History

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