Skip to content

Commit

Permalink
Issue 96 (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
shamblett authored May 19, 2024
1 parent 11db5ac commit 98f6bb4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/src/utility/mqtt_enum_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ class MqttEnumHelper<T extends dynamic> {
}

/// As string
String asString(T name) => name.toString().split('.')[1];
String asString(T name) => name.toString().split('.').last;
}
5 changes: 5 additions & 0 deletions test/mqtt_client_message_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3104,6 +3104,9 @@ void main() {
expect(message.variableHeader!.connectAckFlags.sessionPresent, isFalse);
expect(
message.variableHeader!.reasonCode, MqttConnectReasonCode.success);
expect(
mqttConnectReasonCode.asString(message.variableHeader!.reasonCode),
'success');
expect(
MqttReasonCodeUtilities.isError(mqttConnectReasonCode
.asInt(message.variableHeader!.reasonCode)!),
Expand Down Expand Up @@ -3212,6 +3215,8 @@ void main() {
expect(message.header!.messageType, MqttMessageType.disconnect);
expect(message.header!.messageSize, 70);
expect(message.reasonCode, MqttDisconnectReasonCode.quotaExceeded);
expect(mqttDisconnectReasonCode.asString(message.reasonCode),
'quotaExceeded');
expect(message.sessionExpiryInterval, 10);
expect(message.serverReference, 'Server Reference');
expect(message.userProperties[0].pairName, 'User 1 name');
Expand Down

0 comments on commit 98f6bb4

Please sign in to comment.