summaryrefslogtreecommitdiffstats
path: root/core/js/tests
diff options
context:
space:
mode:
authorArtur Neumann <info@individual-it.net>2017-02-27 12:34:15 +0545
committerArtur Neumann <info@individual-it.net>2017-02-28 07:38:11 +0545
commitf1fccaca0605a5d183f78b2c39d2e09a54753787 (patch)
treeb63d877889120d12bc59e2103ad64c1568e8186b /core/js/tests
parentd0c6179ec18d1e2c3ce86bdf03f36aaa1501c6e7 (diff)
downloadnextcloud-server-f1fccaca0605a5d183f78b2c39d2e09a54753787.tar.gz
nextcloud-server-f1fccaca0605a5d183f78b2c39d2e09a54753787.zip
better quota validation
this fixes #3634 1. fixed computerFileSize to be more picky about incorrect values 2. more tests for computerFileSize 3. use computerFileSize to validate user quota Signed-off-by: Artur Neumann <info@individual-it.net>
Diffstat (limited to 'core/js/tests')
-rw-r--r--core/js/tests/specs/coreSpec.js17
1 files changed, 15 insertions, 2 deletions
diff --git a/core/js/tests/specs/coreSpec.js b/core/js/tests/specs/coreSpec.js
index d83c0cd9a38..faafb4797be 100644
--- a/core/js/tests/specs/coreSpec.js
+++ b/core/js/tests/specs/coreSpec.js
@@ -594,8 +594,14 @@ describe('Core base tests', function() {
it('correctly parses file sizes from a human readable formated string', function() {
var data = [
['125', 125],
- ['125.25', 125.25],
+ ['125.25', 125],
+ ['125.25B', 125],
+ ['125.25 B', 125],
['0 B', 0],
+ ['99999999999999999999999999999999999999999999 B', 99999999999999999999999999999999999999999999],
+ ['0 MB', 0],
+ ['0 kB', 0],
+ ['0kB', 0],
['125 B', 125],
['125b', 125],
['125 KB', 128000],
@@ -605,7 +611,14 @@ describe('Core base tests', function() {
['119.2 GB', 127990025421],
['119.2gb', 127990025421],
['116.4 TB', 127983153473126],
- ['116.4tb', 127983153473126]
+ ['116.4tb', 127983153473126],
+ ['8776656778888777655.4tb', 9.650036181387265e+30],
+ [1234, null],
+ [-1234, null],
+ ['-1234 B', null],
+ ['B', null],
+ ['40/0', null],
+ ['40,30 kb', null],
];
for (var i = 0; i < data.length; i++) {
expect(OC.Util.computerFileSize(data[i][0])).toEqual(data[i][1]);