8000 add tempConversion · micbarash/javascript-exercises@fc9725d · GitHub
[go: up one dir, main page]

Skip to content

Commit fc9725d

Browse files
committed
add tempConversion
1 parent fe087fd commit fc9725d

File tree

5 files changed

+46
-3
lines changed

5 files changed

+46
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.vscode

06-tempConversion/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Exercise 06 - tempConversion
2+
3+
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 the functions into an object to be exported.
4+
5+

06-tempConversion/tempConversion.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
var ftoc = function() {
2+
3+
}
4+
5+
var ctof = function() {
6+
7+
}
8+
9+
module.exports = {
10+
ftoc,
11+
ctof
12+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
var {ftoc, ctof} = require('./tempConversion')
2+
3+
describe('ftoc', function() {
4+
it('works', function() {
5+
expect(ftoc(32)).toEqual(0);
6+
});
7+
xit('rounds to 1 decimal', function() {
8+
expect(ftoc(100)).toEqual(37.8);
9+
});
10+
xit('works with negatives', function() {
11+
expect(ftoc(-100)).toEqual(-73.3);
12+
});
13+
xit('works', function() {
14+
expect(ctof()).toEqual('ctof');
15+
});
16+
});
17+
18+
describe('ctof', function() {
19+
xit('works', function() {
20+
expect(ctof(0)).toEqual(32);
21+
});
22+
xit('rounds to 1 decimal', function() {
23+
expect(ctof(73.2)).toEqual(163.8);
24+
});
25+
xit('works with negatives', function() {
26+
expect(ctof(-10)).toEqual(14);
27+
});
28+
});

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,11 @@ The first exercise, `helloWorld` will walk you through the process in more depth
1212

1313

1414
## planned exercises (in no particular order for the moment):
15-
1. calculate factorial
16-
1. temperature conversion
1715
1. book titles
1816
1. leap years
1917
1. Caesar Cipher
2018
1. Palindromes
2119
1. Pangrams
22-
1. sum numbers in range: sumAll(1,4) (sums all numbers between and including 1 and 4)
2320
1. pig latin
2421
1. fibonacci
2522
1. convert to snake case

0 commit comments

Comments
 (0)
0