I have implemented flow to handle platform event on Order Status Changed Event , working fine with the flow, but it is not working with the Test Class, here is my test method
@IsTest
static void Test1(){
Test.enableChangeDataCapture();
Test.startTest();
Order order = [SELECT Id, Status FROM Order Where Account.Name = 'TestAccount'];
order.Status = 'Dispatched';
update order;
Test.getEventBus().deliver();
Test.stopTest();
}
I expected the flow will create Invoice after the card is dispatched. I have created another test for ContactChangeEvent works fine, here is the test method
@IsTest
static void Test2()
{
Test.enableChangeDataCapture();
Test.startTest();
Contact contact = [SELECT Id, Department FROM Contact WHERE Email ='[email protected]'];
contact.Department = 'IT Division';
update contact;
Test.getEventBus().deliver();
Test.stopTest();
}
the only difference I found with the event is Changed the first one has Order Status Changed Event and another one ContactChangeEvent, may be I am missing something, any help will be appreciated. Thank you
Dispatched