I'm very new to Chai testing. I can't find good example. Basically, what I want to happen is check wether the event got triggered.
on my patientInfo.js, the code to trigger the event is
import PatientBus from 'backbone.radio';
patientAdded() {
PatientBus.trigger('patient:added');
},
then on my patientEvents.js
import PatientBus from 'backbone.radio';
this.listenTo(PatientBus, 'patient:added', this.onPatientAdded);
onPatientAdded: function onPatientAdded() {
// blah blah blah
}
Forgot to say, I'm using Marionette radio. The event handler codes above are working great. Now, I want a chai test which will check if the listener of the event received the trigger or broadcast request. I'm not sure where to start and how I will write it.