@@ -2437,8 +2437,12 @@ TEST(TestCodegenModelViaMocks, EmberWriteAttributeAccessInterfaceTest)
2437
2437
2438
2438
TEST (TestCodegenModelViaMocks, EmberInvokeTest)
2439
2439
{
2440
- // Ember invoke is extrealy hard-coded, so generally we just need to validate that
2441
- // correct paths are invoked.
2440
+ // Ember invoke is fully code-generated - there is a single function for Dispatch
2441
+ // that will do a `switch` on the path elements and invoke a corresponding `emberAf*`
2442
+ // callback.
2443
+ //
2444
+ // The only thing that can be validated is that this `DispatchSingleClusterCommand`
2445
+ // is actually invoked.
2442
2446
2443
2447
UseMockNodeConfig config (gTestNodeConfig );
2444
2448
chip::app::CodegenDataModel model;
@@ -2450,7 +2454,8 @@ TEST(TestCodegenModelViaMocks, EmberInvokeTest)
2450
2454
2451
2455
const uint32_t kDispatchCountPre = chip::Test::DispatchCount ();
2452
2456
2453
- ASSERT_EQ (model.Invoke (kInvokeRequest , tlvReader, nullptr /* handler, NOT used by impl*/ ), CHIP_NO_ERROR);
2457
+ // Using a handler set to nullpotr as it is not used by the impl
2458
+ ASSERT_EQ (model.Invoke (kInvokeRequest , tlvReader, /* handler = */ nullptr ), CHIP_NO_ERROR);
2454
2459
2455
2460
EXPECT_EQ (chip::Test::DispatchCount (), kDispatchCountPre + 1 ); // single dispatch
2456
2461
EXPECT_EQ (chip::Test::GetLastDispatchPath (), kCommandPath ); // for the right path
@@ -2463,7 +2468,8 @@ TEST(TestCodegenModelViaMocks, EmberInvokeTest)
2463
2468
2464
2469
const uint32_t kDispatchCountPre = chip::Test::DispatchCount ();
2465
2470
2466
- ASSERT_EQ (model.Invoke (kInvokeRequest , tlvReader, nullptr /* handler, NOT used by impl*/ ), CHIP_NO_ERROR);
2471
+ // Using a handler set to nullpotr as it is not used by the impl
2472
+ ASSERT_EQ (model.Invoke (kInvokeRequest , tlvReader, /* handler = */ nullptr ), CHIP_NO_ERROR);
2467
2473
2468
2474
EXPECT_EQ (chip::Test::DispatchCount (), kDispatchCountPre + 1 ); // single dispatch
2469
2475
EXPECT_EQ (chip::Test::GetLastDispatchPath (), kCommandPath ); // for the right path
0 commit comments