[Topic] Add test case

...which specifies desired behavior for nasa/openmctweb#231.
This commit is contained in:
Victor Woeltjen 2015-11-09 16:51:39 -08:00
parent 96a7c12d69
commit acdd9622d2

View File

@ -65,6 +65,21 @@ define(
expect(mockCallback).toHaveBeenCalledWith(testMessage);
});
it("is robust against errors thrown by listeners", function () {
var mockBadCallback = jasmine.createSpy("bad-callback"),
t = topic();
mockBadCallback.andCallFake(function () {
throw new Error("I'm afraid I can't do that.");
});
t.listen(mockBadCallback);
t.listen(mockCallback);
t.notify(testMessage);
expect(mockCallback).toHaveBeenCalledWith(testMessage);
});
});
}
);