aboutsummaryrefslogtreecommitdiff
path: root/test/unit/specs
diff options
context:
space:
mode:
authorHJ <spam@hjkos.com>2018-12-13 21:02:17 +0000
committerHJ <spam@hjkos.com>2018-12-13 21:02:17 +0000
commit99b2b7a20358a1324ea139353109784213ebd5d3 (patch)
tree9b57ad2f701b1f5df4dc3061a1ad5e155dccec62 /test/unit/specs
parentdcca4617d5647e0570b359c4e1b14737c552bc7b (diff)
parentdd6a9ae6458784b36ffe2376492284ae4e79fece (diff)
Merge branch 'feature/file-size-checking' into 'develop'
[pleroma#36] Add errors when file uploading fails See merge request pleroma/pleroma-fe!405
Diffstat (limited to 'test/unit/specs')
-rw-r--r--test/unit/specs/services/file_size_format/file_size_format.spec.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/unit/specs/services/file_size_format/file_size_format.spec.js b/test/unit/specs/services/file_size_format/file_size_format.spec.js
new file mode 100644
index 00000000..0a5a82b7
--- /dev/null
+++ b/test/unit/specs/services/file_size_format/file_size_format.spec.js
@@ -0,0 +1,34 @@
+ import fileSizeFormatService from '../../../../../src/services/file_size_format/file_size_format.js'
+ describe('fileSizeFormat', () => {
+ it('Formats file size', () => {
+ const values = [1, 1024, 1048576, 1073741824, 1099511627776]
+ const expected = [
+ {
+ num: 1,
+ unit: 'B'
+ },
+ {
+ num: 1,
+ unit: 'KiB'
+ },
+ {
+ num: 1,
+ unit: 'MiB'
+ },
+ {
+ num: 1,
+ unit: 'GiB'
+ },
+ {
+ num: 1,
+ unit: 'TiB'
+ }
+ ]
+
+ var res = []
+ for (var value in values) {
+ res.push(fileSizeFormatService.fileSizeFormat(values[value]))
+ }
+ expect(res).to.eql(expected)
+ })
+ })