From 483d5a9d103ff60a3df10ba342db7636b8086ddd Mon Sep 17 00:00:00 2001 From: Plague Fox Date: Thu, 18 Jul 2024 03:30:18 +0400 Subject: [PATCH] refactor: Ignore coverage for invalid connection expires and ping interval assertions --- lib/src/protobuf/protobuf_codec.dart | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/src/protobuf/protobuf_codec.dart b/lib/src/protobuf/protobuf_codec.dart index fd400b3..d76cde1 100644 --- a/lib/src/protobuf/protobuf_codec.dart +++ b/lib/src/protobuf/protobuf_codec.dart @@ -274,13 +274,13 @@ final class ProtobufReplyDecoder extends Converter { } else { expBool = false; ttlDT = null; - assert(false, 'Connection expires is invalid'); + assert(false, 'Connection expires is invalid'); // coverage:ignore-line } Duration? pingInterval; if (ping > 0) { pingInterval = Duration(seconds: ping); } else { - assert(false, 'Ping interval is invalid'); + assert(false, 'Ping interval is invalid'); // coverage:ignore-line } event = SpinifyConnect( channel: channel, @@ -321,7 +321,7 @@ final class ProtobufReplyDecoder extends Converter { } else { expBool = false; ttlDT = null; - assert(false, 'Connection refresh is invalid'); + assert(false, 'Connection refresh is invalid'); // coverage:ignore-line } event = SpinifyRefresh( timestamp: DateTime.now(), @@ -330,7 +330,7 @@ final class ProtobufReplyDecoder extends Converter { ttl: ttlDT, ); } else { - throw UnimplementedError('Unsupported push type'); + throw UnimplementedError('Unsupported push type'); // coverage:ignore-line } return SpinifyPush( timestamp: now, @@ -378,7 +378,7 @@ final class ProtobufReplyDecoder extends Converter { } else { expBool = false; ttlDT = null; - assert(false, 'Connection expires is invalid'); + assert(false, 'Connection expires is invalid'); // coverage:ignore-line } return SpinifySubscribeResult( id: id, @@ -425,13 +425,13 @@ final class ProtobufReplyDecoder extends Converter { } else { expBool = false; ttlDT = null; - assert(false, 'Connection expires is invalid'); + assert(false, 'Connection expires is invalid'); // coverage:ignore-line } Duration? pingInterval; if (ping > 0) { pingInterval = Duration(seconds: ping); } else { - assert(false, 'Ping interval is invalid'); + assert(false, 'Ping interval is invalid'); // coverage:ignore-line } return SpinifyConnectResult( id: id, @@ -527,7 +527,7 @@ final class ProtobufReplyDecoder extends Converter { } else { expBool = false; ttlDT = null; - assert(false, 'Connection refresh is invalid'); + assert(false, 'Connection refresh is invalid'); // coverage:ignore-line } return SpinifyRefreshResult( id: id, @@ -551,7 +551,7 @@ final class ProtobufReplyDecoder extends Converter { } else { expBool = false; ttlDT = null; - assert(false, 'Connection refresh is invalid'); + assert(false, 'Connection refresh is invalid'); // coverage:ignore-line } return SpinifySubRefreshResult( id: id, @@ -569,7 +569,9 @@ final class ProtobufReplyDecoder extends Converter { temporary: error.temporary, ); } else { + // coverage:ignore-start throw UnimplementedError('Unsupported reply type'); + // coverage:ignore-end } } }