[Timeline] Update spec to include logging

This commit is contained in:
Victor Woeltjen 2016-05-25 12:25:02 -07:00
parent a3bcaea7f9
commit d7f566088f

View File

@ -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);
});
});
});
});