diff --git a/src/modules/inventory/tests/inventory/inventory_test.cpp b/src/modules/inventory/tests/inventory/inventory_test.cpp index 2c31f35fe6..ca5e7794f4 100644 --- a/src/modules/inventory/tests/inventory/inventory_test.cpp +++ b/src/modules/inventory/tests/inventory/inventory_test.cpp @@ -44,6 +44,32 @@ TEST_F(InventoryTest, SendUpdateEvent) { inventory.SendDeltaEvent(inputData); } +TEST_F(InventoryTest, SendDeleteEvent) { + ::testing::MockFunction mockPushMessage; + + inventory.SetPushMessageFunction(mockPushMessage.AsStdFunction()); + + EXPECT_CALL(mockPushMessage, Call(::testing::_)) + .WillOnce([](const Message& msg) + { + auto expectedData = R"({})"; + auto expectedMetadata = R"({"id":"123","module":"inventory","operation":"delete","type":"hardware"})"; + + EXPECT_EQ(msg.data.dump(), expectedData); + EXPECT_EQ(msg.metaData, expectedMetadata); + return 1; + }); + + auto inputData = R"({ + "type": "hardware", + "operation": "delete", + "id": "123", + "data": {"key": "value"} + })"; + + inventory.SendDeltaEvent(inputData); +} + int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv);