Merge 6583a7abf0
into a05d4d60c8
This commit is contained in:
commit
9339c108aa
|
@ -1,5 +1,5 @@
|
||||||
const helloWorld = function() {
|
const helloWorld = function() {
|
||||||
return ''
|
return 'Hello, World!'
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = helloWorld;
|
module.exports = helloWorld;
|
||||||
|
|
|
@ -10,7 +10,7 @@ This function will take two arguments, `string` and `num`.
|
||||||
|
|
||||||
*Note:* The exercises after this one will not have arguments provided as this one does - you will need to provide them yourself from now on. So read each exercise's README carefully to see what kinds of arguments will be expected.
|
*Note:* The exercises after this one will not have arguments provided as this one does - you will need to provide them yourself from now on. So read each exercise's README carefully to see what kinds of arguments will be expected.
|
||||||
|
|
||||||
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 `.skip` from the `test.skip()` 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 `` from the `test()` function.
|
||||||
|
|
||||||
|
|
||||||
## Hints
|
## Hints
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
const repeatString = function() {
|
const repeatString = function(string, num) {
|
||||||
|
if (num < 0) {
|
||||||
|
return "ERROR";
|
||||||
|
} else {
|
||||||
|
return string.repeat(num);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Do not edit below this line
|
// Do not edit below this line
|
||||||
|
|
|
@ -4,19 +4,19 @@ describe('repeatString', () => {
|
||||||
test('repeats the string', () => {
|
test('repeats the string', () => {
|
||||||
expect(repeatString('hey', 3)).toEqual('heyheyhey');
|
expect(repeatString('hey', 3)).toEqual('heyheyhey');
|
||||||
});
|
});
|
||||||
test.skip('repeats the string many times', () => {
|
test('repeats the string many times', () => {
|
||||||
expect(repeatString('hey', 10)).toEqual('heyheyheyheyheyheyheyheyheyhey');
|
expect(repeatString('hey', 10)).toEqual('heyheyheyheyheyheyheyheyheyhey');
|
||||||
});
|
});
|
||||||
test.skip('repeats the string 1 times', () => {
|
test('repeats the string 1 times', () => {
|
||||||
expect(repeatString('hey', 1)).toEqual('hey');
|
expect(repeatString('hey', 1)).toEqual('hey');
|
||||||
});
|
});
|
||||||
test.skip('repeats the string 0 times', () => {
|
test('repeats the string 0 times', () => {
|
||||||
expect(repeatString('hey', 0)).toEqual('');
|
expect(repeatString('hey', 0)).toEqual('');
|
||||||
});
|
});
|
||||||
test.skip('returns ERROR with negative numbers', () => {
|
test('returns ERROR with negative numbers', () => {
|
||||||
expect(repeatString('hey', -1)).toEqual('ERROR');
|
expect(repeatString('hey', -1)).toEqual('ERROR');
|
||||||
});
|
});
|
||||||
test.skip('repeats the string a random amount of times', function () {
|
test('repeats the string a random amount of times', function () {
|
||||||
/*The number is generated by using Math.random to get a value from between
|
/*The number is generated by using Math.random to get a value from between
|
||||||
0 to 1, when this is multiplied by 1000 and rounded down with Math.floor it
|
0 to 1, when this is multiplied by 1000 and rounded down with Math.floor it
|
||||||
equals a number between 0 to 999 (this number will change everytime you run
|
equals a number between 0 to 999 (this number will change everytime you run
|
||||||
|
@ -31,7 +31,7 @@ describe('repeatString', () => {
|
||||||
was randomly generated. */
|
was randomly generated. */
|
||||||
expect(repeatString('hey', number).match(/((hey))/g).length).toEqual(number);
|
expect(repeatString('hey', number).match(/((hey))/g).length).toEqual(number);
|
||||||
});
|
});
|
||||||
test.skip('works with blank strings', () => {
|
test('works with blank strings', () => {
|
||||||
expect(repeatString('', 10)).toEqual('');
|
expect(repeatString('', 10)).toEqual('');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,7 +6,7 @@ Pretty simple, write a function called `reverseString` that returns its input, r
|
||||||
reverseString('hello there') // returns 'ereht olleh'
|
reverseString('hello there') // returns 'ereht olleh'
|
||||||
```
|
```
|
||||||
|
|
||||||
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 `.skip` in front the `test.skip()` function.
|
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 `` in front the `test()` function.
|
||||||
|
|
||||||
## 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,5 +1,9 @@
|
||||||
const reverseString = function() {
|
const reverseString = function(string) {
|
||||||
|
//Convert String to Array
|
||||||
|
//Reverse Array
|
||||||
|
return string.split('').reverse().join('').toString();
|
||||||
|
|
||||||
|
//Join & Convert to String
|
||||||
};
|
};
|
||||||
|
|
||||||
// Do not edit below this line
|
// Do not edit below this line
|
||||||
|
|
|
@ -5,14 +5,14 @@ describe('reverseString', () => {
|
||||||
expect(reverseString('hello')).toEqual('olleh');
|
expect(reverseString('hello')).toEqual('olleh');
|
||||||
});
|
});
|
||||||
|
|
||||||
test.skip('reverses multiple words', () => {
|
test('reverses multiple words', () => {
|
||||||
expect(reverseString('hello there')).toEqual('ereht olleh')
|
expect(reverseString('hello there')).toEqual('ereht olleh')
|
||||||
})
|
})
|
||||||
|
|
||||||
test.skip('works with numbers and punctuation', () => {
|
test('works with numbers and punctuation', () => {
|
||||||
expect(reverseString('123! abc!')).toEqual('!cba !321')
|
expect(reverseString('123! abc!')).toEqual('!cba !321')
|
||||||
})
|
})
|
||||||
test.skip('works with blank strings', () => {
|
test('works with blank strings', () => {
|
||||||
expect(reverseString('')).toEqual('')
|
expect(reverseString('')).toEqual('')
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
const removeFromArray = function() {
|
const removeFromArray = function(list, ...remove) {
|
||||||
|
|
||||||
|
let result = list.filter(item => !remove.includes(item));
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -4,22 +4,22 @@ describe('removeFromArray', () => {
|
||||||
test('removes a single value', () => {
|
test('removes a single value', () => {
|
||||||
expect(removeFromArray([1, 2, 3, 4], 3)).toEqual([1, 2, 4]);
|
expect(removeFromArray([1, 2, 3, 4], 3)).toEqual([1, 2, 4]);
|
||||||
});
|
});
|
||||||
test.skip('removes multiple values', () => {
|
test('removes multiple values', () => {
|
||||||
expect(removeFromArray([1, 2, 3, 4], 3, 2)).toEqual([1, 4]);
|
expect(removeFromArray([1, 2, 3, 4], 3, 2)).toEqual([1, 4]);
|
||||||
});
|
});
|
||||||
test.skip('ignores non present values', () => {
|
test('ignores non present values', () => {
|
||||||
expect(removeFromArray([1, 2, 3, 4], 7, "tacos")).toEqual([1, 2, 3, 4]);
|
expect(removeFromArray([1, 2, 3, 4], 7, "tacos")).toEqual([1, 2, 3, 4]);
|
||||||
});
|
});
|
||||||
test.skip('ignores non present values, but still works', () => {
|
test('ignores non present values, but still works', () => {
|
||||||
expect(removeFromArray([1, 2, 3, 4], 7, 2)).toEqual([1, 3, 4]);
|
expect(removeFromArray([1, 2, 3, 4], 7, 2)).toEqual([1, 3, 4]);
|
||||||
});
|
});
|
||||||
test.skip('can remove all values', () => {
|
test('can remove all values', () => {
|
||||||
expect(removeFromArray([1, 2, 3, 4], 1, 2, 3, 4)).toEqual([]);
|
expect(removeFromArray([1, 2, 3, 4], 1, 2, 3, 4)).toEqual([]);
|
||||||
});
|
});
|
||||||
test.skip('works with strings', () => {
|
test('works with strings', () => {
|
||||||
expect(removeFromArray(["hey", 2, 3, "ho"], "hey", 3)).toEqual([2, "ho"]);
|
expect(removeFromArray(["hey", 2, 3, "ho"], "hey", 3)).toEqual([2, "ho"]);
|
||||||
});
|
});
|
||||||
test.skip('only removes same type', () => {
|
test('only removes same type', () => {
|
||||||
expect(removeFromArray([1, 2, 3], "1", 3)).toEqual([1, 2]);
|
expect(removeFromArray([1, 2, 3], "1", 3)).toEqual([1, 2]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,27 @@
|
||||||
const sumAll = function() {
|
const sumAll = function(num1, num2) {
|
||||||
|
let sum = 0;
|
||||||
|
let num1Type = typeof num1;
|
||||||
|
let num2Type = typeof num2;
|
||||||
|
|
||||||
|
//Ensures number is not negative
|
||||||
|
if (num1 < 0 || num2 < 0) {
|
||||||
|
return "ERROR";
|
||||||
|
//Ensures sum is a number
|
||||||
|
} else if (num1Type !== "number" || num2Type !== "number") {
|
||||||
|
return "ERROR";
|
||||||
|
//If the second number is smaller than the first number
|
||||||
|
} else if (num2 < num1) {
|
||||||
|
for (let i = num2; i <= num1; i++) {
|
||||||
|
sum += parseInt(i);
|
||||||
|
}
|
||||||
|
return sum;
|
||||||
|
//If the first number is larger than the second number
|
||||||
|
} else {
|
||||||
|
for (let i = num1; i <= num2; i++) {
|
||||||
|
sum += parseInt(i);
|
||||||
|
}
|
||||||
|
return sum;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Do not edit below this line
|
// Do not edit below this line
|
||||||
|
|
|
@ -4,19 +4,19 @@ describe('sumAll', () => {
|
||||||
test('sums numbers within the range', () => {
|
test('sums numbers within the range', () => {
|
||||||
expect(sumAll(1, 4)).toEqual(10);
|
expect(sumAll(1, 4)).toEqual(10);
|
||||||
});
|
});
|
||||||
test.skip('works with large numbers', () => {
|
test('works with large numbers', () => {
|
||||||
expect(sumAll(1, 4000)).toEqual(8002000);
|
expect(sumAll(1, 4000)).toEqual(8002000);
|
||||||
});
|
});
|
||||||
test.skip('works with larger number first', () => {
|
test('works with larger number first', () => {
|
||||||
expect(sumAll(123, 1)).toEqual(7626);
|
expect(sumAll(123, 1)).toEqual(7626);
|
||||||
});
|
});
|
||||||
test.skip('returns ERROR with negative numbers', () => {
|
test('returns ERROR with negative numbers', () => {
|
||||||
expect(sumAll(-10, 4)).toEqual('ERROR');
|
expect(sumAll(-10, 4)).toEqual('ERROR');
|
||||||
});
|
});
|
||||||
test.skip('returns ERROR with non-number parameters', () => {
|
test('returns ERROR with non-number parameters', () => {
|
||||||
expect(sumAll(10, "90")).toEqual('ERROR');
|
expect(sumAll(10, "90")).toEqual('ERROR');
|
||||||
});
|
});
|
||||||
test.skip('returns ERROR with non-number parameters', () => {
|
test('returns ERROR with non-number parameters', () => {
|
||||||
expect(sumAll(10, [90, 1])).toEqual('ERROR');
|
expect(sumAll(10, [90, 1])).toEqual('ERROR');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,14 @@
|
||||||
const leapYears = function() {
|
const leapYears = function(year) {
|
||||||
|
//if year is divisible by 100 && 400
|
||||||
|
//if year is divisible by 4
|
||||||
|
//else false
|
||||||
|
if (year % 100 === 0 && year % 400 === 0) {
|
||||||
|
return true;
|
||||||
|
} else if (year % 4 === 0 && year % 100 !== 0) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Do not edit below this line
|
// Do not edit below this line
|
||||||
|
|
|
@ -4,19 +4,19 @@ describe('leapYears', () => {
|
||||||
test('works with non century years', () => {
|
test('works with non century years', () => {
|
||||||
expect(leapYears(1996)).toBe(true);
|
expect(leapYears(1996)).toBe(true);
|
||||||
});
|
});
|
||||||
test.skip('works with non century years', () => {
|
test('works with non century years', () => {
|
||||||
expect(leapYears(1997)).toBe(false);
|
expect(leapYears(1997)).toBe(false);
|
||||||
});
|
});
|
||||||
test.skip('works with ridiculously futuristic non century years', () => {
|
test('works with ridiculously futuristic non century years', () => {
|
||||||
expect(leapYears(34992)).toBe(true);
|
expect(leapYears(34992)).toBe(true);
|
||||||
});
|
});
|
||||||
test.skip('works with century years', () => {
|
test('works with century years', () => {
|
||||||
expect(leapYears(1900)).toBe(false);
|
expect(leapYears(1900)).toBe(false);
|
||||||
});
|
});
|
||||||
test.skip('works with century years', () => {
|
test('works with century years', () => {
|
||||||
expect(leapYears(1600)).toBe(true);
|
expect(leapYears(1600)).toBe(true);
|
||||||
});
|
});
|
||||||
test.skip('works with century years', () => {
|
test('works with century years', () => {
|
||||||
expect(leapYears(700)).toBe(false);
|
expect(leapYears(700)).toBe(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
const ftoc = function() {
|
const ftoc = function(fnum) {
|
||||||
|
//formula to convert f to c
|
||||||
|
let cnum = (fnum - 32) * 5 / 9;
|
||||||
|
//round to one decimal
|
||||||
|
return Math.round(cnum * 10) / 10;
|
||||||
};
|
};
|
||||||
|
|
||||||
const ctof = function() {
|
const ctof = function(cnum) {
|
||||||
|
//formula to convert c to f
|
||||||
|
let fnum = (cnum * 9/5) + 32;
|
||||||
|
//round to one decimal
|
||||||
|
return Math.round(fnum * 10) / 10;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Do not edit below this line
|
// Do not edit below this line
|
||||||
|
|
|
@ -4,22 +4,22 @@ describe('ftoc', () => {
|
||||||
test('works', () => {
|
test('works', () => {
|
||||||
expect(ftoc(32)).toEqual(0);
|
expect(ftoc(32)).toEqual(0);
|
||||||
});
|
});
|
||||||
test.skip('rounds to 1 decimal', () => {
|
test('rounds to 1 decimal', () => {
|
||||||
expect(ftoc(100)).toEqual(37.8);
|
expect(ftoc(100)).toEqual(37.8);
|
||||||
});
|
});
|
||||||
test.skip('works with negatives', () => {
|
test('works with negatives', () => {
|
||||||
expect(ftoc(-100)).toEqual(-73.3);
|
expect(ftoc(-100)).toEqual(-73.3);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('ctof', () => {
|
describe('ctof', () => {
|
||||||
test.skip('works', () => {
|
test('works', () => {
|
||||||
expect(ctof(0)).toEqual(32);
|
expect(ctof(0)).toEqual(32);
|
||||||
});
|
});
|
||||||
test.skip('rounds to 1 decimal', () => {
|
test('rounds to 1 decimal', () => {
|
||||||
expect(ctof(73.2)).toEqual(163.8);
|
expect(ctof(73.2)).toEqual(163.8);
|
||||||
});
|
});
|
||||||
test.skip('works with negatives', () => {
|
test('works with negatives', () => {
|
||||||
expect(ctof(-10)).toEqual(14);
|
expect(ctof(-10)).toEqual(14);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,25 +1,64 @@
|
||||||
const add = function() {
|
const add = function(num1, num2) {
|
||||||
|
let total = num1 + num2;
|
||||||
|
return total;
|
||||||
};
|
};
|
||||||
|
|
||||||
const subtract = function() {
|
const subtract = function(num1, num2) {
|
||||||
|
let total = num1 - num2;
|
||||||
|
return total;
|
||||||
};
|
};
|
||||||
|
|
||||||
const sum = function() {
|
const sum = function(numList) {
|
||||||
|
let total = 0;
|
||||||
|
|
||||||
|
for (let i = 0; i < numList.length; i++) {
|
||||||
|
total += parseInt(numList[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return total;
|
||||||
};
|
};
|
||||||
|
|
||||||
const multiply = function() {
|
const multiply = function(numList) {
|
||||||
|
let total = 1;
|
||||||
|
|
||||||
|
for (let i = 0; i < numList.length; i++) {
|
||||||
|
total *= parseInt(numList[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return total;
|
||||||
};
|
};
|
||||||
|
|
||||||
const power = function() {
|
<<<<<<< HEAD
|
||||||
|
const power = function(num, power) {
|
||||||
|
//empty variable for total
|
||||||
|
let total = 1;
|
||||||
|
//for loop to repeat num by power
|
||||||
|
for (let i = 0; i < power; i++) {
|
||||||
|
//multiply each num with empty variable
|
||||||
|
total *= num;
|
||||||
|
}
|
||||||
|
return total;
|
||||||
|
=======
|
||||||
|
const power = function(num, pow) {
|
||||||
|
let total = 1;
|
||||||
|
|
||||||
|
for (i=0; i<pow; i++) {
|
||||||
|
total *= num;
|
||||||
|
}
|
||||||
|
|
||||||
|
return total;
|
||||||
|
>>>>>>> 0c51ad1a2bf2379e6c83b344ac96ac708d94db1a
|
||||||
};
|
};
|
||||||
|
|
||||||
const factorial = function() {
|
const factorial = function(num) {
|
||||||
|
//empty variable for total
|
||||||
|
let total = 1;
|
||||||
|
//for loop to continue until num is reached
|
||||||
|
for (let i = 1; i <= num; i++) {
|
||||||
|
//multiply total with the i variable, which starts at 1, and repeats until num
|
||||||
|
total *= i;
|
||||||
|
}
|
||||||
|
return total;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Do not edit below this line
|
// Do not edit below this line
|
||||||
|
|
|
@ -5,73 +5,73 @@ describe('add', () => {
|
||||||
expect(calculator.add(0,0)).toBe(0);
|
expect(calculator.add(0,0)).toBe(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
test.skip('adds 2 and 2', () => {
|
test('adds 2 and 2', () => {
|
||||||
expect(calculator.add(2,2)).toBe(4);
|
expect(calculator.add(2,2)).toBe(4);
|
||||||
});
|
});
|
||||||
|
|
||||||
test.skip('adds positive numbers', () => {
|
test('adds positive numbers', () => {
|
||||||
expect(calculator.add(2,6)).toBe(8);
|
expect(calculator.add(2,6)).toBe(8);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('subtract', () => {
|
describe('subtract', () => {
|
||||||
test.skip('subtracts numbers', () => {
|
test('subtracts numbers', () => {
|
||||||
expect(calculator.subtract(10,4)).toBe(6);
|
expect(calculator.subtract(10,4)).toBe(6);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('sum', () => {
|
describe('sum', () => {
|
||||||
test.skip('computes the sum of an empty array', () => {
|
test('computes the sum of an empty array', () => {
|
||||||
expect(calculator.sum([])).toBe(0);
|
expect(calculator.sum([])).toBe(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
test.skip('computes the sum of an array of one number', () => {
|
test('computes the sum of an array of one number', () => {
|
||||||
expect(calculator.sum([7])).toBe(7);
|
expect(calculator.sum([7])).toBe(7);
|
||||||
});
|
});
|
||||||
|
|
||||||
test.skip('computes the sum of an array of two numbers', () => {
|
test('computes the sum of an array of two numbers', () => {
|
||||||
expect(calculator.sum([7,11])).toBe(18);
|
expect(calculator.sum([7,11])).toBe(18);
|
||||||
});
|
});
|
||||||
|
|
||||||
test.skip('computes the sum of an array of many numbers', () => {
|
test('computes the sum of an array of many numbers', () => {
|
||||||
expect(calculator.sum([1,3,5,7,9])).toBe(25);
|
expect(calculator.sum([1,3,5,7,9])).toBe(25);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('multiply', () => {
|
describe('multiply', () => {
|
||||||
test.skip('multiplies two numbers', () => {
|
test('multiplies two numbers', () => {
|
||||||
expect(calculator.multiply([2,4])).toBe(8);
|
expect(calculator.multiply([2,4])).toBe(8);
|
||||||
});
|
});
|
||||||
|
|
||||||
test.skip('multiplies several numbers', () => {
|
test('multiplies several numbers', () => {
|
||||||
expect(calculator.multiply([2,4,6,8,10,12,14])).toBe(645120);
|
expect(calculator.multiply([2,4,6,8,10,12,14])).toBe(645120);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('power', () => {
|
describe('power', () => {
|
||||||
test.skip('raises one number to the power of another number', () => {
|
test('raises one number to the power of another number', () => {
|
||||||
expect(calculator.power(4,3)).toBe(64); // 4 to third power is 64
|
expect(calculator.power(4,3)).toBe(64); // 4 to third power is 64
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('factorial', () => {
|
describe('factorial', () => {
|
||||||
test.skip('computes the factorial of 0', () => {
|
test('computes the factorial of 0', () => {
|
||||||
expect(calculator.factorial(0)).toBe(1); // 0! = 1
|
expect(calculator.factorial(0)).toBe(1); // 0! = 1
|
||||||
});
|
});
|
||||||
|
|
||||||
test.skip('computes the factorial of 1', () => {
|
test('computes the factorial of 1', () => {
|
||||||
expect(calculator.factorial(1)).toBe(1);
|
expect(calculator.factorial(1)).toBe(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test.skip('computes the factorial of 2', () => {
|
test('computes the factorial of 2', () => {
|
||||||
expect(calculator.factorial(2)).toBe(2);
|
expect(calculator.factorial(2)).toBe(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
test.skip('computes the factorial of 5', () => {
|
test('computes the factorial of 5', () => {
|
||||||
expect(calculator.factorial(5)).toBe(120);
|
expect(calculator.factorial(5)).toBe(120);
|
||||||
});
|
});
|
||||||
|
|
||||||
test.skip('computes the factorial of 10', () => {
|
test('computes the factorial of 10', () => {
|
||||||
expect(calculator.factorial(10)).toBe(3628800);
|
expect(calculator.factorial(10)).toBe(3628800);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -14,11 +14,11 @@
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/TheOdinProject/javascript-exercises#readme",
|
"homepage": "https://github.com/TheOdinProject/javascript-exercises#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"jest": "^26.6.3",
|
|
||||||
"jest-cli": "^26.6.3",
|
|
||||||
"eslint": "^7.26.0",
|
"eslint": "^7.26.0",
|
||||||
"eslint-config-airbnb-base": "^14.2.1",
|
"eslint-config-airbnb-base": "^14.2.1",
|
||||||
"eslint-plugin-import": "^2.22.1"
|
"eslint-plugin-import": "^2.22.1",
|
||||||
|
"jest": "^26.6.3",
|
||||||
|
"jest-cli": "^26.6.3"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "jest"
|
"test": "jest"
|
||||||
|
|
Loading…
Reference in New Issue