Skip to content

Commit 1e9001b

Browse files
author
Gabriel Galvao da Gama
committed
Added test coverage
1 parent 71bc1f4 commit 1e9001b

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/file-uploader.test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,27 @@ define([
358358
});
359359
});
360360

361+
describe('onFail handler', function () {
362+
it('it logs responseText and status', function () {
363+
spyOn(console, 'error');
364+
365+
var fakeEvent = {
366+
target: document.createElement('input')
367+
},
368+
data = {
369+
jqXHR: {
370+
responseText: 'Failed',
371+
status: '500'
372+
}
373+
};
374+
375+
component.onFail(fakeEvent, data);
376+
expect(console.error).toHaveBeenCalledWith(data.jqXHR.responseText);
377+
expect(console.error).toHaveBeenCalledWith(data.jqXHR.status);
378+
expect(console.error).toHaveBeenCalledTimes(2);
379+
});
380+
});
381+
361382
describe('aggregateError method', function () {
362383
it('should append onto aggregatedErrors array when called', function () {
363384
spyOn(component.aggregatedErrors, 'push');

0 commit comments

Comments
 (0)