diff --git a/tempConversion/.tempConversion.js.swp b/tempConversion/.tempConversion.js.swp new file mode 100644 index 0000000..9318635 Binary files /dev/null and b/tempConversion/.tempConversion.js.swp differ diff --git a/tempConversion/.tempConversion.spec.js.swp b/tempConversion/.tempConversion.spec.js.swp new file mode 100644 index 0000000..52956d9 Binary files /dev/null and b/tempConversion/.tempConversion.spec.js.swp differ diff --git a/tempConversion/tempConversion.js b/tempConversion/tempConversion.js index 969c37e..742d8e2 100644 --- a/tempConversion/tempConversion.js +++ b/tempConversion/tempConversion.js @@ -1,9 +1,9 @@ -var ftoc = function() { - +var ftoc = function(f) { + return Math.round((f - 32) * (5/9) * 10) / 10 } -var ctof = function() { - +var ctof = function(c) { + return Math.round(((c * 9/5) + 32) * 10) / 10 } module.exports = { diff --git a/tempConversion/tempConversion.spec.js b/tempConversion/tempConversion.spec.js index 6f69a7e..b2961c2 100644 --- a/tempConversion/tempConversion.spec.js +++ b/tempConversion/tempConversion.spec.js @@ -4,22 +4,22 @@ describe('ftoc', function() { it('works', function() { expect(ftoc(32)).toEqual(0); }); - xit('rounds to 1 decimal', function() { + it('rounds to 1 decimal', function() { expect(ftoc(100)).toEqual(37.8); }); - xit('works with negatives', function() { + it('works with negatives', function() { expect(ftoc(-100)).toEqual(-73.3); }); }); describe('ctof', function() { - xit('works', function() { + it('works', function() { expect(ctof(0)).toEqual(32); }); - xit('rounds to 1 decimal', function() { + it('rounds to 1 decimal', function() { expect(ctof(73.2)).toEqual(163.8); }); - xit('works with negatives', function() { + it('works with negatives', function() { expect(ctof(-10)).toEqual(14); }); });