diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-03-19 15:36:08 +0100 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-03-20 19:09:04 +0100 |
commit | 1c440519c2653323dd49fb4ec3a06851d114c4fe (patch) | |
tree | d744a4fe5dfd3634185d4d724fdedc32e3a71584 /core/js/tests | |
parent | ed1452d7a067d383371dcd165ad86e01f174840b (diff) | |
download | nextcloud-server-1c440519c2653323dd49fb4ec3a06851d114c4fe.tar.gz nextcloud-server-1c440519c2653323dd49fb4ec3a06851d114c4fe.zip |
Show an error when getting the suggestions succeeds with failure content
Instead of silently failing now an error is shown to the user when the
ajax call to get the suggestions succeeds yet it returns failure content
(for example, if an "OCSBadRequestException" was thrown in the server).
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'core/js/tests')
-rw-r--r-- | core/js/tests/specs/sharedialogviewSpec.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/core/js/tests/specs/sharedialogviewSpec.js b/core/js/tests/specs/sharedialogviewSpec.js index c12c734a5df..be1aa4c9a8e 100644 --- a/core/js/tests/specs/sharedialogviewSpec.js +++ b/core/js/tests/specs/sharedialogviewSpec.js @@ -1462,7 +1462,7 @@ describe('OC.Share.ShareDialogView', function() { }); }); - it('gracefully handles successful ajax call with failure content', function () { + it('throws a notification for a successful ajax call with failure content', function () { dialog.render(); var response = sinon.stub(); dialog.autocompleteHandler({term: 'bob'}, response); @@ -1470,7 +1470,8 @@ describe('OC.Share.ShareDialogView', function() { 'ocs' : { 'meta' : { 'status': 'failure', - 'statuscode': 400 + 'statuscode': 400, + 'message': 'error message' } } }); @@ -1479,7 +1480,9 @@ describe('OC.Share.ShareDialogView', function() { {'Content-Type': 'application/json'}, jsonData ); - expect(response.calledWithExactly()).toEqual(true); + expect(response.called).toEqual(false); + expect(showTemporaryNotificationStub.calledOnce).toEqual(true); + expect(showTemporaryNotificationStub.firstCall.args[0]).toContain('error message'); }); it('throws a notification when the ajax search lookup fails', function () { |