feat: Converted to ios models part II
This commit is contained in:
@@ -851,8 +851,8 @@ void main() {
|
||||
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?.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,
|
||||
@@ -868,13 +868,13 @@ void main() {
|
||||
'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);
|
||||
});
|
||||
|
||||
@@ -889,8 +889,8 @@ void main() {
|
||||
"image": "https://cdn.chrisshort.net/testing-certificate-chains-in-go/GOPHER_MIC_DROP.png",
|
||||
"example": 1
|
||||
},
|
||||
"watchers": null,
|
||||
"read": null,
|
||||
"watchers": [],
|
||||
"read": [],
|
||||
"messages": [
|
||||
{
|
||||
"id": "dry-meadow-0-2b73cc8b-cd86-4a01-8d40-bd82ad07a030",
|
||||
|
||||
@@ -25,7 +25,7 @@ void main() {
|
||||
});
|
||||
|
||||
test('should serialize to json correctly', () {
|
||||
final channel = ChannelModel.temp(
|
||||
final channel = ChannelModel(
|
||||
type: 'type',
|
||||
id: 'id',
|
||||
cid: 'a:a',
|
||||
@@ -34,12 +34,12 @@ void main() {
|
||||
|
||||
expect(
|
||||
channel.toJson(),
|
||||
{'id': 'id', 'type': 'type', 'name': 'cool'},
|
||||
{'id': 'id', 'type': 'type', 'frozen': false, 'name': 'cool'},
|
||||
);
|
||||
});
|
||||
|
||||
test('should serialize to json correctly when frozen is provided', () {
|
||||
final channel = ChannelModel.temp(
|
||||
final channel = ChannelModel(
|
||||
type: 'type',
|
||||
id: 'id',
|
||||
cid: 'a:a',
|
||||
|
||||
@@ -51,12 +51,12 @@ void main() {
|
||||
|
||||
test('should serialize to json correctly', () {
|
||||
final event = Event(
|
||||
user: User.temp(id: 'id'),
|
||||
user: User(id: 'id'),
|
||||
type: 'type',
|
||||
cid: 'cid',
|
||||
connectionId: 'connectionId',
|
||||
createdAt: DateTime.parse('2020-01-29T03:22:47.63613Z'),
|
||||
me: OwnUser.temp(id: 'id2'),
|
||||
me: OwnUser(id: 'id2'),
|
||||
totalUnreadCount: 1,
|
||||
unreadChannels: 1,
|
||||
online: true,
|
||||
|
||||
@@ -97,7 +97,7 @@ void main() {
|
||||
});
|
||||
|
||||
test('should serialize to json correctly', () {
|
||||
final message = Message.temp(
|
||||
final message = Message(
|
||||
id: '4637f7e4-a06b-42db-ba5a-8d8270dd926f',
|
||||
text:
|
||||
'https://giphy.com/gifs/the-lion-king-live-action-5zvN79uTGfLMOVfQaA',
|
||||
|
||||
@@ -34,7 +34,7 @@ void main() {
|
||||
expect(reaction.type, 'wow');
|
||||
expect(
|
||||
reaction.user.toJson(),
|
||||
User.temp(id: '2de0297c-f3f2-489d-b930-ef77342edccf', extraData: {
|
||||
User(id: '2de0297c-f3f2-489d-b930-ef77342edccf', extraData: {
|
||||
'image': 'https://randomuser.me/api/portraits/women/45.jpg',
|
||||
'name': 'Daisy Morgan'
|
||||
}).toJson(),
|
||||
@@ -49,7 +49,7 @@ void main() {
|
||||
messageId: '76cd8c82-b557-4e48-9d12-87995d3a0e04',
|
||||
createdAt: DateTime.parse('2020-01-28T22:17:31.108742Z'),
|
||||
type: 'wow',
|
||||
user: User.temp(id: '2de0297c-f3f2-489d-b930-ef77342edccf', extraData: {
|
||||
user: User(id: '2de0297c-f3f2-489d-b930-ef77342edccf', extraData: {
|
||||
'image': 'https://randomuser.me/api/portraits/women/45.jpg',
|
||||
'name': 'Daisy Morgan'
|
||||
}),
|
||||
|
||||
@@ -19,14 +19,14 @@ 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);
|
||||
});
|
||||
|
||||
test('should serialize to json correctly', () {
|
||||
final read = Read(
|
||||
lastRead: DateTime.parse('2020-01-28T22:17:30.966485504Z'),
|
||||
user: User.temp(id: 'bbb19d9a-ee50-45bc-84e5-0584e79d0c9e'),
|
||||
user: User(id: 'bbb19d9a-ee50-45bc-84e5-0584e79d0c9e'),
|
||||
unreadMessages: 10,
|
||||
);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ void main() {
|
||||
});
|
||||
|
||||
test('should serialize to json correctly', () {
|
||||
final user = User.temp(
|
||||
final user = User(
|
||||
id: 'bbb19d9a-ee50-45bc-84e5-0584e79d0c9e',
|
||||
role: 'abc',
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user