Skip to content

Commit

Permalink
refactor: Ignore coverage for invalid connection expires and ping int…
Browse files Browse the repository at this point in the history
…erval assertions
  • Loading branch information
PlugFox committed Jul 17, 2024
1 parent 3a9fd8c commit 483d5a9
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions lib/src/protobuf/protobuf_codec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,13 @@ final class ProtobufReplyDecoder extends Converter<pb.Reply, SpinifyReply> {
} 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,
Expand Down Expand Up @@ -321,7 +321,7 @@ final class ProtobufReplyDecoder extends Converter<pb.Reply, SpinifyReply> {
} 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(),
Expand All @@ -330,7 +330,7 @@ final class ProtobufReplyDecoder extends Converter<pb.Reply, SpinifyReply> {
ttl: ttlDT,
);
} else {
throw UnimplementedError('Unsupported push type');
throw UnimplementedError('Unsupported push type'); // coverage:ignore-line
}
return SpinifyPush(
timestamp: now,
Expand Down Expand Up @@ -378,7 +378,7 @@ final class ProtobufReplyDecoder extends Converter<pb.Reply, SpinifyReply> {
} else {
expBool = false;
ttlDT = null;
assert(false, 'Connection expires is invalid');
assert(false, 'Connection expires is invalid'); // coverage:ignore-line
}
return SpinifySubscribeResult(
id: id,
Expand Down Expand Up @@ -425,13 +425,13 @@ final class ProtobufReplyDecoder extends Converter<pb.Reply, SpinifyReply> {
} 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,
Expand Down Expand Up @@ -527,7 +527,7 @@ final class ProtobufReplyDecoder extends Converter<pb.Reply, SpinifyReply> {
} else {
expBool = false;
ttlDT = null;
assert(false, 'Connection refresh is invalid');
assert(false, 'Connection refresh is invalid'); // coverage:ignore-line
}
return SpinifyRefreshResult(
id: id,
Expand All @@ -551,7 +551,7 @@ final class ProtobufReplyDecoder extends Converter<pb.Reply, SpinifyReply> {
} else {
expBool = false;
ttlDT = null;
assert(false, 'Connection refresh is invalid');
assert(false, 'Connection refresh is invalid'); // coverage:ignore-line
}
return SpinifySubRefreshResult(
id: id,
Expand All @@ -569,7 +569,9 @@ final class ProtobufReplyDecoder extends Converter<pb.Reply, SpinifyReply> {
temporary: error.temporary,
);
} else {
// coverage:ignore-start
throw UnimplementedError('Unsupported reply type');
// coverage:ignore-end
}
}
}

0 comments on commit 483d5a9

Please sign in to comment.