diff --git a/spec/notification-spec.coffee b/spec/notification-spec.coffee index 0ff4599a7..9c6edbfd6 100644 --- a/spec/notification-spec.coffee +++ b/spec/notification-spec.coffee @@ -3,6 +3,22 @@ Notification = require '../src/notification' describe "Notification", -> [notification] = [] + it "throws an error when created with a non-string message", -> + expect(-> new Notification('error', null)).toThrow() + expect(-> new Notification('error', 3)).toThrow() + expect(-> new Notification('error', {})).toThrow() + expect(-> new Notification('error', false)).toThrow() + + it "throws an error when created with non-object options", -> + expect(-> new Notification('error', 'message', 'foo')).toThrow() + expect(-> new Notification('error', 'message', 3)).toThrow() + expect(-> new Notification('error', 'message', false)).toThrow() + + it "throws an error when created with a non-string detail", -> + expect(-> new Notification('error', 'message', detail: 3)).toThrow() + expect(-> new Notification('error', 'message', detail: false)).toThrow() + expect(-> new Notification('error', 'message', detail: {})).toThrow() + describe "::getTimestamp()", -> it "returns a Date object", -> notification = new Notification('error', 'message!')