diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2017-04-26 19:23:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-26 19:23:27 +0200 |
commit | 646db7f88d911459bdfa038d8a66ded27ae888a4 (patch) | |
tree | c506b32b4a525d932d680acff78b9d148efda8da /core/js/tests | |
parent | d89c76049fbc7061bfa45e87c46f08802242d5f2 (diff) | |
parent | 17a31a51c62e36500f59b3c2d385ab79258f6bb6 (diff) | |
download | nextcloud-server-646db7f88d911459bdfa038d8a66ded27ae888a4.tar.gz nextcloud-server-646db7f88d911459bdfa038d8a66ded27ae888a4.zip |
Merge pull request #4518 from nextcloud/downstream-25838
Fix share indicator handling
Diffstat (limited to 'core/js/tests')
-rw-r--r-- | core/js/tests/specs/shareitemmodelSpec.js | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/core/js/tests/specs/shareitemmodelSpec.js b/core/js/tests/specs/shareitemmodelSpec.js index 771a9263709..3b17051508e 100644 --- a/core/js/tests/specs/shareitemmodelSpec.js +++ b/core/js/tests/specs/shareitemmodelSpec.js @@ -924,5 +924,66 @@ describe('OC.Share.ShareItemModel', function() { expect(errorStub.lastCall.args[1]).toEqual('Some error message'); }); }); + + describe('getShareTypes', function() { + + var dataProvider = [ + [ + ], + [ + OC.Share.SHARE_TYPE_USER, + OC.Share.SHARE_TYPE_USER, + ], + [ + OC.Share.SHARE_TYPE_USER, + OC.Share.SHARE_TYPE_GROUP, + OC.Share.SHARE_TYPE_LINK, + OC.Share.SHARE_TYPE_REMOTE + ], + [ + OC.Share.SHARE_TYPE_USER, + OC.Share.SHARE_TYPE_GROUP, + OC.Share.SHARE_TYPE_GROUP, + OC.Share.SHARE_TYPE_LINK, + OC.Share.SHARE_TYPE_LINK, + OC.Share.SHARE_TYPE_REMOTE, + OC.Share.SHARE_TYPE_REMOTE, + OC.Share.SHARE_TYPE_REMOTE + ], + [ + OC.Share.SHARE_TYPE_LINK, + OC.Share.SHARE_TYPE_LINK, + OC.Share.SHARE_TYPE_USER + ] + ]; + + _.each(dataProvider, function testCase(shareTypes, i) { + it('returns set of share types for case ' + i, function() { + /* jshint camelcase: false */ + fetchReshareDeferred.resolve(makeOcsResponse([])); + + var id = 100; + var shares = _.map(shareTypes, function(shareType) { + return { + id: id++, + item_source: 123, + permissions: 31, + share_type: shareType, + uid_owner: 'root' + }; + }); + + var expectedResult = _.uniq(shareTypes).sort(); + + fetchSharesDeferred.resolve(makeOcsResponse(shares)); + + OC.currentUser = 'root'; + + model.fetch(); + + expect(model.getShareTypes().sort()).toEqual(expectedResult); + }); + }); + }); }); |