EventBridge
October 5, 2022 ยท View on GitHub
EventBridge integration has two types of methods:
waitForEventBridgeXxx()- Intercept all events received by EventBridge.waitForEventBridgeRuleXxxYyy- Intercept only events received by Rule.
Basic example:
await serverlessSpyListener.waitForEventBridgeMyEventBus<TestData>();
await serverlessSpyListener.waitForEventBridgeRuleMyEventBusMyRule<TestData>();
You can use conditions to wait for a particular event. You can also use generic (TestData) to strongly type the event.
await serverlessSpyListener.waitForEventBridgeMyEventBus<TestData>({
condition: (d) => d.detail.id === id,
});
await serverlessSpyListener.waitForEventBridgeRuleMyEventBusMyRule<TestData>({
condition: (d) => d.detail.id === id,
});
Check this{:target="_blank"} and this{:target="_blank"} test.