feat: Converted to ios models

This commit is contained in:
Deven Joshi
2021-04-13 18:20:43 +05:30
parent 391eb8c1ce
commit fe07b8dbb0
36 changed files with 406 additions and 344 deletions
@@ -1330,10 +1330,10 @@ void main() {
members: [],
messages:
(j['messages'] as List).map((m) => Message.fromJson(m)).toList(),
read: null,
read: [],
watcherCount: 5,
pinnedMessages: [],
watchers: null,
watchers: [],
);
expect(
@@ -25,7 +25,7 @@ void main() {
});
test('should serialize to json correctly', () {
final channel = ChannelModel(
final channel = ChannelModel.temp(
type: 'type',
id: 'id',
cid: 'a:a',
@@ -39,7 +39,7 @@ void main() {
});
test('should serialize to json correctly when frozen is provided', () {
final channel = ChannelModel(
final channel = ChannelModel.temp(
type: 'type',
id: 'id',
cid: 'a:a',
@@ -51,12 +51,12 @@ void main() {
test('should serialize to json correctly', () {
final event = Event(
user: User(id: 'id'),
user: User.temp(id: 'id'),
type: 'type',
cid: 'cid',
connectionId: 'connectionId',
createdAt: DateTime.parse('2020-01-29T03:22:47.63613Z'),
me: OwnUser(id: 'id2'),
me: OwnUser.temp(id: 'id2'),
totalUnreadCount: 1,
unreadChannels: 1,
online: true,
@@ -97,7 +97,7 @@ void main() {
});
test('should serialize to json correctly', () {
final message = Message(
final message = Message.temp(
id: '4637f7e4-a06b-42db-ba5a-8d8270dd926f',
text:
'https://giphy.com/gifs/the-lion-king-live-action-5zvN79uTGfLMOVfQaA',
@@ -33,8 +33,8 @@ void main() {
expect(reaction.createdAt, DateTime.parse('2020-01-28T22:17:31.108742Z'));
expect(reaction.type, 'wow');
expect(
reaction.user?.toJson(),
User.init('2de0297c-f3f2-489d-b930-ef77342edccf', extraData: {
reaction.user.toJson(),
User.temp(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.init('2de0297c-f3f2-489d-b930-ef77342edccf', extraData: {
user: User.temp(id:'2de0297c-f3f2-489d-b930-ef77342edccf', extraData: {
'image': 'https://randomuser.me/api/portraits/women/45.jpg',
'name': 'Daisy Morgan'
}),
@@ -26,7 +26,7 @@ void main() {
test('should serialize to json correctly', () {
final read = Read(
lastRead: DateTime.parse('2020-01-28T22:17:30.966485504Z'),
user: User.init('bbb19d9a-ee50-45bc-84e5-0584e79d0c9e'),
user: User.temp(id: 'bbb19d9a-ee50-45bc-84e5-0584e79d0c9e'),
unreadMessages: 10,
);
@@ -17,7 +17,7 @@ void main() {
});
test('should serialize to json correctly', () {
final user = User(
final user = User.temp(
id: 'bbb19d9a-ee50-45bc-84e5-0584e79d0c9e',
role: 'abc',
);