Skip to content

Commit 8746ce0

Browse files
Merge pull request TheOdinProject#299 from Asartea/asartea-patch-1
07_tempConversion: Update tempConversion function's naming
2 parents a05d4d6 + 9214f20 commit 8746ce0

File tree

3 files changed

+16
-18
lines changed

3 files changed

+16
-18
lines changed

07_tempConversion/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
Write two functions that convert temperatures from Fahrenheit to Celsius, and vice versa:
44
```
5-
ftoc(32) // fahrenheit to celsius, should return 0
5+
convertToCelsius(32) // fahrenheit to celsius, should return 0
66
7-
ctof(0) // celsius to fahrenheit, should return 32
7+
convertToFahrenheit(0) // celsius to fahrenheit, should return 32
88
```
99

10-
Because we are human, we want the result temperature to be rounded to one decimal place: i.e., `ftoc(100)` should return `37.8` and not `37.77777777777778`.
10+
Because we are human, we want the result temperature to be rounded to one decimal place: i.e., `convertToCelsius(100)` should return `37.8` and not `37.77777777777778`.
1111

1212
This exercise asks you to create more than one function so the `module.exports` section of the spec file looks a little different this time. Nothing to worry about, we're just packaging both functions into a single object to be exported.
1313

07_tempConversion/tempConversion.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
const ftoc = function() {
2-
1+
const convertToCelsius = function() {
32
};
43

5-
const ctof = function() {
6-
4+
const convertToFahrenheit = function() {
75
};
86

97
// Do not edit below this line
108
module.exports = {
11-
ftoc,
12-
ctof
9+
convertToCelsius,
10+
convertToFahrenheit
1311
};
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
const {ftoc, ctof} = require('./tempConversion')
1+
const {convertToCelsius, convertToFahrenheit} = require('./tempConversion')
22

3-
describe('ftoc', () => {
3+
describe('convertToCelsius', () => {
44
test('works', () => {
5-
expect(ftoc(32)).toEqual(0);
5+
expect(convertToCelsius(32)).toEqual(0);
66
});
77
test.skip('rounds to 1 decimal', () => {
8-
expect(ftoc(100)).toEqual(37.8);
8+
expect(convertToCelsius(100)).toEqual(37.8);
99
});
1010
test.skip('works with negatives', () => {
11-
expect(ftoc(-100)).toEqual(-73.3);
11+
expect(convertToCelsius(-100)).toEqual(-73.3);
1212
});
1313
});
1414

15-
describe('ctof', () => {
15+
describe('convertToFahrenheit', () => {
1616
test.skip('works', () => {
17-
expect(ctof(0)).toEqual(32);
17+
expect(convertToFahrenheit(0)).toEqual(32);
1818
});
1919
test.skip('rounds to 1 decimal', () => {
20-
expect(ctof(73.2)).toEqual(163.8);
20+
expect(convertToFahrenheit(73.2)).toEqual(163.8);
2121
});
2222
test.skip('works with negatives', () => {
23-
expect(ctof(-10)).toEqual(14);
23+
expect(convertToFahrenheit(-10)).toEqual(14);
2424
});
2525
});

0 commit comments

Comments
 (0)