diff --git a/code-challenges/challenges-01.test.js b/code-challenges/challenges-01.test.js
index 4e14a1f..999c37a 100644
--- a/code-challenges/challenges-01.test.js
+++ b/code-challenges/challenges-01.test.js
@@ -103,20 +103,20 @@ DO NOT CHANGE any of the below code.
Run your tests from the console: jest challenges-01.test.js
------------------------------------------------------------------------------------------------ */
-describe('Testing challenge 1', () => {
+xdescribe('Testing challenge 1', () => {
test('It should return the message with all uppercase characters', () => {
expect(speaker('hello 301 students!', greeting)).toStrictEqual('HELLO 301 STUDENTS!');
});
});
-describe('Testing challenge 2', () => {
+xdescribe('Testing challenge 2', () => {
test('It should add the number 8 to the array five times', () => {
expect(addNumbers(8, [], 5, addValues)).toStrictEqual([8, 8, 8, 8, 8]);
expect(addNumbers(8, [], 5, addValues).length).toStrictEqual(5);
});
});
-describe('Testing challenge 3', () => {
+xdescribe('Testing challenge 3', () => {
const inventory = [{ name: 'apples', available: true }, { name: 'pears', available: true }, { name: 'oranges', available: false }, { name: 'bananas', available: true }, { name: 'blueberries', available: false }];
test('It should only add the available items to the list', () => {
@@ -125,7 +125,7 @@ describe('Testing challenge 3', () => {
});
});
-describe('Testing challenge 4', () => {
+xdescribe('Testing challenge 4', () => {
const inputs = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
test('It should print out messages or numbers', () => {
diff --git a/code-challenges/challenges-05.test.js b/code-challenges/challenges-05.test.js
index 8ba0125..87185ba 100644
--- a/code-challenges/challenges-05.test.js
+++ b/code-challenges/challenges-05.test.js
@@ -296,7 +296,7 @@ Run your tests from the console: jest challenges-05.test.js
------------------------------------------------------------------------------------------------ */
-describe('Testing challenge 1', () => {
+xdescribe('Testing challenge 1', () => {
test('It should append the star wars people to the DOM', () => {
templateWithJQuery();
expect($('section:nth-child(2) h2').text()).toStrictEqual('Luke Skywalker');
@@ -305,7 +305,7 @@ describe('Testing challenge 1', () => {
})
});
-describe('Testing challenge 2', () => {
+xdescribe('Testing challenge 2', () => {
test('It should return a list of shortening words', () => {
expect(howMuchPencil('Welcome')).toStrictEqual(['Welcome', 'elcome', 'lcome', 'come', 'ome', 'me', 'e', '']);
expect(howMuchPencil('Welcome').length).toStrictEqual(8);
@@ -314,7 +314,7 @@ describe('Testing challenge 2', () => {
});
});
-describe('Testing challenge 3', () => {
+xdescribe('Testing challenge 3', () => {
test('It should return an array of individual letters', () => {
expect(wordsToCharList('Gregor')).toStrictEqual(['G', 'r', 'e', 'g', 'o', 'r']);
expect(wordsToCharList('Gregor').length).toStrictEqual(6);
@@ -323,7 +323,7 @@ describe('Testing challenge 3', () => {
});
});
-describe('Testing challenge 4', () => {
+xdescribe('Testing challenge 4', () => {
test('It should return a list of foods', () => {
expect(listFoods(gruffaloCrumble)).toStrictEqual(['Gruffalo', 'oats', 'brown sugar', 'flour', 'pure maple syrup', 'chopped nuts', 'baking soda', 'baking powder', 'cinnamon', 'melted butter', 'fresh water']);
expect(listFoods(gruffaloCrumble).length).toStrictEqual(11);
diff --git a/code-challenges/challenges-07.test.js b/code-challenges/challenges-07.test.js
new file mode 100644
index 0000000..8ae1bcf
--- /dev/null
+++ b/code-challenges/challenges-07.test.js
@@ -0,0 +1,293 @@
+'use strict';
+
+// to learn more about the cheerio library and what it is doing, look at their documentation: https://www.npmjs.com/package/cheerio
+const cheerio = require('cheerio');
+
+/* ------------------------------------------------------------------------------------------------
+CHALLENGE 1 - Review
+
+Write a function named addTea that uses jQuery to add tea to the shopping list.
+------------------------------------------------------------------------------------------------ */
+
+let $ = createSnippetWithJQuery(`
+
+ - apples
+ - bananas
+ - carrots
+ - beans
+ - coffee
+
+`);
+
+ // Solution code here...
+ const addTea = () => $('ul').append('tea')
+
+
+
+/* ------------------------------------------------------------------------------------------------
+CHALLENGE 2
+
+Write a function named forLoopTwoToThe that, given an array of integers as input, iterates over the array and returns a new array. The returned array should contain the result of raising 2 to the power of the original input element.
+
+You may choose to complete this challenge using a for loop, for...in syntax, or for...of syntax.
+
+For example, twoToThe([1,2,3]) returns [2,4,8] because 2 ^ 1 = 2, 2 ^ 2 = 4, and 2 ^ 3 = 8.
+------------------------------------------------------------------------------------------------ */
+
+const forLoopTwoToThe = (arr) => {
+ // Solution code here...
+ let returnarray = [];
+ for (let i=0; i< arr.length; i++) {
+ returnarray.push(Math.pow(2, arr[i]));
+ }
+ return returnarray;
+};
+
+/* ------------------------------------------------------------------------------------------------
+CHALLENGE 3
+
+Write a function named forEachTwoToThe that produces the same output as your forLoopTwoToThe function from challenge 1, but uses forEach instead of a for loop.
+------------------------------------------------------------------------------------------------ */
+
+const forEachTwoToThe = (arr) => {
+ // Solution code here...
+ let returnarray = [];
+ arr.forEach(value => {
+ returnarray.push(Math.pow(2, value))
+ })
+ return returnarray;
+};
+
+/* ------------------------------------------------------------------------------------------------
+CHALLENGE 4
+
+Write a function named mapTwoToThe that produces the same output as your forLoopTwoToThe function from challenge 1 and your forEachTwoToThe function from challenge 2, but uses map instead of a for loop or forEach.
+------------------------------------------------------------------------------------------------ */
+
+ // Solution code here...
+ const mapTwoToThe = (arr) => arr.map(value => Math.pow(2, value));
+
+
+
+/* ------------------------------------------------------------------------------------------------
+CHALLENGE 5 - Stretch Goal
+
+Write a function named charCode that, given an array of letters as an input, uses map to return a new array where each element is the result of the `charCodeAt` method on the original array element.
+
+Read the MDN documentation on String.charCodeAt() if necessary.
+
+For example: charCode(['h','i']) returns [104, 105].
+------------------------------------------------------------------------------------------------ */
+
+const charCode = (arr) => {
+ // Solution code here...
+};
+
+/* ------------------------------------------------------------------------------------------------
+CHALLENGE 6 - Stretch Goal
+
+Write a function that, given an array of numbers as input, uses map to return a new array where each element is either the string "even" or the string "odd", based on each value.
+
+If any element in the array is not a number, the resulting array should have the string "N/A" in its place.
+
+For example: evenOdd([1,2,3]) returns ['odd','even','odd'].
+------------------------------------------------------------------------------------------------ */
+
+const evenOdd = (arr) => {
+ // Solution code here...
+};
+
+/* ------------------------------------------------------------------------------------------------
+CHALLENGE 7 - Stretch Goal
+
+Use the snorlaxAbilities data, below, for this challenge.
+
+Write a function named extractAbilities that, given the array of abilities, uses map to create an array containing only the ability name.
+
+Note: Because this function is expecting the array of abilities, it will be invoked as:
+extractAbilities(snorlaxAbilities.abilities)
+------------------------------------------------------------------------------------------------ */
+
+const snorlaxAbilities = {
+ abilities: [
+ {
+ slot: 3,
+ is_hidden: true,
+ ability: {
+ url: 'https://pokeapi.co/api/v2/ability/82/',
+ name: 'gluttony',
+ },
+ },
+ {
+ slot: 2,
+ is_hidden: false,
+ ability: {
+ url: 'https://pokeapi.co/api/v2/ability/56/',
+ name: 'cute charm',
+ },
+ },
+ {
+ slot: 1,
+ is_hidden: false,
+ ability: {
+ url: 'https://pokeapi.co/api/v2/ability/17/',
+ name: 'immunity',
+ },
+ },
+ ],
+ name: 'snorlax',
+ weight: 4600,
+};
+
+const extractAbilities = (arr) => {
+ // Solution code here...
+};
+
+/* ------------------------------------------------------------------------------------------------
+CHALLENGE 8 - Stretch Goal
+
+Use the snorlaxStats data, below, for this challenge.
+
+Write a function named extractStats that, given an array of stats, uses map to return an array of objects containing the stat name and the total.
+
+The total should be the sum of the effort and the baseStat.
+
+Here is an example of a single array element: { name: 'speed', total: 35 }
+------------------------------------------------------------------------------------------------ */
+
+const snorlaxStats = {
+ stats: [
+ {
+ stat: {
+ url: 'https://pokeapi.co/api/v2/stat/6/',
+ name: 'speed',
+ },
+ effort: 5,
+ baseStat: 30,
+ },
+ {
+ stat: {
+ url: 'https://pokeapi.co/api/v2/stat/5/',
+ name: 'special-defense',
+ },
+ effort: 2,
+ baseStat: 110,
+ },
+ {
+ stat: {
+ url: 'https://pokeapi.co/api/v2/stat/4/',
+ name: 'special-attack',
+ },
+ effort: 9,
+ baseStat: 65,
+ },
+ ],
+ name: 'snorlax',
+ weight: 4600,
+};
+
+const extractStats = (arr) => {
+ // Solution code here...
+};
+
+/* ------------------------------------------------------------------------------------------------
+TESTS
+
+All the code below will verify that your functions are working to solve the challenges.
+
+DO NOT CHANGE any of the below code.
+
+Run your tests from the console: jest challenges-07.test.js
+
+------------------------------------------------------------------------------------------------ */
+
+describe('Testing challenge 1', () => {
+ test('It should add tea to the list', () => {
+ addTea();
+ expect($('li:nth-child(6)').text()).toStrictEqual('tea');
+ })
+});
+
+describe('Testing challenge 2', () => {
+ test('It should return two raised to the power of the integer', () => {
+ expect(forLoopTwoToThe([0, 4, 5])).toStrictEqual([1, 16, 32]);
+ expect(forLoopTwoToThe([0, 4, 5]).length).toStrictEqual(3);
+ });
+
+ test('It should return decimals if the integer is negative', () => {
+ expect(forLoopTwoToThe([-1, -2, -3])).toStrictEqual([0.5, 0.25, 0.125]);
+ });
+});
+
+describe('Testing challenge 3', () => {
+ test('It should return two raised to the power of the integer', () => {
+ expect(forEachTwoToThe([0, 4, 5])).toStrictEqual([1, 16, 32]);
+ expect(forEachTwoToThe([0, 4, 5]).length).toStrictEqual(3);
+ });
+
+ test('It should return decimals if the integer is negative', () => {
+ expect(forEachTwoToThe([-1, -2, -3])).toStrictEqual([0.5, 0.25, 0.125]);
+ });
+});
+
+describe('Testing challenge 4', () => {
+ test('It should return two raised to the power of the integer', () => {
+ expect(mapTwoToThe([0, 4, 5])).toStrictEqual([1, 16, 32]);
+ expect(mapTwoToThe([0, 4, 5]).length).toStrictEqual(3);
+ });
+
+ test('It should return decimals if the integer is negative', () => {
+ expect(mapTwoToThe([-1, -2, -3])).toStrictEqual([0.5, 0.25, 0.125]);
+ });
+});
+
+xdescribe('Testing challenge 5', () => {
+ test('It should return an array containing the character code for each letter', () => {
+ expect(charCode(['C', 'o', 'd', 'e', '3', '0', '1'])).toStrictEqual([ 67, 111, 100, 101, 51, 48, 49 ]);
+ expect(charCode(['C', 'o', 'd', 'e', '3', '0', '1']).length).toStrictEqual(7);
+ });
+});
+
+xdescribe('Testing challenge 6', () => {
+ test('It should return an array containing the keys from an object', () => {
+ expect(evenOdd([5, 8, 2, 6, 9, 13, 542, 541])).toStrictEqual([ 'odd', 'even', 'even', 'even', 'odd', 'odd', 'even', 'odd' ]);
+ expect(evenOdd([5, 8, 2, 6, 9, 13, 542, 541]).length).toStrictEqual(8);
+ });
+
+ test('It should work with all odd numbers', () => {
+ expect(evenOdd([1, 3, 5, 7, 9])).toStrictEqual([ 'odd', 'odd', 'odd', 'odd', 'odd' ]);
+ expect(evenOdd([1, 3, 5, 7, 9]).length).toStrictEqual(5);
+ });
+
+ test('It should work with all even numbers', () => {
+ expect(evenOdd([2, 4, 6, 8, 10])).toStrictEqual([ 'even', 'even', 'even', 'even', 'even' ]);
+ expect(evenOdd([2, 4, 6, 8, 10]).length).toStrictEqual(5);
+ });
+
+ test('It should return the string "N/A" if a non-number is included in the array', () => {
+ expect(evenOdd([5, 8, 2, 'hi'])).toStrictEqual([ 'odd', 'even', 'even', 'N/A' ]);
+ expect(evenOdd([5, 8, 2, 'hi']).length).toStrictEqual(4);
+ });
+});
+
+xdescribe('Testing challenge 7', () => {
+ test('It should return an array containing only the ability names', () => {
+ expect(extractAbilities(snorlaxAbilities.abilities)).toStrictEqual(['gluttony', 'cute charm', 'immunity']);
+ expect(extractAbilities(snorlaxAbilities.abilities).length).toStrictEqual(3);
+ });
+});
+
+xdescribe('Testing challenge 8', () => {
+ test('It should return an array containing objects with name and total values', () => {
+ expect(extractStats(snorlaxStats.stats)).toStrictEqual([
+ { name: 'speed', total: 35, },
+ { name: 'special-defense', total: 112, },
+ { name: 'special-attack', total: 74, },
+ ]);
+ expect(extractStats(snorlaxStats.stats).length).toStrictEqual(3);
+ });
+});
+
+function createSnippetWithJQuery(html){
+ return cheerio.load(html);
+};
diff --git a/code-challenges/challenges-08.test.js b/code-challenges/challenges-08.test.js
new file mode 100644
index 0000000..4fbb879
--- /dev/null
+++ b/code-challenges/challenges-08.test.js
@@ -0,0 +1,329 @@
+'use strict';
+
+/* ------------------------------------------------------------------------------------------------
+CHALLENGE 1 - Review
+
+Write a function named sayHello, that sends the message 'Hello from the back-end' when a user hits the `/hello` route.
+
+------------------------------------------------------------------------------------------------ */
+
+// Express sever here
+const createServer = () => {
+ const express=require('express');
+ const app=express();
+ app.get('/hello', sayHello);
+
+ var server = app.listen(3301, function () {
+ var port = server.address().port;
+ console.log('Example app listening at port', port);
+ });
+ return server;
+};
+
+
+function sayHello(request, response){
+ // Solution code here...
+ response.send('Hello from the back-end');
+
+}
+
+/* ------------------------------------------------------------------------------------------------
+CHALLENGE 2
+
+Write a function named oddValues that, given an array of integers as input, uses filter to return an array containing only the odd integers.
+
+For example, oddValues([1,2,3]) returns [1,3].
+------------------------------------------------------------------------------------------------ */
+
+const oddValues = (arr) => {
+ // Solution code here...
+ return arr.filter(value =>value %2 !== 0);
+
+};
+
+/* ------------------------------------------------------------------------------------------------
+CHALLENGE 3
+
+Write a function named filterStringsWithVowels that, given an array of strings as input, uses filter to return an array with only words that contain vowels.
+
+The callback function to filter should include or utilize a regular expression pattern.
+
+For example, filterStringsWithVowels('gregor','hound','xyz') returns ['gregor', 'hound'].
+------------------------------------------------------------------------------------------------ */
+
+
+const filterStringsWithVowels = (arr) => {
+ // Solution code here...
+ let regex = /[aeiou]/g;
+ return arr.filter(value => value.match(regex));
+};
+
+
+/* ------------------------------------------------------------------------------------------------
+CHALLENGE 4
+
+Write a function named notInFirstArray that, given two arrays as input, uses filter to return an array of all the elements in the second array that are not included in the first array.
+
+For example, notInFirstArray([1,2,3], [1,2,3,4]) returns [4].
+------------------------------------------------------------------------------------------------ */
+
+const notInFirstArray = (forbiddenValues, arr) => {
+ // Solution code here...
+ return arr.filter(value => !forbiddenValues.includes(value));
+
+};
+
+/* ------------------------------------------------------------------------------------------------
+CHALLENGE 5 - Stretch Goal
+
+Write a function named getBaseStatGreaterThan that, given the snorlaxData, below, and an integer as input, uses filter to return an array containing all stats with a baseStat greater than the integer.
+
+For example, getBaseStatGreaterThan(snorlaxData.stats, 50) will return an array containing the 'special-defense' and 'special-attack' objects.
+------------------------------------------------------------------------------------------------ */
+
+const snorlaxData = {
+ stats: [
+ {
+ stat: {
+ url: 'https://pokeapi.co/api/v2/stat/6/',
+ name: 'speed',
+ },
+ effort: 5,
+ baseStat: 30,
+ },
+ {
+ stat: {
+ url: 'https://pokeapi.co/api/v2/stat/5/',
+ name: 'special-defense',
+ },
+ effort: 2,
+ baseStat: 110,
+ },
+ {
+ stat: {
+ url: 'https://pokeapi.co/api/v2/stat/4/',
+ name: 'special-attack',
+ },
+ effort: 9,
+ baseStat: 65,
+ },
+ ],
+ name: 'snorlax',
+ weight: 4600,
+};
+
+const getBaseStatGreaterThan = (arr, minBaseStat) => {
+ // Solution code here...
+ return minBaseStat.filter(minBaseStat > arr)
+
+};
+
+/* ------------------------------------------------------------------------------------------------
+CHALLENGE 6 - Stretch Goal
+
+Write a function named getStatName that is an extension of your getBaseStatGreaterThan function from challenge 4. For this function, extend your solution from challenge 4 to only return the name of the stat, rather than the entire stat object.
+
+For example, getStatName(snorlaxData.stats, 50) will return ['special-defense', 'special-attack'].
+------------------------------------------------------------------------------------------------ */
+
+const getStatName = (arr, minBaseStat) => {
+ // Solution code here...
+};
+
+/* ------------------------------------------------------------------------------------------------
+CHALLENGE 7 - Stretch Goal
+
+Write a function named getCharactersWithoutChildren that, given the array of characters, below, uses filter to return an array of all characters without children.
+------------------------------------------------------------------------------------------------ */
+
+const characters = [
+ {
+ name: 'Eddard',
+ spouse: 'Catelyn',
+ children: ['Robb', 'Sansa', 'Arya', 'Bran', 'Rickon'],
+ house: 'Stark',
+ },
+ {
+ name: 'Jon',
+ spouse: 'Lysa',
+ children: ['Robin'],
+ house: 'Arryn',
+ },
+ {
+ name: 'Cersei',
+ spouse: 'Robert',
+ children: ['Joffrey', 'Myrcella', 'Tommen'],
+ house: 'Lannister',
+ },
+ {
+ name: 'Daenarys',
+ spouse: 'Khal Drogo',
+ children: ['Drogon', 'Rhaegal', 'Viserion'],
+ house: 'Targaryen',
+ },
+ {
+ name: 'Mace',
+ spouse: 'Alerie',
+ children: ['Margaery', 'Loras'],
+ house: 'Tyrell',
+ },
+ {
+ name: 'Sansa',
+ spouse: 'Tyrion',
+ house: 'Stark',
+ },
+ {
+ name: 'Jon',
+ spouse: null,
+ house: 'Snow',
+ },
+];
+
+const getCharactersWithoutChildren = (arr) => {
+ // Solution code here...
+};
+
+/* ------------------------------------------------------------------------------------------------
+CHALLENGE 8 - Stretch Goal
+
+Write a function named evenOddNumericValues that, given an array as input, uses filter to remove any non-numeric values, then uses map to generate a new array containing the string 'even' or 'odd', depending on the original value.
+
+For example: evenOddNumericValues(['Gregor', 2, 4, 1]) returns ['even', 'even', 'odd'].
+------------------------------------------------------------------------------------------------ */
+
+const evenOddNumericValues = (arr) => {
+ // Solution code here...
+};
+
+/* ------------------------------------------------------------------------------------------------
+TESTS
+
+All the code below will verify that your functions are working to solve the challenges.
+
+DO NOT CHANGE any of the below code.
+
+Run your tests from the console: jest challenges-08.test.js
+
+------------------------------------------------------------------------------------------------ */
+
+describe('Testing challenge 1', () => {
+
+ const request = require('supertest');
+
+ let server;
+
+ beforeEach(function () {
+ server = createServer();
+ });
+
+ afterEach(function () {
+ server.close();
+ });
+
+ test('responds to /hello', function testSlash(done) {
+ request(server)
+ .get('/hello')
+ .expect(200, done);
+ });
+ test('404 everything else', function testPath(done) {
+ request(server)
+ .get('/foo/bar')
+ .expect(404, done);
+ });
+});
+
+describe('Testing challenge 2', () => {
+ test('It should return an array containing only odd integers', () => {
+ expect(oddValues([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])).toStrictEqual([1, 3, 5, 7, 9]);
+ expect(oddValues([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]).length).toStrictEqual(5);
+ expect(oddValues([2,3,4,179])).toStrictEqual([3,179]);
+ expect(oddValues([2,4,6,8])).toStrictEqual([]);
+ });
+});
+
+describe('Testing challenge 3', () => {
+ test('It should return an array containing only words that have vowels', () => {
+ expect(filterStringsWithVowels(['gregor','hound','xyz'])).toStrictEqual(['gregor', 'hound']);
+ expect(filterStringsWithVowels(['gregor','hound','xyz']).length).toStrictEqual(2);
+ expect(filterStringsWithVowels(['a', 'b', 'cdefg'])).toStrictEqual(['a', 'cdefg']);
+ expect(filterStringsWithVowels(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', ''])).toStrictEqual(['a', 'e', 'i', 'o', 'u']);
+ });
+
+ test('It should not contain any words that do not contain vowels', () => {
+ expect(filterStringsWithVowels(['gregor','hound','xyz'])).not.toContain('xyz');
+ });
+});
+
+describe('Testing challenge 4', () => {
+ const firstNums = [1, 2, 3];
+ const secondNums = [1, 2, 3, 4];
+
+ const firstStrings = ['Demi', 'Gregor', 'Hound'];
+ const secondStrings = ['Gary', 'Charlotte', 'Demi', 'Gregor', 'Hound'];
+
+ test('It should return an array that includes any elements not in the first array', () => {
+ expect(notInFirstArray(firstNums, secondNums)).toStrictEqual([4]);
+ expect(notInFirstArray(firstNums, secondNums).length).toStrictEqual(1);
+ });
+
+ test('It should also work with an array of strings', () => {
+ expect(notInFirstArray(firstStrings, secondStrings)).toStrictEqual(['Gary', 'Charlotte']);
+ expect(notInFirstArray(firstStrings, secondStrings).length).toStrictEqual(2);
+ });
+
+ test('It should work with empty arrays', () => {
+ expect(notInFirstArray([], [])).toStrictEqual([]);
+ expect(notInFirstArray([], [1,2,3,4,5])).toStrictEqual([1,2,3,4,5]);
+ expect(notInFirstArray([1,2,3,4,5], [])).toStrictEqual([]);
+ });
+});
+
+xdescribe('Testing challenge 5', () => {
+ test('It should return an array containing the stats that are greater than the input', () => {
+ expect(getBaseStatGreaterThan(snorlaxData.stats, 75)).toStrictEqual([ { stat: { url: 'https://pokeapi.co/api/v2/stat/5/', name: 'special-defense' }, effort: 2, baseStat: 110 } ]);
+ expect(getBaseStatGreaterThan(snorlaxData.stats, 75).length).toStrictEqual(1);
+ expect(getBaseStatGreaterThan(snorlaxData.stats, 110)).toStrictEqual([]);
+ });
+ test('It should work for non-Snorlax data', () => {
+ expect(getBaseStatGreaterThan([{baseStat: 10}, {baseStat: -85}, {baseStat: 0}, {baseStat: -50}], -60)).toStrictEqual([{baseStat: 10}, {baseStat: 0}, {baseStat: -50}]);
+ });
+});
+
+xdescribe('Testing challenge 6', () => {
+ test('It should return the name of the stats that exceed that maximum', () => {
+ expect(getStatName(snorlaxData.stats, 50)).toStrictEqual([ 'special-defense', 'special-attack' ]);
+ expect(getStatName(snorlaxData.stats, 50).length).toStrictEqual(2);
+ });
+
+ test('It should return the name of the stats that exceed that maximum', () => {
+ expect(getStatName(snorlaxData.stats, 120)).toStrictEqual([]);
+ expect(getStatName(snorlaxData.stats, 120).length).toStrictEqual(0);
+ });
+
+ test('It should work for non-snorlax data', () => {
+ expect(getStatName([
+ {baseStat: 10, stat: {name: 'one'}},
+ {baseStat: -85, stat: {name: 'two'}},
+ {baseStat: 0, stat: {name: 'three'}},
+ {baseStat: -50, stat: {name: 'four'}}
+ ], -60)).toStrictEqual(['one', 'three', 'four']);
+ });
+});
+
+xdescribe('Testing challenge 7', () => {
+ test('It should return an array containing characters who do not have children', () => {
+ expect(getCharactersWithoutChildren(characters)).toStrictEqual([ { name: 'Sansa', spouse: 'Tyrion', house: 'Stark' }, { name: 'Jon', spouse: null, house: 'Snow' } ]);
+ expect(getCharactersWithoutChildren(characters).length).toStrictEqual(2);
+ });
+});
+
+xdescribe('Testing challenge 8', () => {
+ test('It should remove non-integers and return "even" or "odd', () => {
+ expect(evenOddNumericValues(['Gregor', 2, 4, 1])).toStrictEqual(['even', 'even', 'odd']);
+ expect(evenOddNumericValues(['Gregor', 2, 4, 1]).length).toStrictEqual(3);
+ expect(evenOddNumericValues(['a', 'b', 'c'])).toStrictEqual([]);
+ });
+ test('It should not accept strings that look like numbers', () => {
+ expect(evenOddNumericValues(['1', 2, 3, '4', 5,'6'])).toStrictEqual(['even', 'odd', 'odd']);
+ });
+});