-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add unit test for returnFileSize func (#882)
Co-authored-by: uyarnchen <[email protected]>
- Loading branch information
Showing
2 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { returnFileSize } from '../../../js/upload/utils'; | ||
|
||
describe('returnFileSize', () => { | ||
it('size is 1 B return 1 Byte', () => { | ||
expect(returnFileSize(1)).toBe('1 Bytes'); | ||
}); | ||
|
||
it('size is 1023 B return 1023 Byte', () => { | ||
expect(returnFileSize(1023)).toBe('1023 Bytes'); | ||
}); | ||
|
||
it('size is 1025 B return 1.0 KB', () => { | ||
expect(returnFileSize(1025)).toBe('1.0 KB'); | ||
}); | ||
|
||
it('size is 2097152 B return 2.0 MB', () => { | ||
expect(returnFileSize(2097152)).toBe('2.0 MB'); | ||
}); | ||
|
||
it('size is 1073741823 B return 1024.0 MB', () => { | ||
expect(returnFileSize(1073741823)).toBe('1024.0 MB'); | ||
}); | ||
|
||
it('size is 1073741824 B return 1.0 GB', () => { | ||
expect(returnFileSize(1073741824)).toBe('1.0 GB'); | ||
}); | ||
}); |