feat(persistence): save channel.ownCapabilities in db

Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
Sahil Kumar
2022-06-09 14:10:01 +05:30
committed by xsahil03x
parent c40580c3a7
commit c6eb075cee
5 changed files with 83 additions and 15 deletions
@@ -14,6 +14,7 @@ void main() {
id: 'testId',
type: 'testType',
cid: 'testCid',
ownCapabilities: ['testCapability'],
config: {'max_message_length': 33},
frozen: math.Random().nextBool(),
lastMessageAt: DateTime.now(),
@@ -29,6 +30,7 @@ void main() {
final channelModel = entity.toChannelModel(createdBy: user);
expect(channelModel, isA<ChannelModel>());
expect(channelModel.id, entity.id);
expect(channelModel.ownCapabilities, entity.ownCapabilities);
expect(channelModel.config.toJson()['max_message_length'], 33);
expect(channelModel.frozen, entity.frozen);
expect(channelModel.createdAt, isSameDateAs(entity.createdAt));
@@ -68,6 +70,7 @@ void main() {
final channelModel = channelState.channel!;
expect(channelModel.id, entity.id);
expect(channelModel.ownCapabilities, entity.ownCapabilities);
expect(channelModel.config.toJson()['max_message_length'], 33);
expect(channelModel.frozen, entity.frozen);
expect(channelModel.createdAt, isSameDateAs(entity.createdAt));
@@ -87,6 +90,7 @@ void main() {
id: 'testId',
type: 'testType',
cid: 'testCid',
ownCapabilities: ['testCapability'],
config: ChannelConfig(maxMessageLength: 33),
frozen: math.Random().nextBool(),
lastMessageAt: DateTime.now(),
@@ -101,6 +105,7 @@ void main() {
final channelEntity = model.toEntity();
expect(channelEntity, isA<ChannelEntity>());
expect(channelEntity.id, model.id);
expect(channelEntity.ownCapabilities, model.ownCapabilities);
expect(
channelEntity.config['max_message_length'],
model.config.maxMessageLength,