       atom.notifications.addNotification(error)
       atom.notifications.addNotification(warning)
 
-      activationPromise = atom.packages.activatePackage('notifications')
       waitsForPromise ->
-        activationPromise
+        atom.packages.activatePackage('notifications')
 
       waitsForPromise ->
         atom.workspace.open(NotificationsLog::getURI())

      generateFakeFetchResponses()

    it "adds an .notifications-log-item element to the container with a class corresponding to the type", ->
      expect(notificationsLogContainer.childNodes.length).toBe 1

      atom.notifications.addSuccess('A message')
      notification = notificationsLogContainer.querySelector('.notifications-log-item.success')
      expect(notificationsLogContainer.childNodes.length).toBe 2
      expect(notification.querySelector('.message').textContent.trim()).toBe 'A message'
      expect(notification.querySelector('.btn-toolbar')).toBeEmpty()

      atom.notifications.addInfo('A message')
      expect(notificationsLogContainer.childNodes.length).toBe 3
      expect(notificationsLogContainer.querySelector('.notifications-log-item.info')).toBeDefined()

      atom.notifications.addWarning('A message')
      expect(notificationsLogContainer.childNodes.length).toBe 4
      expect(notificationsLogContainer.querySelector('.notifications-log-item.warning')).toBeDefined()

      atom.notifications.addError('A message')
      expect(notificationsLogContainer.childNodes.length).toBe 5
      expect(notificationsLogContainer.querySelector('.notifications-log-item.error')).toBeDefined()

      atom.notifications.addFatalError('A message')
      notification = notificationsLogContainer.querySelector('.notifications-log-item.fatal')
      expect(notificationsLogContainer.childNodes.length).toBe 6
      expect(notification).toBeDefined()
      expect(notification.querySelector('.btn-toolbar')).not.toBeEmpty()


{generateFakeFetchResponses, generateException} = require './helper'

describe "Notifications Log", ->
  workspaceElement = null

  beforeEach ->
    workspaceElement = atom.views.getView(atom.workspace)
    atom.notifications.clear()

    waitsForPromise ->
      atom.packages.activatePackage('notifications')

    waitsForPromise ->
      atom.workspace.open(NotificationsLog::getURI())
