Skip to content

Commit

Permalink
test(binding_coap): add client factory tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JKRhb committed Mar 21, 2022
1 parent f3dba12 commit c9e4e62
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/binding_coap_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,29 @@ void main() {
expect(customServer.port, 9001);
expect(customServer.preferredBlockSize, 64);
});

test("ClientFactory tests", () async {
final defaultClientFactory = CoapClientFactory(null);

expect(defaultClientFactory.coapConfig, null);
expect(defaultClientFactory.init(), true);

final coapClient = defaultClientFactory.createClient();

await coapClient.start();

await coapClient.stop();

expect(defaultClientFactory.destroy(), true);

final customClientFactory =
CoapClientFactory(CoapConfig(port: 9001, blocksize: 64));

expect(customClientFactory.coapConfig?.port, 9001);
expect(customClientFactory.coapConfig?.blocksize, 64);

expect(customClientFactory.init(), true);
expect(customClientFactory.destroy(), true);
});
});
}

0 comments on commit c9e4e62

Please sign in to comment.