Merge pull request #19 from EBoisseauSierra/rewording-instructions
Rewording instructions
This commit is contained in:
commit
29bd246dad
33 changed files with 57 additions and 50 deletions
|
@ -1,4 +1,4 @@
|
||||||
var caesar = function() {
|
const caesar = function() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var caesar = require('./caesar')
|
const caesar = require('./caesar')
|
||||||
|
|
||||||
describe('caesar', function() {
|
describe('caesar', function() {
|
||||||
it('works with single letters', function() {
|
it('works with single letters', function() {
|
||||||
|
@ -19,4 +19,7 @@ describe('caesar', function() {
|
||||||
xit('works with large shift factors', function() {
|
xit('works with large shift factors', function() {
|
||||||
expect(caesar('Hello, World!', 75)).toEqual('Ebiil, Tloia!');
|
expect(caesar('Hello, World!', 75)).toEqual('Ebiil, Tloia!');
|
||||||
});
|
});
|
||||||
|
xit('works with large negative shift factors', function() {
|
||||||
|
expect(caesar('Hello, World!', -29)).toEqual('Ebiil, Tloia!');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var calculator = require ('./calculator.js');
|
const calculator = require ('./calculator.js');
|
||||||
|
|
||||||
describe('add', function() {
|
describe('add', function() {
|
||||||
it('adds 0 and 0', function() {
|
it('adds 0 and 0', function() {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var fibonacci = function() {
|
const fibonacci = function() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var fibonacci = require('./fibonacci')
|
const fibonacci = require('./fibonacci')
|
||||||
|
|
||||||
describe('fibonacci', function() {
|
describe('fibonacci', function() {
|
||||||
it('works', function() {
|
it('works', function() {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var <%= title %> = function() {
|
let <%= title %> = function() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var <%= title %> = require('./<%=title%>')
|
let <%= title %> = require('./<%=title%>')
|
||||||
|
|
||||||
describe('<%=title%>', function() {
|
describe('<%=title%>', function() {
|
||||||
it('EDITME', function() {
|
it('EDITME', function() {
|
||||||
|
|
|
@ -10,7 +10,7 @@ This setup should be the same for all of the exercises. The plain javascript fi
|
||||||
|
|
||||||
Let's look at the spec file first:
|
Let's look at the spec file first:
|
||||||
```javascript
|
```javascript
|
||||||
var helloWorld = require('./helloWorld');
|
const helloWorld = require('./helloWorld');
|
||||||
|
|
||||||
describe('Hello World', function() {
|
describe('Hello World', function() {
|
||||||
it('says hello world', function() {
|
it('says hello world', function() {
|
||||||
|
@ -26,7 +26,7 @@ For now you do not need to worry about how to write tests, but you should try to
|
||||||
|
|
||||||
so let's look at the javascript file:
|
so let's look at the javascript file:
|
||||||
```javascript
|
```javascript
|
||||||
var helloWorld = function() {
|
const helloWorld = function() {
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ Just to make sure, in case you're confused at this point, the test is telling yo
|
||||||
|
|
||||||
this is what the final function should look like:
|
this is what the final function should look like:
|
||||||
```javascript
|
```javascript
|
||||||
var helloWorld = function() {
|
const helloWorld = function() {
|
||||||
return 'Hello, World!'
|
return 'Hello, World!'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var helloWorld = function() {
|
const helloWorld = function() {
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var helloWorld = require('./helloWorld');
|
const helloWorld = require('./helloWorld');
|
||||||
|
|
||||||
describe('Hello World', function() {
|
describe('Hello World', function() {
|
||||||
it('says hello world', function() {
|
it('says hello world', function() {
|
||||||
|
|
|
@ -10,5 +10,5 @@ leapYears(1985) // is not a leap year: returns false
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## hints
|
## Hints
|
||||||
- use an `if` statement and `&&` to make sure all the conditions are met properly
|
- use an `if` statement and `&&` to make sure all the conditions are met properly
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var leapYears = function() {
|
const leapYears = function() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var leapYears = require('./leapYears')
|
const leapYears = require('./leapYears')
|
||||||
|
|
||||||
describe('leapYears', function() {
|
describe('leapYears', function() {
|
||||||
it('works with non century years', function() {
|
it('works with non century years', function() {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var palindromes = function() {
|
const palindromes = function() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var palindromes = require('./palindromes')
|
const palindromes = require('./palindromes')
|
||||||
|
|
||||||
describe('palindromes', function() {
|
describe('palindromes', function() {
|
||||||
it('works with single words', function() {
|
it('works with single words', function() {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
// See https://en.wikipedia.org/wiki/Pig_Latin for more details.
|
// See https://en.wikipedia.org/wiki/Pig_Latin for more details.
|
||||||
|
|
||||||
var pigLatin = require("./pigLatin.js");
|
const pigLatin = require("./pigLatin.js");
|
||||||
|
|
||||||
describe('#translate', function() {
|
describe('#translate', function() {
|
||||||
it('translates a word beginning with a vowel', function() {
|
it('translates a word beginning with a vowel', function() {
|
||||||
|
|
|
@ -8,7 +8,7 @@ remove([1,2,3,4], 3) // should remove 3 and return [1,2,4]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## hints
|
## Hints
|
||||||
the first test on this one is fairly easy, but there are a few things to think about(or google) here for the later tests:
|
the first test on this one is fairly easy, but there are a few things to think about(or google) here for the later tests:
|
||||||
- how to remove a single element from an array
|
- how to remove a single element from an array
|
||||||
- how to deal with multiple optional arguments in a javascript function
|
- how to deal with multiple optional arguments in a javascript function
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var removeFromArray = function() {
|
const removeFromArray = function() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var removeFromArray = require('./removeFromArray')
|
const removeFromArray = require('./removeFromArray')
|
||||||
|
|
||||||
describe('removeFromArray', function() {
|
describe('removeFromArray', function() {
|
||||||
it('removes a single value', function() {
|
it('removes a single value', function() {
|
||||||
|
|
|
@ -6,12 +6,13 @@ Write a function that simply repeats the string a given number of times:
|
||||||
repeatString('hey', 3) // returns 'heyheyhey'
|
repeatString('hey', 3) // returns 'heyheyhey'
|
||||||
```
|
```
|
||||||
|
|
||||||
You will notice in this exercise that there are multiple tests, after making the first one pass, enable the others one by one by deleting the x in front of the it() function.
|
You will notice in this exercise that there are multiple tests (see in file `repeatString.spec.js`). Only the first test is currently enabled. So after making sure that this first one passes, enable the others one by one by deleting the `x` in front of the `it()` function.
|
||||||
|
|
||||||
|
|
||||||
## hints
|
## Hints
|
||||||
|
|
||||||
You're going to want to use a loop for this one.
|
- You're going to want to use a loop for this one.
|
||||||
|
|
||||||
Create a variable to hold the string you're going to return, create a loop that repeats the given number of times and add the given string to the result on each loop.
|
- Create a variable to hold the string you're going to return, create a loop that repeats the given number of times and add the given string to the result on each loop.
|
||||||
|
|
||||||
|
- If running `jasmine tempConversion/tempConversion.spec.js` raises `Temporarily disabled with xit` errors, make sure you have enabled the rest of the tests (see above).
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var repeatString = function() {
|
const repeatString = function() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var repeatString = require('./repeatString')
|
const repeatString = require('./repeatString')
|
||||||
|
|
||||||
describe('repeatString', function() {
|
describe('repeatString', function() {
|
||||||
it('repeats the string', function() {
|
it('repeats the string', function() {
|
||||||
|
|
|
@ -11,5 +11,5 @@ You will notice in this exercise that there are multiple tests, after making the
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## hints
|
## Hints
|
||||||
Strings in JavaScript cannot be reversed directly so you're going to have to split it into something else first.. do the reversal and then join it back together into a string.
|
Strings in JavaScript cannot be reversed directly so you're going to have to split it into something else first.. do the reversal and then join it back together into a string.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var reverseString = function() {
|
const reverseString = function() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var reverseString = require('./reverseString')
|
const reverseString = require('./reverseString')
|
||||||
|
|
||||||
describe('reverseString', function() {
|
describe('reverseString', function() {
|
||||||
it('reverses single word', function() {
|
it('reverses single word', function() {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var snakeCase = function() {
|
const snakeCase = function() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var snakeCase = require('./snakeCase')
|
const snakeCase = require('./snakeCase')
|
||||||
|
|
||||||
describe('snakeCase', function() {
|
describe('snakeCase', function() {
|
||||||
it('works with simple lowercased phrases', function() {
|
it('works with simple lowercased phrases', function() {
|
||||||
|
|
|
@ -7,7 +7,7 @@ sumAll(1, 4) // returns the sum of 1 + 2 + 3 + 4 which is 10
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## hints
|
## Hints
|
||||||
|
|
||||||
Think about how you would do this on pen and paper and then how you might translate that process into code:
|
Think about how you would do this on pen and paper and then how you might translate that process into code:
|
||||||
- create a variable to hold the final sum
|
- create a variable to hold the final sum
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var sumAll = function() {
|
const sumAll = function() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var sumAll = require('./sumAll')
|
const sumAll = require('./sumAll')
|
||||||
|
|
||||||
describe('sumAll', function() {
|
describe('sumAll', function() {
|
||||||
it('sums numbers within the range', function() {
|
it('sums numbers within the range', function() {
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
# Exercise 06 - tempConversion
|
# Exercise 06 - tempConversion
|
||||||
|
|
||||||
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.
|
Write two functions that convert temperatures from Fahrenheit to Celsius, and vice versa:
|
||||||
|
|
||||||
Write two functions that convert temperatures from Fahrenheit to Celsius (and the other way around):
|
|
||||||
```
|
```
|
||||||
ftoc(32) // fahrenheit to celsius, should return 0
|
ftoc(32) // fahrenheit to celsius, should return 0
|
||||||
|
|
||||||
ctof(0) // celsius to fahrenheit, should return 32
|
ctof(0) // celsius to fahrenheit, should return 32
|
||||||
```
|
```
|
||||||
|
|
||||||
|
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`.
|
||||||
|
|
||||||
## hints
|
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.
|
||||||
The math here is fairly straightforward.. just google the formula and implement it in the code
|
|
||||||
|
## Hints
|
||||||
|
- You can find the relevant formulae on [Wikipedia](https://en.wikipedia.org/wiki/Conversion_of_units_of_temperature).
|
||||||
|
|
||||||
|
- Try to find by yourself on the Internet how to round a number to 1 decimal place in JavaScript. If you struggle, have a look [here](https://stackoverflow.com/q/7342957/5433628).
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
var ftoc = function() {
|
const ftoc = function() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var ctof = function() {
|
const ctof = function() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var {ftoc, ctof} = require('./tempConversion')
|
const {ftoc, ctof} = require('./tempConversion')
|
||||||
|
|
||||||
describe('ftoc', function() {
|
describe('ftoc', function() {
|
||||||
it('works', function() {
|
it('works', function() {
|
||||||
|
|
Loading…
Reference in a new issue