Skip to content

Commit 720460f

Browse files
committed
Adding test for invalid precision value
1 parent bd48533 commit 720460f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

test/filesize_test.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,10 @@ exports.filesize = {
197197
test.done();
198198
},
199199
precision: function (test) {
200-
test.expect(4);
200+
test.expect(5);
201201
test.equal(filesize(1024 * 1, {precision: 3}), "1.00 KB", "Should be '1.00 KB'");
202-
test.equal(filesize(1024 * 1024 * 10.25, {precision: 3}), "10.3 MB", "Should be '21.0 KB'");
202+
test.equal(filesize(1024 * 1024 * 10.25, {precision: 3}), "10.3 MB", "Should be '10.3 MB'");
203+
test.equal(filesize(1024 * 1024 * 10.25, {precision: "x"}), "10.25 MB", "Should be '10.25 MB'");
203204
test.equal(filesize(1024 * 1024 * 1024, {precision: 3}), "1.00 GB", "Should be '1.00 GB'");
204205
test.equal(filesize(Math.pow(1024, 10), {precision: 3}), "1e+6 YB", "Should be '1e+6 YB'");
205206
test.done();

0 commit comments

Comments
 (0)