fix(llc, ui): message search pagination
Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
@@ -86,6 +86,24 @@ void main() {
|
||||
},
|
||||
);
|
||||
|
||||
test(
|
||||
'should throw if `pagination.offset` and `sort` both are provided',
|
||||
() async {
|
||||
final filter = Filter.in_('cid', const ['test-cid-1', 'test-cid-2']);
|
||||
const sort = [SortOption<ChannelModel>('test-field')];
|
||||
const pagination = PaginationParams(offset: 10);
|
||||
try {
|
||||
await generalApi.searchMessages(
|
||||
filter,
|
||||
sort: sort,
|
||||
pagination: pagination,
|
||||
);
|
||||
} catch (e) {
|
||||
expect(e, isA<AssertionError>());
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
test('should run successfully with `query`', () async {
|
||||
final filter = Filter.in_('cid', const ['test-cid-1', 'test-cid-2']);
|
||||
const query = 'test-query';
|
||||
|
||||
@@ -9,11 +9,23 @@ void main() {
|
||||
expect(j, {'field': 'name', 'direction': -1});
|
||||
});
|
||||
|
||||
test('PaginationParams', () {
|
||||
const option = PaginationParams();
|
||||
final j = option.toJson();
|
||||
expect(j, containsPair('limit', 10));
|
||||
expect(j, containsPair('offset', 0));
|
||||
group('PaginationParams', () {
|
||||
test('default', () {
|
||||
const option = PaginationParams();
|
||||
final j = option.toJson();
|
||||
expect(j, containsPair('limit', 10));
|
||||
});
|
||||
|
||||
test(
|
||||
'should throw if non-zero `offset` and `next` both are provided',
|
||||
() {
|
||||
try {
|
||||
PaginationParams(offset: 10, next: 'next-message-id');
|
||||
} catch (e) {
|
||||
expect(e, isA<AssertionError>());
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user