|
1 | 1 | import { describe, expect, it } from 'vitest' |
2 | 2 |
|
3 | 3 | import { parseText } from '../src/text' |
4 | | -import { testEmptyLine } from '../src/utils' |
| 4 | +import { isEmptyLine } from '../src/utils' |
5 | 5 | import { PARSE_TESTS } from './cases' |
6 | 6 |
|
7 | 7 | describe('parseText', () => { |
@@ -34,17 +34,17 @@ describe('parseText', () => { |
34 | 34 | { description: ', with empty text', text: '', expected: [] }, |
35 | 35 | { description: ', with first line only whitespace', text: ' \na,b,c', expected: [[' '], ['a', 'b', 'c']] }, |
36 | 36 | { description: ', with comments', text: '#comment line 1\n#comment line 2\na,b,c\n#comment line 3\nd,e,f\n', expected: [['a', 'b', 'c'], ['d', 'e', 'f']] }, |
37 | | - ])('works together with testEmptyLine to skip empty lines$description', ({ text, expected }) => { |
38 | | - const results = [...parseText(text, { comments: '#' })].filter(({ row }) => !testEmptyLine(row, true)) |
| 37 | + ])('works together with isEmptyLine to skip empty lines$description', ({ text, expected }) => { |
| 38 | + const results = [...parseText(text, { comments: '#' })].filter(({ row }) => !isEmptyLine(row)) |
39 | 39 |
|
40 | 40 | expect(results.map(({ row }) => row)).toEqual(expected) |
41 | 41 | }) |
42 | 42 |
|
43 | 43 | it.for([ |
44 | 44 | { description: '', text: 'a,b\n\n,\nc,d\n , \n""," "\n\t,\t\n,,,,\n', expected: [['a', 'b'], ['c', 'd']] }, |
45 | 45 | { description: ', with quotes and delimiters as content', text: 'a,b\n\n,\nc,d\n" , ",","\n""" """,""""""\n\n\n', expected: [['a', 'b'], ['c', 'd'], [' , ', ','], ['" "', '""']] }, |
46 | | - ])('works together with testEmptyLine to skip empty lines, in greedy mode$description', ({ text, expected }) => { |
47 | | - const results = [...parseText(text)].filter(({ row }) => !testEmptyLine(row, 'greedy')) |
| 46 | + ])('works together with isEmptyLine to skip empty lines, in greedy mode$description', ({ text, expected }) => { |
| 47 | + const results = [...parseText(text)].filter(({ row }) => !isEmptyLine(row, { greedy: true })) |
48 | 48 |
|
49 | 49 | expect(results.map(({ row }) => row)).toEqual(expected) |
50 | 50 | }) |
|
0 commit comments