File tree 2 files changed +10
-8
lines changed 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change 1
- const convertToCelsius = function ( ) {
1
+ const convertToCelsius = function ( temp ) {
2
+ return Math . round ( ( temp - 32 ) * ( 5 / 9 ) * 10 ) / 10 ;
2
3
} ;
3
4
4
- const convertToFahrenheit = function ( ) {
5
+ const convertToFahrenheit = function ( temp ) {
6
+ return Math . round ( ( temp * ( 9 / 5 ) + 32 ) * 10 ) / 10 ;
5
7
} ;
6
8
7
9
// Do not edit below this line
Original file line number Diff line number Diff line change 1
- const { convertToCelsius, convertToFahrenheit} = require ( './tempConversion' )
1
+ const { convertToCelsius, convertToFahrenheit } = require ( './tempConversion' )
2
2
3
3
describe ( 'convertToCelsius' , ( ) => {
4
4
test ( 'works' , ( ) => {
5
5
expect ( convertToCelsius ( 32 ) ) . toEqual ( 0 ) ;
6
6
} ) ;
7
- test . skip ( 'rounds to 1 decimal' , ( ) => {
7
+ test ( 'rounds to 1 decimal' , ( ) => {
8
8
expect ( convertToCelsius ( 100 ) ) . toEqual ( 37.8 ) ;
9
9
} ) ;
10
- test . skip ( 'works with negatives' , ( ) => {
10
+ test ( 'works with negatives' , ( ) => {
11
11
expect ( convertToCelsius ( - 100 ) ) . toEqual ( - 73.3 ) ;
12
12
} ) ;
13
13
} ) ;
14
14
15
15
describe ( 'convertToFahrenheit' , ( ) => {
16
- test . skip ( 'works' , ( ) => {
16
+ test ( 'works' , ( ) => {
17
17
expect ( convertToFahrenheit ( 0 ) ) . toEqual ( 32 ) ;
18
18
} ) ;
19
- test . skip ( 'rounds to 1 decimal' , ( ) => {
19
+ test ( 'rounds to 1 decimal' , ( ) => {
20
20
expect ( convertToFahrenheit ( 73.2 ) ) . toEqual ( 163.8 ) ;
21
21
} ) ;
22
- test . skip ( 'works with negatives' , ( ) => {
22
+ test ( 'works with negatives' , ( ) => {
23
23
expect ( convertToFahrenheit ( - 10 ) ) . toEqual ( 14 ) ;
24
24
} ) ;
25
25
} ) ;
You can’t perform that action at this time.
0 commit comments