2018-05-10 17:47:14 +00:00
|
|
|
// 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;
|
|
|
|
|
2018-05-10 22:53:27 +00:00
|
|
|
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 () => {
|
2018-05-10 22:53:27 +00:00
|
|
|
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();
|