11#define BOOST_TEST_MODULE test module test_discovery
2- #include < viam/sdk/components /discovery.hpp>
2+ #include < viam/sdk/services /discovery.hpp>
33
44#include < boost/optional/optional_io.hpp>
55#include < boost/qvm/all.hpp>
@@ -12,39 +12,26 @@ BOOST_TEST_DONT_PRINT_LOG_VALUE(std::vector<viam::sdk::ResourceConfig>)
1212
1313namespace viam {
1414namespace sdktests {
15+ namespace discovery {
1516
1617using namespace viam ::sdk;
1718
18- BOOST_AUTO_TEST_SUITE (test_discovery)
19-
20- BOOST_AUTO_TEST_CASE (mock_get_api) {
21- const MockDiscovery discovery (" mock_discovery" );
22- auto api = discovery.api ();
23- auto static_api = API::get<Discovery>();
24-
25- BOOST_CHECK_EQUAL (api, static_api);
26- BOOST_CHECK_EQUAL (static_api.resource_subtype (), " discovery" );
27- }
28-
2919BOOST_AUTO_TEST_CASE (test_discover_resources) {
30- std::shared_ptr<MockDiscovery> mock = MockDiscovery::get_mock_discovery ( );
20+ auto mock = std::make_shared<MockDiscovery>( " mock_discovery " );
3121 client_to_mock_pipeline<Discovery>(mock, [](Discovery& client) {
3222 const auto & resources = client.discover_resources ();
33- BOOST_CHECK_EQUAL (resource, fake_discovered_resources () );
23+ BOOST_CHECK_EQUAL (resources. size (), 3 );
3424 });
3525}
3626
3727BOOST_AUTO_TEST_CASE (test_do_command) {
38- std::shared_ptr<MockDiscovery> mock = MockDiscovery::get_mock_discovery ();
39- client_to_mock_pipeline<Discovery>(mock, [](Discovery& client) {
40- ProtoStruct expected = fake_map ();
41-
42- ProtoStruct command = fake_map ();
43- ProtoStruc result_map = client.do_command (command);
44-
45- BOOST_CHECK (result.map .at (" test" ) == expected.map .at (" test" ));
28+ auto mock = std::make_shared<MockDiscovery>(" mock_discovery" );
29+ client_to_mock_pipeline<Discovery>(mock, [&](Discovery& client) {
30+ const auto ret = client.do_command ({});
31+ BOOST_CHECK_EQUAL (ret.size (), 0 );
4632 });
4733}
4834
35+ } // namespace discovery
4936} // namespace sdktests
5037} // namespace viam
0 commit comments