Passed tests 2 & 3 toCelsius from exercise 07
added Math.round essentially multiplying inside of round, and dividing out of it will increase the rounding decimal point
This commit is contained in:
		
							parent
							
								
									46732dbe89
								
							
						
					
					
						commit
						08d14383b0
					
				|  | @ -1,5 +1,5 @@ | |||
| const convertToCelsius = function(deg) { | ||||
|   return (deg - 32) * (5/9); | ||||
|   return Math.round((deg - 32) * (5/9) * 10) / 10; | ||||
| }; | ||||
| 
 | ||||
| const convertToFahrenheit = function() { | ||||
|  |  | |||
|  | @ -4,10 +4,10 @@ describe('convertToCelsius', () => { | |||
|   test('works', () => { | ||||
|     expect(convertToCelsius(32)).toEqual(0); | ||||
|   }); | ||||
|   test.skip('rounds to 1 decimal', () => { | ||||
|   test('rounds to 1 decimal', () => { | ||||
|     expect(convertToCelsius(100)).toEqual(37.8); | ||||
|   }); | ||||
|   test.skip('works with negatives', () => { | ||||
|   test('works with negatives', () => { | ||||
|     expect(convertToCelsius(-100)).toEqual(-73.3); | ||||
|   }); | ||||
| }); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue