test(persistence): add extra checks in getMessagesByCid along with pagination test in message, pinned message dao.

Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
Sahil Kumar
2021-03-19 17:38:07 +05:30
parent ab9990e5bd
commit 2e3baa020d
2 changed files with 18 additions and 8 deletions
@@ -284,10 +284,13 @@ void main() {
test('getMessagesByCid along with pagination', () async { test('getMessagesByCid along with pagination', () async {
const cid = 'testCid'; const cid = 'testCid';
const limit = 15;
const lessThan = 'testMessageId${cid}25';
const greaterThanOrEqual = 'testMessageId${cid}5';
const pagination = PaginationParams( const pagination = PaginationParams(
limit: 15, limit: limit,
lessThan: 'testMessageId${cid}25', lessThan: lessThan,
greaterThanOrEqual: 'testMessageId${cid}5', greaterThanOrEqual: greaterThanOrEqual,
); );
// Should be empty initially // Should be empty initially
@@ -306,7 +309,9 @@ void main() {
cid, cid,
messagePagination: pagination, messagePagination: pagination,
); );
expect(fetchedMessages.length, 15); expect(fetchedMessages.length, limit);
expect(fetchedMessages.first.id, greaterThanOrEqual);
expect(fetchedMessages.last.id != lessThan, true);
}); });
test('updateMessages', () async { test('updateMessages', () async {
@@ -285,10 +285,13 @@ void main() {
test('getMessagesByCid along with pagination', () async { test('getMessagesByCid along with pagination', () async {
const cid = 'testCid'; const cid = 'testCid';
const limit = 15;
const lessThan = 'testMessageId${cid}25';
const greaterThanOrEqual = 'testMessageId${cid}5';
const pagination = PaginationParams( const pagination = PaginationParams(
limit: 15, limit: limit,
lessThan: 'testMessageId${cid}25', lessThan: lessThan,
greaterThanOrEqual: 'testMessageId${cid}5', greaterThanOrEqual: greaterThanOrEqual,
); );
// Should be empty initially // Should be empty initially
@@ -307,7 +310,9 @@ void main() {
cid, cid,
messagePagination: pagination, messagePagination: pagination,
); );
expect(fetchedMessages.length, 15); expect(fetchedMessages.length, limit);
expect(fetchedMessages.first.id, greaterThanOrEqual);
expect(fetchedMessages.last.id != lessThan, true);
}); });
test('updateMessages', () async { test('updateMessages', () async {