aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2017-11-24 15:33:26 +0100
committerArthur Schiwon <blizzz@arthur-schiwon.de>2017-11-24 15:33:26 +0100
commit134192d76cf27bee9549710a1eac40db3ef1edf1 (patch)
tree58da3008b09fbfe5698d8876f8b1eae4f7197317 /core
parent5a9c99e6ac53ec021bcd124c2b8664fe269a5168 (diff)
downloadnextcloud-server-134192d76cf27bee9549710a1eac40db3ef1edf1.tar.gz
nextcloud-server-134192d76cf27bee9549710a1eac40db3ef1edf1.zip
fix sorting test on phantomjs
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'core')
-rw-r--r--core/js/tests/specs/shareSpec.js44
1 files changed, 29 insertions, 15 deletions
diff --git a/core/js/tests/specs/shareSpec.js b/core/js/tests/specs/shareSpec.js
index 399911c3d54..05057692e98 100644
--- a/core/js/tests/specs/shareSpec.js
+++ b/core/js/tests/specs/shareSpec.js
@@ -327,22 +327,36 @@ describe('OC.Share tests', function() {
);
});
it('display multiple with divergent displaynames', function() {
- checkRecipients(
- {
- 0: {
- shareWith: 'One',
- shareWithDisplayName: 'Yoko Ono'
- },
- 1: {
- shareWith: 'two@otherserver.com',
- shareWithDisplayName: 'two@othererver.com'
- },
- 2: {
- shareWith: 'Three',
- shareWithDisplayName: 'Green, Mina'
- }
+ var recipients = {
+ 0: {
+ shareWith: 'One',
+ shareWithDisplayName: 'Yoko Ono',
+ _output: 'Shared with Yoko Ono'
},
- 'Shared with Green, Mina two@… Shared with Yoko Ono',
+ 1: {
+ shareWith: 'two@otherserver.com',
+ shareWithDisplayName: 'two@othererver.com',
+ _output: 'two@…'
+ },
+ 2: {
+ shareWith: 'Three',
+ shareWithDisplayName: 'Green, Mina',
+ _output: 'Shared with Green, Mina'
+ }
+ };
+
+ // we cannot assume the locale, also because PhantomJS has a bug.
+ var sortArray = _.toArray(recipients)
+ .sort(function(a, b) {
+ return a.shareWithDisplayName.localeCompare(b.shareWithDisplayName);
+ });
+ var sortedOutput = _.map(sortArray, function(recipient) {
+ return recipient._output;
+ }).join(' ');
+
+ checkRecipients(
+ recipients,
+ sortedOutput,
['Shared with two@otherserver.com']
);
});