From d7f566088f22d4e5e67e4099d45adec756c8e716 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 25 May 2016 12:25:02 -0700 Subject: [PATCH] [Timeline] Update spec to include logging --- .../actions/ExportTimelineAsCSVActionSpec.js | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/platform/features/timeline/test/actions/ExportTimelineAsCSVActionSpec.js b/platform/features/timeline/test/actions/ExportTimelineAsCSVActionSpec.js index e0f09c3ae6..e31f25b074 100644 --- a/platform/features/timeline/test/actions/ExportTimelineAsCSVActionSpec.js +++ b/platform/features/timeline/test/actions/ExportTimelineAsCSVActionSpec.js @@ -24,7 +24,8 @@ define( ['../../src/actions/ExportTimelineAsCSVAction'], function (ExportTimelineAsCSVAction) { describe("ExportTimelineAsCSVAction", function () { - var mockExportService, + var mockLog, + mockExportService, mockNotificationService, mockNotification, mockDomainObject, @@ -39,6 +40,13 @@ define( ['getId', 'getModel', 'getCapability', 'hasCapability'] ); mockType = jasmine.createSpyObj('type', ['instanceOf']); + + mockLog = jasmine.createSpyObj('$log', [ + 'warn', + 'error', + 'info', + 'debug' + ]); mockExportService = jasmine.createSpyObj( 'exportService', ['exportCSV'] @@ -63,8 +71,10 @@ define( testContext = { domainObject: mockDomainObject }; action = new ExportTimelineAsCSVAction( + mockLog, mockExportService, mockNotificationService, + [], testContext ); }); @@ -129,8 +139,11 @@ define( }); describe("and an error occurs", function () { + var testError; + beforeEach(function () { - testPromise.reject(); + testError = { someProperty: "some value" }; + testPromise.reject(testError); waitsFor(function () { return mockCallback.calls.length > 0; }); @@ -145,6 +158,10 @@ define( expect(mockNotificationService.error) .toHaveBeenCalledWith(jasmine.any(String)); }); + + it("logs the root cause", function () { + expect(mockLog.warn).toHaveBeenCalledWith(testError); + }); }); }); });