Skip to content
Permalink
Browse files

Added the tests of the `Sort` class

  • Loading branch information...
cedx committed Jun 12, 2019
1 parent 397d96b commit 191ec1ef3dc5ce6c87db699953cf3efbc77b9555
Showing with 15 additions and 2 deletions.
  1. +15 −2 test/models/sort_test.dart
@@ -5,11 +5,24 @@ import 'package:test/test.dart';
void main() => group('Pagination', () {
group('.toQueryParameters()', () {
test('should return a comma-separated list of the attributes', () {
// TODO not implemented!!!
final attributes = {
'age': SortDirection.ascending,
'name': SortDirection.descending
};

final params = Sort(attributes).toQueryParameters();
expect(params['sort'], 'age,-name');
});

test('should support custom query parameters', () {
// TODO not implemented!!!
final attributes = {
'age': SortDirection.ascending,
'name': SortDirection.descending
};

final params = Sort(attributes, separator: ':', sortParam: 'orderBy').toQueryParameters();
expect(params['sort'], isNull);
expect(params['orderBy'], 'age:-name');
});
});
});

0 comments on commit 191ec1e

Please sign in to comment.
You can’t perform that action at this time.