Skip to content

Commit

Permalink
✅ add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
techouse committed Nov 23, 2024
1 parent 9f60761 commit 23ca2fc
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/unit/decode_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1864,5 +1864,37 @@ void main() {
}),
);
});

test('handles list limit of zero correctly', () {
expect(
QS.decode(
'a[]=1&a[]=2',
const DecodeOptions(listLimit: 0),
),
equals({
'a': ['1', '2']
}),
);
});

test('handles negative list limit correctly', () {
expect(
() => QS.decode(
'a[]=1&a[]=2',
const DecodeOptions(listLimit: -1, throwOnLimitExceeded: true),
),
throwsA(isA<RangeError>()),
);
});

test('applies list limit to nested lists', () {
expect(
() => QS.decode(
'a[0][]=1&a[0][]=2&a[0][]=3&a[0][]=4',
const DecodeOptions(listLimit: 3, throwOnLimitExceeded: true),
),
throwsA(isA<RangeError>()),
);
});
});
}

0 comments on commit 23ca2fc

Please sign in to comment.