Make 07 tests pass

This commit is contained in:
marleyrae 2023-06-19 16:36:59 -07:00
parent 339ecddd92
commit 6b4c26c0e7
2 changed files with 31 additions and 25 deletions

View file

@ -1,11 +1,17 @@
const convertToCelsius = function() { const round = function (number) {
}; return Math.round(number * 10) / 10
}
const convertToFahrenheit = function() { const convertToCelsius = function (F) {
}; return round((F - 32) * (5 / 9))
}
const convertToFahrenheit = function (C) {
return round((C * (9 / 5)) + 32)
}
// Do not edit below this line // Do not edit below this line
module.exports = { module.exports = {
convertToCelsius, convertToCelsius,
convertToFahrenheit convertToFahrenheit,
}; }

View file

@ -2,24 +2,24 @@ const {convertToCelsius, convertToFahrenheit} = require('./tempConversion')
describe('convertToCelsius', () => { describe('convertToCelsius', () => {
test('works', () => { test('works', () => {
expect(convertToCelsius(32)).toEqual(0); expect(convertToCelsius(32)).toEqual(0)
}); })
test.skip('rounds to 1 decimal', () => { test('rounds to 1 decimal', () => {
expect(convertToCelsius(100)).toEqual(37.8); expect(convertToCelsius(100)).toEqual(37.8)
}); })
test.skip('works with negatives', () => { test('works with negatives', () => {
expect(convertToCelsius(-100)).toEqual(-73.3); expect(convertToCelsius(-100)).toEqual(-73.3)
}); })
}); })
describe('convertToFahrenheit', () => { describe('convertToFahrenheit', () => {
test.skip('works', () => { test('works', () => {
expect(convertToFahrenheit(0)).toEqual(32); expect(convertToFahrenheit(0)).toEqual(32)
}); })
test.skip('rounds to 1 decimal', () => { test('rounds to 1 decimal', () => {
expect(convertToFahrenheit(73.2)).toEqual(163.8); expect(convertToFahrenheit(73.2)).toEqual(163.8)
}); })
test.skip('works with negatives', () => { test('works with negatives', () => {
expect(convertToFahrenheit(-10)).toEqual(14); expect(convertToFahrenheit(-10)).toEqual(14)
}); })
}); })