Skip to content

Commit a9e3bed

Browse files
committed
remove TODOs and unneeded tests
1 parent 56499f1 commit a9e3bed

5 files changed

Lines changed: 0 additions & 155 deletions

File tree

src/fetch.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
// TODO(SL): return a stream reader?
2-
// TODO(SL): let pass a custom fetch function?
3-
// TODO(SL): use If-Range header?
4-
51
/**
62
* Fetches a chunk of a remote file.
73
*
@@ -81,7 +77,6 @@ export async function fetchRange({
8177
Range: `bytes=${firstByte}-${lastByte}`,
8278
},
8379
}
84-
// TODO(SL): let pass a custom fetch function?
8580
const response = await fetch(url, mergedRequestInit)
8681
if (response.status === 416) {
8782
// Requested Range Not Satisfiable

src/options/quoteChar.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@
44
* @returns The quote character.
55
*/
66
export function validateQuoteChar(quoteChar?: string): string {
7-
// TODO(SL): guess the quote character?
87
return quoteChar ?? '"'
98
}

src/url.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ export async function* parseURL(
4343
options: parseURLOptions = {},
4444
): AsyncGenerator<ParseResult, void, unknown> {
4545
const chunkSize = checkIntegerGreaterOrEqualThan(options.chunkSize, 1) ?? defaultChunkSize
46-
// TODO(SL): should we accept negative values (from the end)?
4746
let firstByte = checkIntegerGreaterOrEqualThan(options.firstByte, 0) ?? 0
4847
let lastByte = checkIntegerGreaterOrEqualThan(options.lastByte, -1)
4948

tests/cases.ts

Lines changed: 0 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -528,52 +528,6 @@ export const CORE_PARSER_TESTS = [
528528
errors: [],
529529
},
530530
},
531-
{
532-
description: 'Simple duplicated header names',
533-
text: 'A,A,A,A\n1,2,3,4',
534-
config: { header: true },
535-
expected: {
536-
// TODO(SL): implement header name deduplication?
537-
data: [['A', 'A', 'A', 'A'], ['1', '2', '3', '4']],
538-
// data: [['A', 'A_1', 'A_2', 'A_3'], ['1', '2', '3', '4']],
539-
errors: [],
540-
meta: {
541-
// renamedHeaders: { A_1: 'A', A_2: 'A', A_3: 'A' },
542-
charCount: 15,
543-
},
544-
},
545-
},
546-
{
547-
description: 'Duplicated header names existing column',
548-
text: 'c,c,c,c_1\n1,2,3,4',
549-
config: { header: true },
550-
expected: {
551-
// TODO(SL): implement header name deduplication?
552-
// data: [['c', 'c_2', 'c_3', 'c_1'], ['1', '2', '3', '4']],
553-
data: [['c', 'c', 'c', 'c_1'], ['1', '2', '3', '4']],
554-
errors: [],
555-
meta: {
556-
// renamedHeaders: { c_2: 'c', c_3: 'c' },
557-
charCount: 17,
558-
},
559-
},
560-
},
561-
{
562-
description: 'Duplicate header names with __proto__ field',
563-
text: '__proto__,__proto__,__proto__\n1,2,3',
564-
config: { header: true },
565-
expected: {
566-
// TODO(SL): implement header name deduplication?
567-
// data: [['__proto__', '__proto___1', '__proto___2'], ['1', '2', '3']],
568-
data: [['__proto__', '__proto__', '__proto__'], ['1', '2', '3']],
569-
errors: [],
570-
meta: {
571-
// renamedHeaders: { __proto___1: '__proto__', __proto___2: '__proto__' },
572-
charCount: 35,
573-
},
574-
},
575-
},
576-
577531
]
578532

579533
export const PARSE_TESTS = [
@@ -657,51 +611,6 @@ export const PARSE_TESTS = [
657611
errors: [],
658612
},
659613
},
660-
// TODO(SL): implement header: true?
661-
// {
662-
// description: 'Header row with one row of data',
663-
// text: 'A,B,C\r\na,b,c',
664-
// config: { header: true },
665-
// expected: {
666-
// data: [{ A: 'a', B: 'b', C: 'c' }],
667-
// errors: [],
668-
// },
669-
// },
670-
// {
671-
// description: 'Header row only',
672-
// text: 'A,B,C',
673-
// config: { header: true },
674-
// expected: {
675-
// data: [],
676-
// errors: [],
677-
// },
678-
// },
679-
// {
680-
// description: 'Row with too few fields',
681-
// text: 'A,B,C\r\na,b',
682-
// config: { header: true },
683-
// expected: {
684-
// data: [{ A: 'a', B: 'b' }],
685-
// errors: [{
686-
// type: 'FieldMismatch',
687-
// code: 'TooFewFields',
688-
// message: 'Too few fields: expected 3 fields but parsed 2',
689-
// }],
690-
// },
691-
// },
692-
// {
693-
// description: 'Row with too many fields',
694-
// text: 'A,B,C\r\na,b,c,d,e\r\nf,g,h',
695-
// config: { header: true },
696-
// expected: {
697-
// data: [{ A: 'a', B: 'b', C: 'c', __parsed_extra: ['d', 'e'] }, { A: 'f', B: 'g', C: 'h' }],
698-
// errors: [{
699-
// type: 'FieldMismatch',
700-
// code: 'TooManyFields',
701-
// message: 'Too many fields: expected 3 fields but parsed 5',
702-
// }],
703-
// },
704-
// },
705614
{
706615
description: 'Row with enough fields but blank field in the begining',
707616
text: 'A,B,C\r\n,b1,c1\r\na2,b2,c2',
@@ -710,41 +619,6 @@ export const PARSE_TESTS = [
710619
errors: [],
711620
},
712621
},
713-
// TODO(SL): implement header: true?
714-
// {
715-
// description: 'Row with enough fields but blank field in the begining using headers',
716-
// text: 'A,B,C\r\n,b1,c1\r\n,b2,c2',
717-
// config: { header: true },
718-
// expected: {
719-
// data: [{ A: '', B: 'b1', C: 'c1' }, { A: '', B: 'b2', C: 'c2' }],
720-
// errors: [],
721-
// },
722-
// },
723-
// {
724-
// description: 'Row with enough fields but blank field at end',
725-
// text: 'A,B,C\r\na,b,',
726-
// config: { header: true },
727-
// expected: {
728-
// data: [{ A: 'a', B: 'b', C: '' }],
729-
// errors: [],
730-
// },
731-
// },
732-
// {
733-
// description: 'Line ends with quoted field, first field of next line is empty using headers',
734-
// text: 'a,b,"c"\r\nd,e,"f"\r\n,"h","i"\r\n,"k","l"',
735-
// config: {
736-
// header: true,
737-
// newline: '\r\n',
738-
// },
739-
// expected: {
740-
// data: [
741-
// { a: 'd', b: 'e', c: 'f' },
742-
// { a: '', b: 'h', c: 'i' },
743-
// { a: '', b: 'k', c: 'l' },
744-
// ],
745-
// errors: [],
746-
// },
747-
// },
748622
{
749623
description: 'Tab delimiter',
750624
text: 'a\tb\tc\r\nd\te\tf',
@@ -1018,17 +892,6 @@ export const PARSE_TESTS = [
1018892
errors: [],
1019893
},
1020894
},
1021-
// TODO(SL): implement header: true?
1022-
// {
1023-
// description: 'Header row with preceding comment',
1024-
// notes: 'Must parse correctly headers if they are preceded by comments',
1025-
// text: '#Comment\na,b\nc,d\n',
1026-
// config: { header: true, comments: '#', skipEmptyLines: true, delimiter: ',' },
1027-
// expected: {
1028-
// data: [{ a: 'c', b: 'd' }],
1029-
// errors: [],
1030-
// },
1031-
// },
1032895
{
1033896
description: 'Carriage return in header inside quotes, with line feed endings',
1034897
text: '"a\r\na","b"\n"c","d"\n"e","f"\n"g","h"\n"i","j"',
@@ -1168,16 +1031,6 @@ export const PARSE_TESTS = [
11681031
errors: [],
11691032
},
11701033
},
1171-
// TODO(SL): implement header: true?
1172-
// {
1173-
// description: 'UTF-8 BOM encoded text with header produces column key stripped from invisible BOM character',
1174-
// text: '\ufeffA,B\nX,Y',
1175-
// config: { header: true },
1176-
// expected: {
1177-
// data: [{ A: 'X', B: 'Y' }],
1178-
// errors: [],
1179-
// },
1180-
// },
11811034
{
11821035
description: 'Quoted fields with spaces between closing quote and next delimiter and contains delimiter',
11831036
text: 'A,",B" ,C,D\nE,F,G,H',

tests/fetch.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ describe('fetchRange', () => {
4343
// returns 416 Requested Range Not Satisfiable (or some servers like Apache return 200 OK).
4444
// see https://github.com/golang/go/issues/47021#issuecomment-874513977 and
4545
// https://github.com/pallets/werkzeug/issues/1937 for examples.
46-
// TODO(SL): support empty files?
4746
it.for([200, 416, 500])('throws an error for non-206 response: %s', async (status) => {
4847
const mockResponse = {
4948
status,

0 commit comments

Comments
 (0)