Previously, we used to test that a
DiscourseEvent has been triggered by mocking the method call using Mocha which looks something like:
However, these mocks make test cases super brittle because the test case would fail when another
DiscourseEvent that is not “expected” is triggered. As a result, the developer would have to mock every single
DiscourseEvent trigger that would trigger even if he is only concerned about testing a single trigger.
Examples of how to use the new helper can be found in