Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0c8f636

Browse files
committed
I have created a unit testing package for the Free Code Camp Basic Algorithms section. These are the passing tests. I am going to get through them first and then reWrite them to hold just the tests and no code.
1 parent73d4c05 commit0c8f636

File tree

309 files changed

+81001
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

309 files changed

+81001
-0
lines changed

‎celsius2Farhrenheit.js‎

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// The algorithm to convert from Celsius to Fahrenheit is the temperature in Celsius times 9 / 5, plus 32.
2+
3+
// You are given a variable celsius representing a temperature in Celsius.Use the variable fahrenheit already defined and assign it the Fahrenheit temperature equivalent to the given Celsius temperature.Use the algorithm mentioned above to help convert the Celsius temperature to Fahrenheit.
4+
5+
// Don't worry too much about the function and return statements as they will be covered in future challenges. For now, only use operators that you have already learned.
6+
7+
functioncelsiusToF(temp){
8+
return(temp*(9/5))+32;
9+
}
10+
11+
celsiusToF2=(temp)=>(temp*(9/5))+32;
12+
13+
require('mocha');
14+
constexpect=require('chai').expect;
15+
constlog=console.log;
16+
17+
describe('ES5 Unit Testing: Celsius To Fahrenheit',()=>{
18+
consttemps=[0,-30,-10,20,30]
19+
constconvertedTemps=[32,-22,-14,68,86]
20+
21+
consttests=temps.map((el,index)=>{
22+
return`it('should convert celsius to fahrenheit', () => {
23+
result = celsiusToF(${temps[index]});
24+
expect(result).to.equal(${convertedTemps[index]});
25+
});`;
26+
27+
})
28+
it('should convert celsius to fahrenheit',()=>{
29+
result=celsiusToF(temps[4]);
30+
expect(result).to.equal(86);
31+
});
32+
33+
it('should convert celsius to fahrenheit',()=>{
34+
result=celsiusToF(temps[0]);
35+
expect(result).to.equal(32);
36+
});
37+
38+
it('should convert celsius to fahrenheit',()=>{
39+
result=celsiusToF(temps[1]);
40+
expect(result).to.equal(-22);
41+
});
42+
43+
it('should convert celsius to fahrenheit',()=>{
44+
result=celsiusToF(temps[2]);
45+
expect(result).to.equal(14);
46+
});
47+
});
48+
describe('ES6 Unit Testing: Celsius To Fahrenheit',()=>{
49+
consttemps=[0,-30,-10,20,30]
50+
it('should convert celsius to fahrenheit',()=>{
51+
result=celsiusToF2(temps[4]);
52+
expect(result).to.equal(86);
53+
});
54+
55+
it('should convert celsius to fahrenheit',()=>{
56+
result=celsiusToF2(temps[0]);
57+
expect(result).to.equal(32);
58+
});
59+
60+
it('should convert celsius to fahrenheit',()=>{
61+
result=celsiusToF2(temps[1]);
62+
expect(result).to.equal(-22);
63+
});
64+
65+
it('should convert celsius to fahrenheit',()=>{
66+
result=celsiusToF2(temps[2]);
67+
expect(result).to.equal(14);
68+
});
69+
});

‎node_modules/.bin/_mocha‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎node_modules/.bin/he‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎node_modules/.bin/mkdirp‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎node_modules/.bin/mocha‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎node_modules/assertion-error/History.md‎

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎node_modules/assertion-error/README.md‎

Lines changed: 41 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎node_modules/assertion-error/index.d.ts‎

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎node_modules/assertion-error/index.js‎

Lines changed: 116 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎node_modules/assertion-error/package.json‎

Lines changed: 62 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp