aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMaxim Filippov <colixer@gmail.com>2018-12-17 02:39:37 +0300
committerMaxim Filippov <colixer@gmail.com>2018-12-17 02:39:37 +0300
commit2211c533ddf7a05723afb2e2a8664b9b49c9648d (patch)
treed5bcfbdb55536db01bc0bfda38991db8f159a3e9 /test
parent5fc0fe28e45882da0fab635e839a2977104d2f46 (diff)
parentada4bd0d9874d98213cf79ccd9f7cddda36d1b6c (diff)
Merge branch 'develop' into feature/new-user-routes
Diffstat (limited to 'test')
-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)
+ })
+ })