Show file name and size on download page

This commit is contained in:
Ribas160 2025-06-26 18:12:22 +03:00
parent 409af9b991
commit d01c37c59d
42 changed files with 373 additions and 3 deletions

View file

@ -290,5 +290,31 @@ describe('Helper', function () {
}
);
});
describe('formatBytes', function () {
jsc.property('returns 0 B for 0 bytes', function () {
return $.PrivateBin.Helper.formatBytes(0) === '0 B';
});
jsc.property('formats bytes < 1000 as B', function () {
return $.PrivateBin.Helper.formatBytes(500) === '500 B';
});
jsc.property('formats kilobytes correctly', function () {
return $.PrivateBin.Helper.formatBytes(1500) === '1.5 KB';
});
jsc.property('formats megabytes correctly', function () {
return $.PrivateBin.Helper.formatBytes(2 * 1000 * 1000) === '2 MB';
});
jsc.property('formats gigabytes correctly', function () {
return $.PrivateBin.Helper.formatBytes(3.45 * 1000 * 1000 * 1000) === '3.45 GB';
});
jsc.property('rounds to two decimal places', function () {
return $.PrivateBin.Helper.formatBytes(1234567) === '1.23 MB';
});
});
});