diff --git a/07_tempConversion/tempConversion.js b/07_tempConversion/tempConversion.js index ebc51d9..73aadaa 100644 --- a/07_tempConversion/tempConversion.js +++ b/07_tempConversion/tempConversion.js @@ -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 }; diff --git a/07_tempConversion/tempConversion.spec.js b/07_tempConversion/tempConversion.spec.js index 8bbd385..7d0cc93 100644 --- a/07_tempConversion/tempConversion.spec.js +++ b/07_tempConversion/tempConversion.spec.js @@ -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); }); });