Skip to content

Commit a4a7626

Browse files
committed
test(binding_coap): add test for CoapSubprotocol.tryParse
1 parent 1fac84b commit a4a7626

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

test/binding_coap/coap_definitions_test.dart

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import "package:dart_wot/src/binding_coap/coap_extensions.dart";
1111
import "package:test/test.dart";
1212

1313
void main() {
14-
group("CoAP definitions", () {
15-
test("should deserialize CoAP Forms", () async {
14+
group("CoAP definitions should", () {
15+
test("deserialize CoAP Forms", () async {
1616
const thingDescriptionJson = {
1717
"@context": [
1818
"https://www.w3.org/2022/wot/td/v1.1",
@@ -88,4 +88,12 @@ void main() {
8888
);
8989
});
9090
});
91+
92+
test("parse CoAP subprotocols", () async {
93+
final observeSubprotocol = CoapSubprotocol.tryParse("cov:observe");
94+
expect(observeSubprotocol == CoapSubprotocol.observe, isTrue);
95+
96+
final unknownSubprotocol = CoapSubprotocol.tryParse("foobar");
97+
expect(unknownSubprotocol, isNull);
98+
});
9199
}

0 commit comments

Comments
 (0)