deepStrictEqual(s instanceof CSVWriter, true);
await s.abort();
});
- test('can create TransformStream (raw strings)', { concurrency: true }, async (t) => {
+ test('can create TransformStream (raw strings)', { concurrency: true }, async () => {
const input = new URL('./data/simple.csv', import.meta.url);
const stream = new CSVReader(input).pipeThrough(new CSVWriter());
const expected = [
await createCSVMockStream([['']]).pipeTo(writer);
deepStrictEqual(writer.status.name, basename(temp));
});
- test('records file name of "null" if CSVWriter is a TransformStream', { concurrency: true }, async (t) => {
+ test('records file name of "null" if CSVWriter is a TransformStream', { concurrency: true }, async () => {
const writer = new CSVWriter();
const stream = createCSVMockStream([['']]).pipeThrough(writer);
deepStrictEqual(writer.status.name, null);
['row 3', 'c']
]));
});
- test('counts raw CSV string as one row when TransformStream', { concurrency: true }, async (t) => {
+ test('counts raw CSV string as one row when TransformStream', { concurrency: true }, async () => {
const writer = new CSVWriter();
const stream = createCSVMockStream([['']])
.pipeThrough(new CSVTransformer(() => 'row 1,a\r\nrow 2,b\r\nrow 3,c', { handleHeaders: true }))
['2', '2', '2'],
['3', '3', '3']
])
- .pipeThrough(new CSVTransformer(r => { throw new Error(); }, { onError: skip() }))
+ .pipeThrough(new CSVTransformer(() => { throw new Error(); }, { onError: skip() }))
.pipeTo(csvStreamEqualWritable([
['header', 'header', 'header']
]));
['header', 'header', 'header'],
['1', '1', '1']
])
- .pipeThrough(new CSVTransformer(r => { throw new Error(); }, { onError: placeholder('n/a') }))
+ .pipeThrough(new CSVTransformer(() => { throw new Error(); }, { onError: placeholder('n/a') }))
.pipeTo(csvStreamEqualWritable([
['header', 'header', 'header'],
['n/a', 'n/a', 'n/a']
['1', '1', '1'],
['1', '1', '1']
])
- .pipeThrough(new CSVTransformer(r => { throw new Error(); }, { onError: placeholder('n/a') }))
+ .pipeThrough(new CSVTransformer(() => { throw new Error(); }, { onError: placeholder('n/a') }))
.pipeTo(csvStreamEqualWritable([
['header', 'header', 'header'],
['n/a', 'n/a', 'n/a'],
['header', 'header', 'header'],
['1']
])
- .pipeThrough(new CSVTransformer(r => { throw new Error(); }, { onError: placeholder('n/a') }))
+ .pipeThrough(new CSVTransformer(() => { throw new Error(); }, { onError: placeholder('n/a') }))
.pipeTo(csvStreamEqualWritable([
['header', 'header', 'header'],
['n/a']
['header', 'header', 'header'],
[]
])
- .pipeThrough(new CSVTransformer(r => { throw new Error(); }, { onError: placeholder('n/a') }))
+ .pipeThrough(new CSVTransformer(() => { throw new Error(); }, { onError: placeholder('n/a') }))
.pipeTo(csvStreamEqualWritable([
['header', 'header', 'header'],
['n/a']