From 5ff73d5fe9a9440d53eddbf8e8a78bbaa9437568 Mon Sep 17 00:00:00 2001 From: worriedape <144045807+worriedape@users.noreply.github.com> Date: Tue, 10 Dec 2024 16:57:42 -0600 Subject: [PATCH] Fix typo in celsius to fahre and pass all tests --- 07_tempConversion/tempConversion.js | 9 +++++---- 07_tempConversion/tempConversion.spec.js | 10 +++++----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/07_tempConversion/tempConversion.js b/07_tempConversion/tempConversion.js index bccda3eed23..39c66d5dbb9 100644 --- a/07_tempConversion/tempConversion.js +++ b/07_tempConversion/tempConversion.js @@ -2,16 +2,17 @@ const convertToCelsius = function(fahre) { let convert = ((fahre - 32) * 5/9); -return convert.toFixed(1) +//return convert.toFixed(1) +return Math.round(convert * 10) / 10; }; const convertToFahrenheit = function(celsius) { -let convert = ((celsius - 32) * 9 / 5); - -return convert.toFixed(1); +let convert = ((celsius * 9/5) + 32); +//return convert.toFixed(1); +return Math.round(convert * 10) / 10; }; // Do not edit below this line diff --git a/07_tempConversion/tempConversion.spec.js b/07_tempConversion/tempConversion.spec.js index c4f9742cd89..7d0cc93a485 100644 --- a/07_tempConversion/tempConversion.spec.js +++ b/07_tempConversion/tempConversion.spec.js @@ -4,22 +4,22 @@ describe('convertToCelsius', () => { test('works', () => { expect(convertToCelsius(32)).toEqual(0); }); - test.skip('rounds to 1 decimal', () => { + test('rounds to 1 decimal', () => { expect(convertToCelsius(100)).toEqual(37.8); }); - test.skip('works with negatives', () => { + test('works with negatives', () => { expect(convertToCelsius(-100)).toEqual(-73.3); }); }); 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); }); });