diff --git a/tempConversion/tempConversion.js b/tempConversion/tempConversion.js index 4fa21ee..52519b5 100644 --- a/tempConversion/tempConversion.js +++ b/tempConversion/tempConversion.js @@ -1,12 +1,24 @@ -const ftoc = function() { +const ftoc = function(fValue) { + let result = 0.0; + + //Convert Farenheit to Celsius + result = Math.round(((fValue - 32) * 5 / 9) * 10) / 10; + + return result; } -const ctof = function() { +const ctof = function(cValue) { + let result = 0.0; + + //Convert Celsius to Farenheit + result = Math.round(((cValue * 9 / 5) + 32) * 10) / 10; + + return result; } module.exports = { - ftoc, - ctof -} + ftoc, + ctof +} \ No newline at end of file diff --git a/tempConversion/tempConversion.spec.js b/tempConversion/tempConversion.spec.js index 0dc9168..9a207fd 100644 --- a/tempConversion/tempConversion.spec.js +++ b/tempConversion/tempConversion.spec.js @@ -1,25 +1,25 @@ -const {ftoc, ctof} = require('./tempConversion') +const { ftoc, ctof } = require('./tempConversion') describe('ftoc', function() { - it('works', function() { - expect(ftoc(32)).toEqual(0); - }); - xit('rounds to 1 decimal', function() { - expect(ftoc(100)).toEqual(37.8); - }); - xit('works with negatives', function() { - expect(ftoc(-100)).toEqual(-73.3); - }); + it('works', function() { + expect(ftoc(32)).toEqual(0); + }); + it('rounds to 1 decimal', function() { + expect(ftoc(100)).toEqual(37.8); + }); + it('works with negatives', function() { + expect(ftoc(-100)).toEqual(-73.3); + }); }); describe('ctof', function() { - xit('works', function() { - expect(ctof(0)).toEqual(32); - }); - xit('rounds to 1 decimal', function() { - expect(ctof(73.2)).toEqual(163.8); - }); - xit('works with negatives', function() { - expect(ctof(-10)).toEqual(14); - }); -}); + it('works', function() { + expect(ctof(0)).toEqual(32); + }); + it('rounds to 1 decimal', function() { + expect(ctof(73.2)).toEqual(163.8); + }); + it('works with negatives', function() { + expect(ctof(-10)).toEqual(14); + }); +}); \ No newline at end of file