mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Add specs for message, options, and detail
This commit is contained in:
@@ -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!')
|
||||
|
||||
Reference in New Issue
Block a user