Passes all tests from toFahrenheit in exercise 07

in conclusion passes all tests!
This commit is contained in:
NetMan 2024-01-05 22:08:37 +01:00
parent 08d14383b0
commit 4cb2fa66b9
2 changed files with 5 additions and 4 deletions

View File

@ -2,7 +2,8 @@ const convertToCelsius = function(deg) {
return Math.round((deg - 32) * (5/9) * 10) / 10;
};
const convertToFahrenheit = function() {
const convertToFahrenheit = function(deg) {
return Math.round((deg * (9/5) + 32) * 10) / 10;
// x °C ≘ (x ×9/5+ 32) °F
};

View File

@ -13,13 +13,13 @@ describe('convertToCelsius', () => {
});
describe('convertToFahrenheit', () => {
test.skip('works', () => {
test('works', () => {
expect(convertToFahrenheit(0)).toEqual(32);
});
test.skip('rounds to 1 decimal', () => {
test('rounds to 1 decimal', () => {
expect(convertToFahrenheit(73.2)).toEqual(163.8);
});
test.skip('works with negatives', () => {
test('works with negatives', () => {
expect(convertToFahrenheit(-10)).toEqual(14);
});
});