logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git

file_size_format.spec.js (695B)


  1. import fileSizeFormatService from '../../../../../src/services/file_size_format/file_size_format.js'
  2. describe('fileSizeFormat', () => {
  3. it('Formats file size', () => {
  4. const values = [1, 1024, 1048576, 1073741824, 1099511627776]
  5. const expected = [
  6. {
  7. num: 1,
  8. unit: 'B'
  9. },
  10. {
  11. num: 1,
  12. unit: 'KiB'
  13. },
  14. {
  15. num: 1,
  16. unit: 'MiB'
  17. },
  18. {
  19. num: 1,
  20. unit: 'GiB'
  21. },
  22. {
  23. num: 1,
  24. unit: 'TiB'
  25. }
  26. ]
  27. const res = []
  28. for (const value in values) {
  29. res.push(fileSizeFormatService.fileSizeFormat(values[value]))
  30. }
  31. expect(res).to.eql(expected)
  32. })
  33. })