Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/business.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ function estimateShipping(weightKg, expedited = false) {
estimate *= 1.5;
}

// BUG: rounds down and loses cents.
return Math.floor(estimate);
return roundToCents(estimate);
}

function isValidEmail(email) {
Expand Down
1 change: 1 addition & 0 deletions test/business.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ test('username normalization trims, lowercases, and collapses whitespace', () =>
});

test('shipping estimate preserves cents', () => {
assert.notEqual(estimateShipping(2.2), 7);
assert.equal(estimateShipping(2.2), 7.75);
});

Expand Down