test(llc): add test for mute model

Signed-off-by: xsahil03x <xdsahil@gmail.com>
This commit is contained in:
Sahil Kumar
2022-04-01 14:10:04 +05:30
committed by xsahil03x
parent 8758dc862c
commit d938a0759d
3 changed files with 51 additions and 1 deletions
+32
View File
@@ -0,0 +1,32 @@
{
"user": {
"id": "super-band-9",
"role": "user",
"created_at": "2020-03-03T16:48:28.853674Z",
"updated_at": "2021-05-26T03:22:20.296181Z",
"last_active": "2021-06-16T11:42:29.466165498Z",
"banned": false,
"online": true,
"username": "Rioland",
"image": "https://placehold.jp/150x150.png",
"invisible": false,
"name": "Proud darkness",
"unread_count": 0
},
"target": {
"id": "super-band-10",
"role": "user",
"created_at": "2020-03-03T16:48:28.853674Z",
"updated_at": "2021-05-26T03:22:20.296181Z",
"last_active": "2021-06-16T11:42:29.466165498Z",
"banned": false,
"online": true,
"username": "Holland",
"image": "https://placehold.jp/150x150.png",
"invisible": false,
"name": "Proud brightness",
"unread_count": 0
},
"created_at": "2020-12-04T10:39:06.512021Z",
"updated_at": "2020-12-04T10:39:06.512021Z"
}
@@ -9,9 +9,10 @@ void main() {
group('src/models/channel_mute', () {
test('should parse json correctly', () {
final mute = ChannelMute.fromJson(jsonFixture('channel_mute.json'));
expect(mute.channel, isA<ChannelModel>());
expect(mute.user, isA<User>());
expect(mute.channel, isA<ChannelModel>());
expect(mute.createdAt, DateTime.parse('2020-12-04T10:39:06.512021Z'));
expect(mute.updatedAt, DateTime.parse('2020-12-04T10:39:06.512021Z'));
});
});
}
@@ -0,0 +1,17 @@
import 'package:stream_chat/src/core/models/mute.dart';
import 'package:stream_chat/src/core/models/user.dart';
import 'package:test/test.dart';
import '../../utils.dart';
void main() {
group('src/models/channel_mute', () {
test('should parse json correctly', () {
final mute = Mute.fromJson(jsonFixture('mute.json'));
expect(mute.user, isA<User>());
expect(mute.target, isA<User>());
expect(mute.createdAt, DateTime.parse('2020-12-04T10:39:06.512021Z'));
expect(mute.updatedAt, DateTime.parse('2020-12-04T10:39:06.512021Z'));
});
});
}