Passes all tests from toFahrenheit in exercise 07
in conclusion passes all tests!
This commit is contained in:
parent
08d14383b0
commit
4cb2fa66b9
|
@ -2,7 +2,8 @@ const convertToCelsius = function(deg) {
|
||||||
return Math.round((deg - 32) * (5/9) * 10) / 10;
|
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
|
// x °C ≘ (x ×9/5+ 32) °F
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -13,13 +13,13 @@ describe('convertToCelsius', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('convertToFahrenheit', () => {
|
describe('convertToFahrenheit', () => {
|
||||||
test.skip('works', () => {
|
test('works', () => {
|
||||||
expect(convertToFahrenheit(0)).toEqual(32);
|
expect(convertToFahrenheit(0)).toEqual(32);
|
||||||
});
|
});
|
||||||
test.skip('rounds to 1 decimal', () => {
|
test('rounds to 1 decimal', () => {
|
||||||
expect(convertToFahrenheit(73.2)).toEqual(163.8);
|
expect(convertToFahrenheit(73.2)).toEqual(163.8);
|
||||||
});
|
});
|
||||||
test.skip('works with negatives', () => {
|
test('works with negatives', () => {
|
||||||
expect(convertToFahrenheit(-10)).toEqual(14);
|
expect(convertToFahrenheit(-10)).toEqual(14);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue