summaryrefslogtreecommitdiffstats
path: root/core/js/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-07-13 15:46:02 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2016-08-03 10:16:28 +0200
commit0f3674a4469d894c804c68b12c88f47bc063f956 (patch)
tree2eec097b2b9c0076d2cc14a9b55613f775e904a5 /core/js/tests
parent0bddaa23b098cee55b1d85f9a627a1df1c8a9410 (diff)
downloadnextcloud-server-0f3674a4469d894c804c68b12c88f47bc063f956.tar.gz
nextcloud-server-0f3674a4469d894c804c68b12c88f47bc063f956.zip
Group incoming shares for resharing in JS
Diffstat (limited to 'core/js/tests')
-rw-r--r--core/js/tests/specs/shareitemmodelSpec.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/core/js/tests/specs/shareitemmodelSpec.js b/core/js/tests/specs/shareitemmodelSpec.js
index 8c9560d2646..9d9001dc9e8 100644
--- a/core/js/tests/specs/shareitemmodelSpec.js
+++ b/core/js/tests/specs/shareitemmodelSpec.js
@@ -181,6 +181,48 @@ describe('OC.Share.ShareItemModel', function() {
// TODO: check more attributes
});
+ it('groups reshare info into a single item', function() {
+ /* jshint camelcase: false */
+ fetchReshareDeferred.resolve(makeOcsResponse([
+ {
+ id: '1',
+ share_type: OC.Share.SHARE_TYPE_USER,
+ uid_owner: 'owner',
+ displayname_owner: 'Owner',
+ share_with: 'root',
+ permissions: 1
+ },
+ {
+ id: '2',
+ share_type: OC.Share.SHARE_TYPE_GROUP,
+ uid_owner: 'owner',
+ displayname_owner: 'Owner',
+ share_with: 'group1',
+ permissions: 15
+ },
+ {
+ id: '3',
+ share_type: OC.Share.SHARE_TYPE_GROUP,
+ uid_owner: 'owner',
+ displayname_owner: 'Owner',
+ share_with: 'group1',
+ permissions: 17
+ }
+ ]));
+ fetchSharesDeferred.resolve(makeOcsResponse([]));
+
+ OC.currentUser = 'root';
+
+ model.fetch();
+
+ var reshare = model.get('reshare');
+ // max permissions
+ expect(reshare.permissions).toEqual(31);
+ // user share has higher priority
+ expect(reshare.share_type).toEqual(OC.Share.SHARE_TYPE_USER);
+ expect(reshare.share_with).toEqual('root');
+ expect(reshare.id).toEqual('1');
+ });
it('does not parse link share when for a different file', function() {
/* jshint camelcase: false */
fetchReshareDeferred.resolve(makeOcsResponse([]));