added null safety for llc

This commit is contained in:
Deven Joshi
2021-04-08 15:03:16 +05:30
parent 3a5308a9c0
commit c80fc0a6b4
41 changed files with 1222 additions and 1202 deletions
@@ -49,7 +49,7 @@ void main() {
'https://media0.giphy.com/media/3o7TKnCdBx5cMg0qti/giphy.gif',
);
expect(attachment.actions, hasLength(3));
expect(attachment.actions[0], isA<Action>());
expect(attachment.actions![0], isA<Action>());
});
test('should serialize to json correctly', () {
@@ -10,7 +10,8 @@ import 'package:stream_chat/stream_chat.dart';
void main() {
group('src/models/channel_state', () {
const jsonExample = '''{
const jsonExample = '''
{
"channel": {
"id": "dev",
"type": "team",
@@ -844,36 +845,36 @@ void main() {
test('should parse json correctly', () {
final channelState = ChannelState.fromJson(json.decode(jsonExample));
expect(channelState.channel.cid, 'team:dev');
expect(channelState.channel.id, 'dev');
expect(channelState.channel.team, 'test');
expect(channelState.channel.type, 'team');
expect(channelState.channel.config, isA<ChannelConfig>());
expect(channelState.channel.config, isNotNull);
expect(channelState.channel.config.commands, hasLength(1));
expect(channelState.channel.config.commands[0], isA<Command>());
expect(channelState.channel.lastMessageAt,
expect(channelState.channel?.cid, 'team:dev');
expect(channelState.channel?.id, 'dev');
expect(channelState.channel?.team, 'test');
expect(channelState.channel?.type, 'team');
expect(channelState.channel?.config, isA<ChannelConfig>());
expect(channelState.channel?.config, isNotNull);
expect(channelState.channel?.config?.commands, hasLength(1));
expect(channelState.channel?.config?.commands![0], isA<Command>());
expect(channelState.channel?.lastMessageAt,
DateTime.parse('2020-01-30T13:43:41.062362Z'));
expect(channelState.channel.createdAt,
expect(channelState.channel?.createdAt,
DateTime.parse('2019-04-03T18:43:33.213373Z'));
expect(channelState.channel.updatedAt,
expect(channelState.channel?.updatedAt,
DateTime.parse('2019-04-03T18:43:33.213374Z'));
expect(channelState.channel.createdBy, isA<User>());
expect(channelState.channel.frozen, true);
expect(channelState.channel.extraData['example'], 1);
expect(channelState.channel.extraData['name'], '#dev');
expect(channelState.channel?.createdBy, isA<User>());
expect(channelState.channel?.frozen, true);
expect(channelState.channel?.extraData!['example'], 1);
expect(channelState.channel?.extraData!['name'], '#dev');
expect(
channelState.channel.extraData['image'],
channelState.channel?.extraData!['image'],
'https://cdn.chrisshort.net/testing-certificate-chains-in-go/GOPHER_MIC_DROP.png',
);
expect(channelState.messages, hasLength(25));
expect(channelState.messages[0], isA<Message>());
expect(channelState.messages[0], isNotNull);
expect(channelState.messages![0], isA<Message>());
expect(channelState.messages![0], isNotNull);
expect(
channelState.messages[0].createdAt,
channelState.messages![0].createdAt,
DateTime.parse('2020-01-29T03:23:02.843948Z'),
);
expect(channelState.messages[0].user, isA<User>());
expect(channelState.messages![0].user, isA<User>());
expect(channelState.watcherCount, 5);
});
@@ -20,8 +20,8 @@ void main() {
expect(channel.id, equals('test'));
expect(channel.type, equals('livestream'));
expect(channel.cid, equals('test:livestream'));
expect(channel.extraData['cats'], equals(true));
expect(channel.extraData['fruit'], equals(['bananas', 'apples']));
expect(channel.extraData!['cats'], equals(true));
expect(channel.extraData!['fruit'], equals(['bananas', 'apples']));
});
test('should serialize to json correctly', () {
@@ -33,7 +33,7 @@ void main() {
expect(reaction.createdAt, DateTime.parse('2020-01-28T22:17:31.108742Z'));
expect(reaction.type, 'wow');
expect(
reaction.user.toJson(),
reaction.user?.toJson(),
User.init('2de0297c-f3f2-489d-b930-ef77342edccf', extraData: {
'image': 'https://randomuser.me/api/portraits/women/45.jpg',
'name': 'Daisy Morgan'
@@ -19,7 +19,7 @@ void main() {
test('should parse json correctly', () {
final read = Read.fromJson(json.decode(jsonExample));
expect(read.lastRead, DateTime.parse('2020-01-28T22:17:30.966485504Z'));
expect(read.user.id, 'bbb19d9a-ee50-45bc-84e5-0584e79d0c9e');
expect(read.user?.id, 'bbb19d9a-ee50-45bc-84e5-0584e79d0c9e');
expect(read.unreadMessages, 10);
});