From 374252c3026d7de9765962e29ebf688bdbc9ad49 Mon Sep 17 00:00:00 2001 From: Asartea <76259120+Asartea@users.noreply.github.com> Date: Sat, 12 Nov 2022 20:49:28 +0100 Subject: [PATCH 1/3] Update tempConversion function's naming --- 07_tempConversion/tempConversion.js | 10 ++++----- 07_tempConversion/tempConversion.spec.js | 28 ++++++++++++------------ 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/07_tempConversion/tempConversion.js b/07_tempConversion/tempConversion.js index 6ef3e85..14153e0 100644 --- a/07_tempConversion/tempConversion.js +++ b/07_tempConversion/tempConversion.js @@ -1,13 +1,11 @@ -const ftoc = function() { - +const convertToCelsius = function() { }; -const ctof = function() { - +const convertToFahrenheit = function() { }; // Do not edit below this line module.exports = { - ftoc, - ctof + convertToCelsius, + convertToFahrenheit }; diff --git a/07_tempConversion/tempConversion.spec.js b/07_tempConversion/tempConversion.spec.js index 93679cc..7d0cc93 100644 --- a/07_tempConversion/tempConversion.spec.js +++ b/07_tempConversion/tempConversion.spec.js @@ -1,25 +1,25 @@ -const {ftoc, ctof} = require('./tempConversion') +const {convertToCelsius, convertToFahrenheit} = require('./tempConversion') -describe('ftoc', () => { +describe('convertToCelsius', () => { test('works', () => { - expect(ftoc(32)).toEqual(0); + expect(convertToCelsius(32)).toEqual(0); }); - test.skip('rounds to 1 decimal', () => { - expect(ftoc(100)).toEqual(37.8); + test('rounds to 1 decimal', () => { + expect(convertToCelsius(100)).toEqual(37.8); }); - test.skip('works with negatives', () => { - expect(ftoc(-100)).toEqual(-73.3); + test('works with negatives', () => { + expect(convertToCelsius(-100)).toEqual(-73.3); }); }); -describe('ctof', () => { - test.skip('works', () => { - expect(ctof(0)).toEqual(32); +describe('convertToFahrenheit', () => { + test('works', () => { + expect(convertToFahrenheit(0)).toEqual(32); }); - test.skip('rounds to 1 decimal', () => { - expect(ctof(73.2)).toEqual(163.8); + test('rounds to 1 decimal', () => { + expect(convertToFahrenheit(73.2)).toEqual(163.8); }); - test.skip('works with negatives', () => { - expect(ctof(-10)).toEqual(14); + test('works with negatives', () => { + expect(convertToFahrenheit(-10)).toEqual(14); }); }); From 0b218347ff7f3a2934621b0fc8cd2d39c2ec1824 Mon Sep 17 00:00:00 2001 From: Asartea <76259120+Asartea@users.noreply.github.com> Date: Sat, 12 Nov 2022 20:59:52 +0100 Subject: [PATCH 2/3] Missed README.md --- 07_tempConversion/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/07_tempConversion/README.md b/07_tempConversion/README.md index 081a650..77682f6 100644 --- a/07_tempConversion/README.md +++ b/07_tempConversion/README.md @@ -2,12 +2,12 @@ Write two functions that convert temperatures from Fahrenheit to Celsius, and vice versa: ``` -ftoc(32) // fahrenheit to celsius, should return 0 +convertToCelsius(32) // fahrenheit to celsius, should return 0 -ctof(0) // celsius to fahrenheit, should return 32 +convertToFahrenheit(0) // celsius to fahrenheit, should return 32 ``` -Because we are human, we want the result temperature to be rounded to one decimal place: i.e., `ftoc(100)` should return `37.8` and not `37.77777777777778`. +Because we are human, we want the result temperature to be rounded to one decimal place: i.e., `convertToCelsius(100)` should return `37.8` and not `37.77777777777778`. This exercise asks you to create more than one function so the `module.exports` section of the spec file looks a little different this time. Nothing to worry about, we're just packaging both functions into a single object to be exported. From 9214f20afdc463905111e3d0d4a843b0d80d83c8 Mon Sep 17 00:00:00 2001 From: Asartea <76259120+Asartea@users.noreply.github.com> Date: Sat, 12 Nov 2022 21:07:47 +0100 Subject: [PATCH 3/3] restore initial test state --- 07_tempConversion/tempConversion.spec.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/07_tempConversion/tempConversion.spec.js b/07_tempConversion/tempConversion.spec.js index 7d0cc93..c4f9742 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('rounds to 1 decimal', () => { + test.skip('rounds to 1 decimal', () => { expect(convertToCelsius(100)).toEqual(37.8); }); - test('works with negatives', () => { + test.skip('works with negatives', () => { expect(convertToCelsius(-100)).toEqual(-73.3); }); }); describe('convertToFahrenheit', () => { - test('works', () => { + test.skip('works', () => { expect(convertToFahrenheit(0)).toEqual(32); }); - test('rounds to 1 decimal', () => { + test.skip('rounds to 1 decimal', () => { expect(convertToFahrenheit(73.2)).toEqual(163.8); }); - test('works with negatives', () => { + test.skip('works with negatives', () => { expect(convertToFahrenheit(-10)).toEqual(14); }); });