From 024d60597ce1b478ec866dfbe4c1aa8be5ae59ba Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Thu, 17 Mar 2016 09:24:14 -0300 Subject: [PATCH] Add tests to notification component --- src/app/components/notification/notification.component.spec.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+), 0 deletions(-) diff --git a/src/app/components/notification/notification.component.spec.ts b/src/app/components/notification/notification.component.spec.ts index c10cf9c..5ac2742 100644 --- a/src/app/components/notification/notification.component.spec.ts +++ b/src/app/components/notification/notification.component.spec.ts @@ -13,6 +13,20 @@ describe("Components", () => { beforeEach(angular.mock.module("templates")); + it("display an error message when notify an error", done => { + let sweetAlert = jasmine.createSpyObj("sweetAlert", ["swal"]); + sweetAlert.swal = jasmine.createSpy("swal"); + + let component: Notification = new Notification(helpers.mocks.$log, sweetAlert, helpers.mocks.translatorService); + component.error("message", "title"); + expect(sweetAlert.swal).toHaveBeenCalledWith(jasmine.objectContaining({ + text: "message", + title: "title", + type: "error" + })); + done(); + }); + it("use the default message when call notification component without a message", done => { let sweetAlert = jasmine.createSpyObj("sweetAlert", ["swal"]); sweetAlert.swal = jasmine.createSpy("swal"); -- libgit2 0.21.2