-
-
Couldn't load subscription status.
- Fork 1.5k
Fix: Resolve ListParam equality issue for caching identical requests #2366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
a553089
3e44fcb
a1ad23f
820b0bf
f01072d
82e2f03
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import 'package:dio/dio.dart'; | ||
| import 'package:test/test.dart'; | ||
|
|
||
| void main() { | ||
| test('ListParam equality for Map key', () { | ||
AlexV525 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| final param1 = const ListParam(['item1', 'item2'], ListFormat.csv); | ||
| final param2 = const ListParam(['item1', 'item2'], ListFormat.csv); | ||
AlexV525 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| final param3 = const ListParam(['item3', 'item4'], ListFormat.csv); | ||
| final param4 = const ListParam(['item2', 'item1'], ListFormat.csv); | ||
|
|
||
| final cache = {param1: 'Cached Response'}; | ||
|
||
|
|
||
| expect( | ||
| cache.containsKey(param2), | ||
| true, | ||
| reason: 'param1 and param2 should be considered equal', | ||
| ); | ||
|
|
||
| expect( | ||
| cache.containsKey(param3), | ||
| false, | ||
| reason: 'param1 and param3 should not be considered equal', | ||
| ); | ||
|
|
||
| expect( | ||
| cache.containsKey(param4), | ||
| false, | ||
| reason: | ||
| 'param1 and param4 should not be considered equal as order matters', | ||
| ); | ||
| }); | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.