fix(persistence,llc,core,ui): deprecated sort, add channelStateSort s… (#1366)
* fix(persistence,llc,core,ui): deprecated sort, add channelStateSort sorting the channels offline using the state * update changelogs * update tests * remove deprecated test * change threashold * minor fixes * remove tests * fix(persistence): minor changes. Signed-off-by: xsahil03x <[email protected]> Signed-off-by: xsahil03x <[email protected]> Co-authored-by: Sahil Kumar <[email protected]>
This commit is contained in:
co-authored by
Sahil Kumar
parent
5784c53e6b
commit
d09d3817b5
@@ -137,27 +137,6 @@ void main() {
|
||||
}
|
||||
});
|
||||
|
||||
test(
|
||||
'should return all the inserted channels along with pagination applied',
|
||||
() async {
|
||||
const offset = 5;
|
||||
const limit = 15;
|
||||
const pagination = PaginationParams(offset: offset, limit: limit);
|
||||
|
||||
// Inserting test data for get channels
|
||||
await _insertTestDataForGetChannel(filter, count: 30);
|
||||
|
||||
// Should match with the inserted channels
|
||||
final updatedChannels = await channelQueryDao.getChannels(
|
||||
filter: filter,
|
||||
paginationParams: pagination,
|
||||
);
|
||||
expect(updatedChannels.length, limit);
|
||||
expect(updatedChannels.first.id, 'testId24');
|
||||
expect(updatedChannels.first.cid, 'testCid24');
|
||||
},
|
||||
);
|
||||
|
||||
test('should return sorted channels using member count', () async {
|
||||
int sortComparator(ChannelModel a, ChannelModel b) =>
|
||||
b.memberCount.compareTo(a.memberCount);
|
||||
@@ -169,6 +148,7 @@ void main() {
|
||||
// Should match with the inserted channels
|
||||
final updatedChannels = await channelQueryDao.getChannels(
|
||||
filter: filter,
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
sort: [
|
||||
SortOption(
|
||||
'member_count',
|
||||
@@ -202,15 +182,6 @@ void main() {
|
||||
}
|
||||
});
|
||||
|
||||
test('should throw if comparator is not provided in sort list', () {
|
||||
expect(
|
||||
() => channelQueryDao.getChannels(
|
||||
sort: [const SortOption('test_custom_field')],
|
||||
),
|
||||
throwsArgumentError,
|
||||
);
|
||||
});
|
||||
|
||||
test('should return sorted channels using custom field', () async {
|
||||
int sortComparator(ChannelModel a, ChannelModel b) {
|
||||
final aData = int.parse(a.extraData['test_custom_field'].toString());
|
||||
@@ -225,6 +196,7 @@ void main() {
|
||||
// Should match with the inserted channels
|
||||
final updatedChannels = await channelQueryDao.getChannels(
|
||||
filter: filter,
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
sort: [SortOption('test_custom_field', comparator: sortComparator)],
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user