Make 07 tests pass
This commit is contained in:
parent
339ecddd92
commit
6b4c26c0e7
2 changed files with 31 additions and 25 deletions
|
@ -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
|
||||
module.exports = {
|
||||
convertToCelsius,
|
||||
convertToFahrenheit
|
||||
};
|
||||
convertToFahrenheit,
|
||||
}
|
||||
|
|
|
@ -2,24 +2,24 @@ const {convertToCelsius, convertToFahrenheit} = require('./tempConversion')
|
|||
|
||||
describe('convertToCelsius', () => {
|
||||
test('works', () => {
|
||||
expect(convertToCelsius(32)).toEqual(0);
|
||||
});
|
||||
test.skip('rounds to 1 decimal', () => {
|
||||
expect(convertToCelsius(100)).toEqual(37.8);
|
||||
});
|
||||
test.skip('works with negatives', () => {
|
||||
expect(convertToCelsius(-100)).toEqual(-73.3);
|
||||
});
|
||||
});
|
||||
expect(convertToCelsius(32)).toEqual(0)
|
||||
})
|
||||
test('rounds to 1 decimal', () => {
|
||||
expect(convertToCelsius(100)).toEqual(37.8)
|
||||
})
|
||||
test('works with negatives', () => {
|
||||
expect(convertToCelsius(-100)).toEqual(-73.3)
|
||||
})
|
||||
})
|
||||
|
||||
describe('convertToFahrenheit', () => {
|
||||
test.skip('works', () => {
|
||||
expect(convertToFahrenheit(0)).toEqual(32);
|
||||
});
|
||||
test.skip('rounds to 1 decimal', () => {
|
||||
expect(convertToFahrenheit(73.2)).toEqual(163.8);
|
||||
});
|
||||
test.skip('works with negatives', () => {
|
||||
expect(convertToFahrenheit(-10)).toEqual(14);
|
||||
});
|
||||
});
|
||||
test('works', () => {
|
||||
expect(convertToFahrenheit(0)).toEqual(32)
|
||||
})
|
||||
test('rounds to 1 decimal', () => {
|
||||
expect(convertToFahrenheit(73.2)).toEqual(163.8)
|
||||
})
|
||||
test('works with negatives', () => {
|
||||
expect(convertToFahrenheit(-10)).toEqual(14)
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue