@backstage/backend-test-utils
Version:
Test helpers library for Backstage backends
22 lines (19 loc) • 467 B
JavaScript
;
class MockEventsService {
#subscribers;
constructor() {
this.#subscribers = [];
}
async publish(params) {
for (const subscriber of this.#subscribers) {
if (subscriber.topics.includes(params.topic)) {
await subscriber.onEvent(params);
}
}
}
async subscribe(options) {
this.#subscribers.push(options);
}
}
exports.MockEventsService = MockEventsService;
//# sourceMappingURL=MockEventsService.cjs.js.map