Add specs for message, options, and detail

This commit is contained in:
Kevin Sawicki
2015-07-07 12:14:00 -07:00
parent 062d948d7d
commit 24a56e974b

View File

@@ -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!')