added tests

This commit is contained in:
Deven Joshi
2021-08-19 17:50:37 +05:30
parent c716f8803e
commit ddf33a1989
@@ -1860,15 +1860,17 @@ void main() {
}); });
test('`.enableSlowMode`', () async { test('`.enableSlowMode`', () async {
const cooldown = 10;
final channelModel = ChannelModel( final channelModel = ChannelModel(
cid: channelCid, cid: channelCid,
cooldown: 10, cooldown: cooldown,
); );
when(() => client.enableSlowdown( when(() => client.enableSlowdown(
channelCid, channelId,
channelType, channelType,
10, cooldown,
)).thenAnswer((_) async => PartialUpdateChannelResponse() )).thenAnswer((_) async => PartialUpdateChannelResponse()
..channel = channelModel); ..channel = channelModel);
@@ -1877,32 +1879,28 @@ void main() {
expect(res, isNotNull); expect(res, isNotNull);
verify(() => client.enableSlowdown( verify(() => client.enableSlowdown(
channelCid, channelId,
channelType, channelType,
any(), cooldown,
)).called(1); )).called(1);
}); });
test('`.disableSlowMode`', () async { test('`.disableSlowMode`', () async {
final channelModel = ChannelModel( final channelModel = ChannelModel(
cid: channelCid, cid: channelCid,
cooldown: 0,
); );
when(() => client.disableSlowdown( when(() => client.disableSlowdown(
channelCid, channelId,
channelType, channelType,
)).thenAnswer((_) async => PartialUpdateChannelResponse() )).thenAnswer((_) async => PartialUpdateChannelResponse()
..channel = channelModel); ..channel = channelModel);
final res = await channel.disableSlowMode(); final res = await channel.disableSlowMode();
expect(res, isNotNull); expect(res, isNotNull);
verify(() => client.disableSlowdown( verify(() => client.disableSlowdown(channelId, channelType)).called(1);
channelCid,
channelType,
)).called(1);
}); });
test('`.banUser`', () async { test('`.banUser`', () async {