diff --git a/code-challenges/challenges-03.test.js b/code-challenges/challenges-03.test.js deleted file mode 100644 index 36d6908..0000000 --- a/code-challenges/challenges-03.test.js +++ /dev/null @@ -1,515 +0,0 @@ -'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 changeAllClassNames that uses jQuery to select all each li and add a class of "fruit"; - ------------------------------------------------------------------------------------------------- */ -let $ = createSnippetWithJQuery(` - -`); - -const changeAllClassNames = () => { - // Solution code here... - $('li').addClass('fruit'); - -}; - -/* ------------------------------------------------------------------------------------------------ -CHALLENGE 2 - -Write a function named sortBackwards that takes in an array of numbers and returns the same array, with the numbers sorted, highest to smallest. ------------------------------------------------------------------------------------------------- */ - -const sortBackwards = (arr) => { - // Solution code here... - arr.sort((a, b) =>{ - return (b-a); - }); - return arr; -}; - -/* ------------------------------------------------------------------------------------------------ -CHALLENGE 3 - -Write a function named alphabetize that takes in an array of strings and returns the same array with the strings sorted alphabetically. - -In this alphabetization, capital letters come before lower case letters. - -For example, ['Alphabet', 'Zebra', 'alphabet', 'carrot'] is correctly sorted. ------------------------------------------------------------------------------------------------- */ - -const alphabetize = (arr) => { - // Solution code here... - arr.sort((a, b) =>{ - if(a > b){ - return 1; - }else if (a < b){ - return ; - } - }); - return arr; -}; - -/* ------------------------------------------------------------------------------------------------ -CHALLENGE 4 - -Write a function named sortByLength that takes in an array of strings and returns the same array, with the strings sorted by their length, lowest to highest. ------------------------------------------------------------------------------------------------- */ - -const sortByLength = (arr) => { - // Solution code here... - arr.sort((a, b) => { - return a.length - b.length - }) - return arr; -}; - - -/* ------------------------------------------------------------------------------------------------ -CHALLENGE 5 - Stretch Goal - -Write a function named alphabetizeBetter that takes in an array of strings and returns the same array, with the strings sorted alphabetically. Capitalization should not change the sort order of two strings. - -For example, ['Alphabet', 'alphabet', 'carrot', 'Zebra'] is correctly sorted, and so is ['alphabet', 'Alphabet', 'carrot', 'Zebra']. ------------------------------------------------------------------------------------------------- */ - -const alphabetizeBetter = (arr) => { - // Solution code here... - arr.sort((a, b) => { - if (a.toLowerCase() < b.toLowerCase()) { - return -1; - } else if (a.toLowerCase() > b.toLowerCase()) { - return 1; - } else { - return 0; - } - }); - - return arr; -}; - -/* ------------------------------------------------------------------------------------------------ -CHALLENGE 6 - Stretch Goal - -Write a function named sortByPrice that takes in an array of objects, each of which has a 'price' property, and sorts those objects by price, lowest to highest, returning the same array. - -Here is an example of the input: -[ - {name: 'Sweatshirt', price: 45}, - {name: 'Bookmark', price: 2.50}, - {name: 'Tote bag', price: 15} -]; ------------------------------------------------------------------------------------------------- */ - -const sortByPrice = (arr) => { - // Solution code here... - arr.sort((a, b) => { - if (a.price < b.price) { - return -1; - } else if (a.price > b.price) { - return 1; - } else { - return 0; - } - }); - - return arr; -}; - -/* ------------------------------------------------------------------------------------------------ -CHALLENGE 7 - Stretch Goal - -Write a function named sortNumbersByLength that takes in an array of numbers and sorts those numbers by their length. - -For example, [1, 14, 0.2, -281, 54782] is only correctly sorted in that order. ------------------------------------------------------------------------------------------------- */ - -const sortNumbersByLength = (arr) => { - // Solution code here... - arr.sort((a, b) =>{ - return a.length > b.length ? 1 : -1; - }) -}; - -/*----------------------------------------------------------------------------------------------- -CHALLENGE 8 - Stretch Goal - -Write a function named sortPeople that takes in an array of Person objects, each of which has firstName, lastName, and age properties, and sorts those people by their last names. Do not worry about capitalization or first names. ------------------------------------------------------------------------------------------------- */ - -function Person(firstName, lastName, age) { - this.firstName = firstName; - this.lastName = lastName; - this.age = age; -} - -const people = [ - new Person('Wes', 'Washington', 25), - new Person('Casey', 'Codefellow', 38), - new Person('Stan', 'Seattle', 67), -]; - -const sortPeople = (arr) => { - // Solution code here... - people.sort((a, b) => { - return a.name > b.name ? 1 : -1; - }) -}; - -/* ------------------------------------------------------------------------------------------------ -CHALLENGE 9 - Stretch Goal - -Write a function named sortPeopleBetter that takes in an array of Person objects, each of which has firstName, lastName, and age properties, and sorts those people by their last names. - -If two people share the same last name, alphabetize on their first name. - -If two people have the same full name, the younger one should come first. Do not worry about capitalization. ------------------------------------------------------------------------------------------------- */ - -const sortPeopleBetter = (arr) => { - // Solution code here... - arr.sort((a, b) => { - if (a.lastName < b.lastName) { - return -1; - } else if (a.lastName > b.lastName) { - return 1; - } else if (a.lastName === b.lastName) { - if (a.firstName < b.firstName) { - return -1; - } else if (a.firstName > b.firstName) { - return 1; - } else if (a.firstName === b.firstName) { - if (a.age < b.age) { - return -1; - } else if (a.age > b.age) { - return 1; - } - else { - return 0; - } - } - } - }); - - return arr; -}; - -/* ------------------------------------------------------------------------------------------------ -CHALLENGE 10 - Stretch Goal - -Write a function named sortMeetingsByDay that takes in an array of objects, each of which represents a meeting happening a particular day of the week, with a particular start time and end time. - -Sort the meetings by the day on which they happen, Monday-Friday. It does not matter which order meetings come in on a particular day. For example, if there are two meetings on Monday, it does not matter which comes first. ------------------------------------------------------------------------------------------------- */ - -function Meeting(dayOfWeek, start, end) { - this.dayOfWeek = dayOfWeek; - this.start = start; - this.end = end; -} -const meetings = [ - new Meeting('Monday', '0900', '1000'), - new Meeting('Wednesday', '1300', '1500'), - new Meeting('Tuesday', '1145', '1315'), - new Meeting('Wednesday', '0930', '1000'), - new Meeting('Monday', '0900', '0945'), - new Meeting('Friday', '1200', '1345'), -]; - -const sortMeetingsByDay = (arr) => { - // Solution code here... - function checkWeekDay(day1, day2) { - - // array to reference order of weekdays - let weekdays = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday']; - - // iterating over weekdays - for (let i = 0; i < weekdays.length; i++) { - - // set current index equal to day1 - if (day1 === weekdays[i]) { - - // iterate again over weekdays - for (let j = 0; j < weekdays.length; j++) { - - // set current index equal to day2 - if (day2 === weekdays[j]) { - - // compare each index once days are referenced against array to check for the days' order - if (i < j) { - return -1; - } - else if (i > j) { - return 1; - } - else { - return 0; - } - } - } - } - } - } - // given a and b days of the week, - arr.sort((a, b) => { - // do this function that checks: - return checkWeekDay(a.dayOfWeek, b.dayOfWeek); - // if a comes before b in the week, - // do not switch the items, - // else if a comes after b in the week, - // switch the items, - // else (if a is b in the week), - // do not switch the items - }); - - return arr; -}; - -/* ------------------------------------------------------------------------------------------------ -CHALLENGE 11 - Stretch Goal - -This challenge should use the array of meetings from challenge 9, above. - -Sort the meetings in the order that they start. If two meetings start at the same time on the same day, the shorter meeting should come first. - -You DO NOT need to use your solution to Challenge 9 in completing Challenge 10. ------------------------------------------------------------------------------------------------- */ - -const sortSchedule = (arr) => { - // Solution code here... - function sortWeekDay(day1, day2) { - - // array to reference order of weekdays - let weekdays = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday']; - - // iterating over weekdays - for (let i = 0; i < weekdays.length; i++) { - - // set current index equal to day1 - if (day1 === weekdays[i]) { - - // iterate again over weekdays - for (let j = 0; j < weekdays.length; j++) { - - // set current index equal to day2 - if (day2 === weekdays[j]) { - - // compare each index once days are referenced against array to check for the days' order - if (i < j) { - return -1; - } - else if (i > j) { - return 1; - } - else { - return 0; - } - } - } - } - } - } - - function sortTiming(weekDaysSorted) { - weekDaysSorted.sort((a, b) => { - if (a.start < b.start) { - return -1; - } else if (a.start > b.start) { - return 1; - } else if (a.start === b.start) { - if ((a.end - a.start) < (b.end - b.start)) { - return -1; - } else if ((a.end - a.start) > (b.end - b.start)) { - return 1; - } else { - return 0; - } - } - }); - } - - let sortedWeekDays = arr.sort((a, b) => { - return sortWeekDay(a.dayOfWeek, b.dayOfWeek); - }); - - arr = sortTiming(sortedWeekDays); - - return arr; - -}; - -/* ------------------------------------------------------------------------------------------------ -CHALLENGE 12 - Stretch Goal - -Without altering the html, write a function named addPearClass that uses jQuery to add a class of "pear" to the third li. ------------------------------------------------------------------------------------------------- */ -$ = createSnippetWithJQuery(` - -`); - -const addPearClass = () => { - // 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-03.test.js ------------------------------------------------------------------------------------------------- */ - - -describe('Testing challenge 1', () => { - test('It should add a class of fruit to all the list items', () => { - changeAllClassNames(); - - expect($('li.apple').hasClass('fruit')).toBe(true); - expect($('li.orange').hasClass('fruit')).toBe(true); - }); -}); - -describe('Testing challenge 2', () => { - test('It should sort high-to-low the numbers in an array', () => { - const nums = [3,4,5,6,7]; - expect(sortBackwards(nums)).toStrictEqual([7,6,5,4,3]); - expect(sortBackwards([3,2,1])).toStrictEqual([3,2,1]); - expect(sortBackwards([12,20,3])).toStrictEqual([20, 12, 3]); - expect(sortBackwards([])).toStrictEqual([]); - expect(sortBackwards([1])).toStrictEqual([1]); - }); -}); - -describe('Testing challenge 3', () => { - test('It should sort strings alphabetically', () => { - expect(alphabetize(['alphabet', 'Zebra', 'Alphabet', 'carrot'])).toStrictEqual([ 'Alphabet', 'Zebra', 'alphabet', 'carrot']); - expect(alphabetize(['alphabet','Alphabet', 'carrot'])).toStrictEqual([ 'Alphabet', 'alphabet', 'carrot']); - expect(alphabetize([])).toStrictEqual([]); - }); -}); - -describe('Testing challenge 4', () => { - test('It should sort strings by length', () => { - const ans = sortByLength(['alphabet', 'Zebra', 'Alphabet', 'carrot']); - expect(ans.slice(0,2)).toStrictEqual(['Zebra', 'carrot']); - expect(ans.slice(2,4)).toEqual(expect.arrayContaining(['Alphabet', 'alphabet'])); - expect(sortByLength(['a', 'bc', ''])).toStrictEqual(['', 'a', 'bc']); - expect(sortByLength(['a'])).toStrictEqual(['a']); - expect(sortByLength([])).toStrictEqual([]); - }); -}); - -describe('Testing challenge 5', () => { - test('It should alphabetize without regard to capitalization', () => { - expect(alphabetizeBetter(['Alice', 'apple', 'alert', 'Average'])).toStrictEqual([ 'alert', 'Alice', 'apple', 'Average' ]); - const ans = alphabetizeBetter(['alphabet', 'Zebra', 'Alphabet', 'carrot']); - expect(ans.slice(0,2)).toEqual(expect.arrayContaining([ 'Alphabet','alphabet'])); - expect(ans.slice(2)).toStrictEqual(['carrot', 'Zebra']); - }); -}); - -describe('Testing challenge 6', () => { - test('It should sort items by their price', () => { - expect(sortByPrice([ - {name: 'Sweatshirt', price: 45}, - {name: 'Bookmark', price: 2.50}, - {name: 'Tote bag', price: 15} - ])).toStrictEqual([ - {name: 'Bookmark', price: 2.50}, - {name: 'Tote bag', price: 15}, - {name: 'Sweatshirt', price: 45}, - ]); - expect(sortByPrice([{price: 12}, {price: 10}])).toStrictEqual([{price: 10}, {price: 12}]); - expect(sortByPrice([])).toStrictEqual([]); - }); -}); - -describe('Testing challenge 7', () => { - test('It should sort numbers by their length', () => { - expect(sortNumbersByLength([10, 2.8, 1, -47.75])).toStrictEqual([1, 10, 2.8, -47.75]); - expect(sortNumbersByLength([100, 2.82, 1, -47.75])).toStrictEqual([1, 100, 2.82, -47.75]); - expect(sortNumbersByLength([1,2,3])).toEqual(expect.arrayContaining([1,2,3])); - }); -}); - -describe('Testing challenge 8', () => { - test('It should sort people by their last names', () => { - expect(sortPeople(people)).toStrictEqual([ - new Person('Casey', 'Codefellow', 38), - new Person('Stan', 'Seattle', 67), - new Person('Wes', 'Washington', 25), - ]); - expect(sortPeople([{lastName: 'banana'}, {lastName: 'apple'}])) - .toStrictEqual([{lastName: 'apple'}, {lastName: 'banana'}]); - }); -}); - -describe('Testing challenge 9', () => { - test('It should sort people with more strict ordering', () => { - const family = [ - new Person('Casey', 'Codefellows', 55), - new Person('Casey', 'Codefellows', 37), - new Person('Charlie', 'Codefellows', 21), - new Person('Charles', 'Codefellows', 29), - new Person('Carol', 'Codefellow', 88), - ]; - expect(sortPeopleBetter(family)).toStrictEqual([ - new Person('Carol', 'Codefellow', 88), - new Person('Casey', 'Codefellows', 37), - new Person('Casey', 'Codefellows', 55), - new Person('Charles', 'Codefellows', 29), - new Person('Charlie', 'Codefellows', 21), - ]); - expect(sortPeopleBetter([{firstName: 'andrew', lastName: 'apple'}, {firstName: 'andre', lastName: 'apple'}])) - .toStrictEqual([{firstName: 'andre', lastName: 'apple'}, {firstName: 'andrew', lastName: 'apple'}]); - }); -}); - -describe('Testing challenge 10', () => { - test('It should sort meetings by the day on which they happen', () => { - const sortedMeetings = sortMeetingsByDay(meetings); - expect(sortedMeetings.slice(0,2)).toEqual(expect.arrayContaining([new Meeting('Monday', '0900', '0945'), new Meeting('Monday', '0900', '1000')])); - expect(sortedMeetings[2]).toStrictEqual(new Meeting('Tuesday', '1145', '1315')); - expect(sortedMeetings.slice(3,5)).toEqual(expect.arrayContaining([new Meeting('Wednesday', '0930', '1000'), new Meeting('Wednesday', '1300', '1500')])); - expect(sortedMeetings[5]).toStrictEqual(new Meeting('Friday', '1200', '1345')); - }); -}); - -describe('Testing challenge 11', () => { - test('It should sort meetings by when they happen', () => { - expect(sortSchedule(meetings)).toStrictEqual([ - new Meeting('Monday', '0900', '0945'), - new Meeting('Monday', '0900', '1000'), - new Meeting('Tuesday', '1145', '1315'), - new Meeting('Wednesday', '0930', '1000'), - new Meeting('Wednesday', '1300', '1500'), - new Meeting('Friday', '1200', '1345'), - ]); - }); -}); - -xdescribe('Testing challenge 12', () => { - test('It should add a class of pear to the thrid li', () => { - addPearClass(); - expect($('li:nth-child(3)').hasClass('pear')).toBe(true); - }); -}); - -function createSnippetWithJQuery(html){ - return cheerio.load(html); -} diff --git a/code-challenges/challenges-05.test.js b/code-challenges/challenges-05.test.js index 8ba0125..5f18193 100644 --- a/code-challenges/challenges-05.test.js +++ b/code-challenges/challenges-05.test.js @@ -1,403 +1,403 @@ -'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 templateWithJQuery that uses jQuery to get the html template from the DOM, copy the contents, fill it with the Star Wars People, and append it to the DOM. ------------------------------------------------------------------------------------------------- */ -let starWarsPeople = [ - { - "name": "Luke Skywalker", - "height": "172", - "eye_color": "blue" - }, - { - "name": "C-3PO", - "height": "167", - "eye_color": "yellow" - }, - { - "name": "R2-D2", - "height": "96", - "eye_color": "red" - } -]; - -let $ = createSnippetWithJQuery(` -
-
-

-

-

-
-
-`); - -const templateWithJQuery = () => { - // Solution code here... - starWarsPeople.forEach(value => { - const myTemplate = $('#template').html(); - const $section = $('
'); - $section.html(myTemplate); - $section.find('h2').text(value.name); - $section.find('h3').text(value.height); - $section.find('p').text(value.eye_color); - $('main').append($section); - }) -} - -/* ------------------------------------------------------------------------------------------------ -CHALLENGE 2 - -Write a function named howMuchPencil that takes in a string, as written on the side of a pencil. - -As you sharpen the pencil, the string will become shorter and shorter, starting by removing the first letter. - -Your function should use slice within a loop and return an array of each successive string result from losing letters to the sharpener, until nothing is left. - -For example, if the input is 'Welcome', the output will be: -['Welcome', 'elcome', 'lcome', 'come', 'ome', 'me', 'e', '']. ------------------------------------------------------------------------------------------------- */ - -const howMuchPencil = (str) => { - let result = []; - // Solution code here... - for (let i = 0; i <= str.length; i++) { - let iteration = str.slice(i, str.length); - result.push(iteration); - } - return result; -}; - -/* ------------------------------------------------------------------------------------------------ -CHALLENGE 3 - -Write a function name wordsToCharList that, given a string as input, returns a new array where every element is a character of the input string. - -For example, wordsToCharList('gregor') returns ['g','r','e','g','o','r']. ------------------------------------------------------------------------------------------------- */ - -const wordsToCharList = (arr) => { - // Solution code here... - let result = []; - for (let i = 0; i < arr.length; i++) { - result.push(arr[i]); - } - return result; -}; - - -/* ------------------------------------------------------------------------------------------------ -CHALLENGE 4 - -You are making a grocery list for ingredients needed in the gruffalo crumble recipe, below. Rather than taking the entire recipe, you only want a list of the item names. - -Write a function named listFoods that takes in the recipe and returns a new array of the food items without any amount or units. Just the name. For example, '1 cup flour' will return 'flour'. - -Use slice for this function, maybe more than once. The Array.indexOf() method may also be helpful. - -Do not use split for this function. ------------------------------------------------------------------------------------------------- */ - -const gruffaloCrumble = { - name: 'How to make a Gruffalo Crumble', - ingredients: [ - '1 medium-sized Gruffalo', - '8 pounds oats', - '2 pounds brown sugar', - '4 pounds flour', - '2 gallons pure maple syrup', - '16 cups chopped nuts', - '1 pound baking soda', - '1 pound baking powder', - '1 pound cinnamon', - '6 gallons melted butter', - '2 gallons fresh water', - ], - steps: [ - 'Pre-heat a large oven to 375', - 'De-prickle the gruffalo', - 'Sprinkle with cinnamon, sugar, flour, and nuts', - 'Mix until evenly distributed', - 'Grease a 3-foot x 3-foot casserole dish', - 'Combine gruffalo compote with water to maintain moisture in the oven', - 'Fold together remaining ingredients to make the crisp', - 'Spread the crisp evenly over the gruffalo mixture', - 'Bake for 12-15 hours', - ] -}; - - -const listFoods = (recipe) => { - let result = []; - // Solution code here... - let food = ''; - recipe.ingredients.forEach((ingredient) => { - let counter = 2; - for (let letter = 0; letter < ingredient.length; letter++) { - if (counter > 0) { - if (ingredient[letter] === ' ') { - counter--; - food = ingredient.slice(letter + 1); - } - } - } - result.push(food); - }); - return result; -}; - -/* ------------------------------------------------------------------------------------------------ -CHALLENGE 5 - Stretch Goal - -Write a function named splitFoods that uses split to produce the same output as Challenge 3. - -You may also use other string or array methods. ------------------------------------------------------------------------------------------------- */ - -const splitFoods = (recipe) => { - // let result = []; - // // Solution code here... - recipe.ingredients.forEach((ingredient) => { - let food = ''; - let arraySplit = ingredient.split(' '); - let foodArray = arraySplit.slice(2); - foodArray.forEach((word) => { - if (xfood !== '') { - food += ' '; - } - food += word; - }); - result.push(food); - }); - return result; -}; - -/* ------------------------------------------------------------------------------------------------ -CHALLENGE 6 - Stretch Goal - -Use the same recipe from Challenge 3, above. - -Write a function named stepAction that takes in the recipe and extracts the action verbs from the steps. Fortunate for you, the action verbs are the first word of each action. - -Return a new array containing just the verbs. For example, ['Mix until evenly distributed'] returns ['Mix']. ------------------------------------------------------------------------------------------------- */ - -const stepActions = (recipe) => { - let result = []; - // Solution code here... - recipe.steps.forEach((step) => { - let split = step.split(' '); - let verbArray = split.slice(0, 1); - let verb = verbArray.toString(); - result.push(verb); - }); - return result; -}; - -/* ------------------------------------------------------------------------------------------------ -CHALLENGE 7 - Stretch Goal - -Write a function named removeEvenValues that, given an array of integers as input, deletes all even values from the array, leaving no 'gaps' behind. - -The array should be modified in-place. - -For example: - const integers = [1, 2, 3, 4, 5, 6]; - removeEvenValues(integers); - console.log(integers) will print [1, 3, 5] ------------------------------------------------------------------------------------------------- */ - -const removeEvenValues = (arr) => { - // Solution code here... - console.log('original', arr); - arr.forEach((even) => { - if (even % 2 === 0) { - arr.forEach((number) => { - if (number % 2 === 0) { - arr.splice(arr.indexOf(number), 1); - } - }); - } - }); -}; - -/* ------------------------------------------------------------------------------------------------ -CHALLENGE 8 - Stretch Goal - -Write a function named removeLastCharacters that takes in a string and a number. The numberOfCharacters argument determines how many characters will be removed from the end of the string. Return the resulting string. - -If the numberOfCharacters argument is greater than the length of the input string, the function should return an empty string. - -If the numberOfCharacters argument input is a negative number, the function should return the input string without any changes. - -For example: -removeLastCharacters('Gregor', 2) returns 'Greg' -removeLastCharacters('Gregor', -2) returns 'Gregor' -removeLastCharacters('Gregor', 9) returns '' ------------------------------------------------------------------------------------------------- */ - -const removeLastCharacters = (str, numberOfCharacters) => { - // Solution code here... - -}; - - -/* ------------------------------------------------------------------------------------------------ -CHALLENGE 9 - Stretch Goal - -Write a function named totalSumCSV that, given a string of comma-separated values (CSV) as input. (e.g. "1,2,3"), returns the total sum of the numeric values (e.g. 6). ------------------------------------------------------------------------------------------------- */ - -const totalSumCSV = (str) => { - let total = 0; - // Solution code here... - return total; -}; - - -/* ------------------------------------------------------------------------------------------------ -CHALLENGE 10 - Stretch Goal - -Write a function named removeVowels that takes in a string and returns a new string where all the vowels of the original string have been removed. - -For example, removeVowels('gregor') returns 'grgr'. ------------------------------------------------------------------------------------------------- */ - -const removeVowels = (str) => { - // Solution code here... -}; - -/* ------------------------------------------------------------------------------------------------ -CHALLENGE 11 - Stretch Goal - -Write a function named extractVowels that takes in a string and returns an array where the first element is the original string with all the vowels removed, and the second element is a string of all the vowels that were removed, in alphabetical order. - -For example, extractVowels('gregor') returns ['grgr', 'eo']. - -Similarly, extractVowels('The quick brown fox') returns ['Th qck brwn fx', 'eioou'] ------------------------------------------------------------------------------------------------- */ - -const extractVowels = (str) => { - // 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-05.test.js - ------------------------------------------------------------------------------------------------- */ - -describe('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'); - expect($('section:nth-child(3) h3').text()).toStrictEqual('167'); - expect($('section:nth-child(4) p').text()).toStrictEqual('red'); - }) -}); - -describe('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); - expect(howMuchPencil('')).toStrictEqual(['']); - expect(howMuchPencil('abc')).toStrictEqual(['abc', 'bc', 'c', '']); - }); -}); - -describe('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); - expect(wordsToCharList('hooray')).toStrictEqual(['h', 'o', 'o', 'r', 'a', 'y']); - expect(wordsToCharList('')).toStrictEqual([]); - }); -}); - -describe('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); - }); -}); - -xdescribe('Testing challenge 5', () => { - test('It should return a list of foods', () => { - expect(splitFoods(gruffaloCrumble)).toStrictEqual(['Gruffalo', 'oats', 'brown sugar', 'flour', 'pure maple syrup', 'chopped nuts', 'baking soda', 'baking powder', 'cinnamon', 'melted butter', 'fresh water']); - }); -}); - -xdescribe('Testing challenge 6', () => { - test('It should return a list of recipe steps', () => { - expect(stepActions(gruffaloCrumble)).toStrictEqual(['Pre-heat', 'De-prickle', 'Sprinkle', 'Mix', 'Grease', 'Combine', 'Fold', 'Spread', 'Bake']); - expect(stepActions(gruffaloCrumble).length).toStrictEqual(9); - }); -}); - -xdescribe('Testing challenge 7', () => { - test('It should remove the even numbers from the array', () => { - let list = [1, 2, 3, 4, 5, 6]; - removeEvenValues(list); - expect(list).toStrictEqual([1, 3, 5]); - - list = [6, 3, 19, 43, 12, 66, 43]; - removeEvenValues(list); - expect(list).toStrictEqual([3, 19, 43, 43]); - expect(list.length).toStrictEqual(4); - }); -}); - -xdescribe('Testing challenge 8', () => { - test('It should shorten the string based on the first argument', () => { - expect(removeLastCharacters('Gregor', 2)).toStrictEqual('Greg'); - expect(removeLastCharacters('Gregor', 2).length).toStrictEqual(4); - }); - test('It should return the complete string when passed a negative number', () => { - expect(removeLastCharacters('hello', -1)).toStrictEqual('hello'); - expect(removeLastCharacters('wowow', -700)).toStrictEqual('wowow'); - }); - test('It should return an empty string when called with a number larger than the string length', () => { - expect(removeLastCharacters('hello', 12)).toStrictEqual(''); - expect(removeLastCharacters('', 1)).toStrictEqual(''); - expect(removeLastCharacters('a', 1)).toStrictEqual(''); - }); -}); - -xdescribe('Testing challenge 9', () => { - test('It should add up the numbers contained within the string', () => { - expect(totalSumCSV('1,4,5,7,2')).toStrictEqual(19); - expect(totalSumCSV('147')).toStrictEqual(147); - }); -}); - -xdescribe('Testing challenge 10', () => { - test('It should return the string without vowels', () => { - expect(removeVowels('gregor')).toStrictEqual('grgr'); - expect(removeVowels('gregor').length).toStrictEqual(4); - expect(removeVowels('asdf')).toStrictEqual('sdf'); - expect(removeVowels('why')).toStrictEqual('why'); - }); -}); - -xdescribe('Testing challenge 11', () => { - test('It should return the string without vowels', () => { - expect(extractVowels('gregor')).toStrictEqual(['grgr', 'eo']); - expect(extractVowels('gregor').length).toStrictEqual(2); - - expect(extractVowels('The quick brown fox')).toStrictEqual(['Th qck brwn fx', 'eioou']); - }); -}); - - -function createSnippetWithJQuery(html){ - return cheerio.load(html); -}; \ No newline at end of file +// '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 templateWithJQuery that uses jQuery to get the html template from the DOM, copy the contents, fill it with the Star Wars People, and append it to the DOM. +// ------------------------------------------------------------------------------------------------ */ +// let starWarsPeople = [ +// { +// "name": "Luke Skywalker", +// "height": "172", +// "eye_color": "blue" +// }, +// { +// "name": "C-3PO", +// "height": "167", +// "eye_color": "yellow" +// }, +// { +// "name": "R2-D2", +// "height": "96", +// "eye_color": "red" +// } +// ]; + +// let $ = createSnippetWithJQuery(` +//
+//
+//

+//

+//

+//
+//
+// `); + +// const templateWithJQuery = () => { +// // Solution code here... +// starWarsPeople.forEach(value => { +// const myTemplate = $('#template').html(); +// const $section = $('
'); +// $section.html(myTemplate); +// $section.find('h2').text(value.name); +// $section.find('h3').text(value.height); +// $section.find('p').text(value.eye_color); +// $('main').append($section); +// }) +// } + +// /* ------------------------------------------------------------------------------------------------ +// CHALLENGE 2 + +// Write a function named howMuchPencil that takes in a string, as written on the side of a pencil. + +// As you sharpen the pencil, the string will become shorter and shorter, starting by removing the first letter. + +// Your function should use slice within a loop and return an array of each successive string result from losing letters to the sharpener, until nothing is left. + +// For example, if the input is 'Welcome', the output will be: +// ['Welcome', 'elcome', 'lcome', 'come', 'ome', 'me', 'e', '']. +// ------------------------------------------------------------------------------------------------ */ + +// const howMuchPencil = (str) => { +// let result = []; +// // Solution code here... +// for (let i = 0; i <= str.length; i++) { +// let iteration = str.slice(i, str.length); +// result.push(iteration); +// } +// return result; +// }; + +// /* ------------------------------------------------------------------------------------------------ +// CHALLENGE 3 + +// Write a function name wordsToCharList that, given a string as input, returns a new array where every element is a character of the input string. + +// For example, wordsToCharList('gregor') returns ['g','r','e','g','o','r']. +// ------------------------------------------------------------------------------------------------ */ + +// const wordsToCharList = (arr) => { +// // Solution code here... +// let result = []; +// for (let i = 0; i < arr.length; i++) { +// result.push(arr[i]); +// } +// return result; +// }; + + +// /* ------------------------------------------------------------------------------------------------ +// CHALLENGE 4 + +// You are making a grocery list for ingredients needed in the gruffalo crumble recipe, below. Rather than taking the entire recipe, you only want a list of the item names. + +// Write a function named listFoods that takes in the recipe and returns a new array of the food items without any amount or units. Just the name. For example, '1 cup flour' will return 'flour'. + +// Use slice for this function, maybe more than once. The Array.indexOf() method may also be helpful. + +// Do not use split for this function. +// ------------------------------------------------------------------------------------------------ */ + +// const gruffaloCrumble = { +// name: 'How to make a Gruffalo Crumble', +// ingredients: [ +// '1 medium-sized Gruffalo', +// '8 pounds oats', +// '2 pounds brown sugar', +// '4 pounds flour', +// '2 gallons pure maple syrup', +// '16 cups chopped nuts', +// '1 pound baking soda', +// '1 pound baking powder', +// '1 pound cinnamon', +// '6 gallons melted butter', +// '2 gallons fresh water', +// ], +// steps: [ +// 'Pre-heat a large oven to 375', +// 'De-prickle the gruffalo', +// 'Sprinkle with cinnamon, sugar, flour, and nuts', +// 'Mix until evenly distributed', +// 'Grease a 3-foot x 3-foot casserole dish', +// 'Combine gruffalo compote with water to maintain moisture in the oven', +// 'Fold together remaining ingredients to make the crisp', +// 'Spread the crisp evenly over the gruffalo mixture', +// 'Bake for 12-15 hours', +// ] +// }; + + +// const listFoods = (recipe) => { +// let result = []; +// // Solution code here... +// let food = ''; +// recipe.ingredients.forEach((ingredient) => { +// let counter = 2; +// for (let letter = 0; letter < ingredient.length; letter++) { +// if (counter > 0) { +// if (ingredient[letter] === ' ') { +// counter--; +// food = ingredient.slice(letter + 1); +// } +// } +// } +// result.push(food); +// }); +// return result; +// }; + +// /* ------------------------------------------------------------------------------------------------ +// CHALLENGE 5 - Stretch Goal + +// Write a function named splitFoods that uses split to produce the same output as Challenge 3. + +// You may also use other string or array methods. +// ------------------------------------------------------------------------------------------------ */ + +// const splitFoods = (recipe) => { +// // let result = []; +// // // Solution code here... +// recipe.ingredients.forEach((ingredient) => { +// let food = ''; +// let arraySplit = ingredient.split(' '); +// let foodArray = arraySplit.slice(2); +// foodArray.forEach((word) => { +// if (xfood !== '') { +// food += ' '; +// } +// food += word; +// }); +// result.push(food); +// }); +// return result; +// }; + +// /* ------------------------------------------------------------------------------------------------ +// CHALLENGE 6 - Stretch Goal + +// Use the same recipe from Challenge 3, above. + +// Write a function named stepAction that takes in the recipe and extracts the action verbs from the steps. Fortunate for you, the action verbs are the first word of each action. + +// Return a new array containing just the verbs. For example, ['Mix until evenly distributed'] returns ['Mix']. +// ------------------------------------------------------------------------------------------------ */ + +// const stepActions = (recipe) => { +// let result = []; +// // Solution code here... +// recipe.steps.forEach((step) => { +// let split = step.split(' '); +// let verbArray = split.slice(0, 1); +// let verb = verbArray.toString(); +// result.push(verb); +// }); +// return result; +// }; + +// /* ------------------------------------------------------------------------------------------------ +// CHALLENGE 7 - Stretch Goal + +// Write a function named removeEvenValues that, given an array of integers as input, deletes all even values from the array, leaving no 'gaps' behind. + +// The array should be modified in-place. + +// For example: +// const integers = [1, 2, 3, 4, 5, 6]; +// removeEvenValues(integers); +// console.log(integers) will print [1, 3, 5] +// ------------------------------------------------------------------------------------------------ */ + +// const removeEvenValues = (arr) => { +// // Solution code here... +// console.log('original', arr); +// arr.forEach((even) => { +// if (even % 2 === 0) { +// arr.forEach((number) => { +// if (number % 2 === 0) { +// arr.splice(arr.indexOf(number), 1); +// } +// }); +// } +// }); +// }; + +// /* ------------------------------------------------------------------------------------------------ +// CHALLENGE 8 - Stretch Goal + +// Write a function named removeLastCharacters that takes in a string and a number. The numberOfCharacters argument determines how many characters will be removed from the end of the string. Return the resulting string. + +// If the numberOfCharacters argument is greater than the length of the input string, the function should return an empty string. + +// If the numberOfCharacters argument input is a negative number, the function should return the input string without any changes. + +// For example: +// removeLastCharacters('Gregor', 2) returns 'Greg' +// removeLastCharacters('Gregor', -2) returns 'Gregor' +// removeLastCharacters('Gregor', 9) returns '' +// ------------------------------------------------------------------------------------------------ */ + +// const removeLastCharacters = (str, numberOfCharacters) => { +// // Solution code here... + +// }; + + +// /* ------------------------------------------------------------------------------------------------ +// CHALLENGE 9 - Stretch Goal + +// Write a function named totalSumCSV that, given a string of comma-separated values (CSV) as input. (e.g. "1,2,3"), returns the total sum of the numeric values (e.g. 6). +// ------------------------------------------------------------------------------------------------ */ + +// const totalSumCSV = (str) => { +// let total = 0; +// // Solution code here... +// return total; +// }; + + +// /* ------------------------------------------------------------------------------------------------ +// CHALLENGE 10 - Stretch Goal + +// Write a function named removeVowels that takes in a string and returns a new string where all the vowels of the original string have been removed. + +// For example, removeVowels('gregor') returns 'grgr'. +// ------------------------------------------------------------------------------------------------ */ + +// const removeVowels = (str) => { +// // Solution code here... +// }; + +// /* ------------------------------------------------------------------------------------------------ +// CHALLENGE 11 - Stretch Goal + +// Write a function named extractVowels that takes in a string and returns an array where the first element is the original string with all the vowels removed, and the second element is a string of all the vowels that were removed, in alphabetical order. + +// For example, extractVowels('gregor') returns ['grgr', 'eo']. + +// Similarly, extractVowels('The quick brown fox') returns ['Th qck brwn fx', 'eioou'] +// ------------------------------------------------------------------------------------------------ */ + +// const extractVowels = (str) => { +// // 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-05.test.js + +// ------------------------------------------------------------------------------------------------ */ + +// describe('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'); +// expect($('section:nth-child(3) h3').text()).toStrictEqual('167'); +// expect($('section:nth-child(4) p').text()).toStrictEqual('red'); +// }) +// }); + +// describe('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); +// expect(howMuchPencil('')).toStrictEqual(['']); +// expect(howMuchPencil('abc')).toStrictEqual(['abc', 'bc', 'c', '']); +// }); +// }); + +// describe('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); +// expect(wordsToCharList('hooray')).toStrictEqual(['h', 'o', 'o', 'r', 'a', 'y']); +// expect(wordsToCharList('')).toStrictEqual([]); +// }); +// }); + +// describe('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); +// }); +// }); + +// xdescribe('Testing challenge 5', () => { +// test('It should return a list of foods', () => { +// expect(splitFoods(gruffaloCrumble)).toStrictEqual(['Gruffalo', 'oats', 'brown sugar', 'flour', 'pure maple syrup', 'chopped nuts', 'baking soda', 'baking powder', 'cinnamon', 'melted butter', 'fresh water']); +// }); +// }); + +// xdescribe('Testing challenge 6', () => { +// test('It should return a list of recipe steps', () => { +// expect(stepActions(gruffaloCrumble)).toStrictEqual(['Pre-heat', 'De-prickle', 'Sprinkle', 'Mix', 'Grease', 'Combine', 'Fold', 'Spread', 'Bake']); +// expect(stepActions(gruffaloCrumble).length).toStrictEqual(9); +// }); +// }); + +// xdescribe('Testing challenge 7', () => { +// test('It should remove the even numbers from the array', () => { +// let list = [1, 2, 3, 4, 5, 6]; +// removeEvenValues(list); +// expect(list).toStrictEqual([1, 3, 5]); + +// list = [6, 3, 19, 43, 12, 66, 43]; +// removeEvenValues(list); +// expect(list).toStrictEqual([3, 19, 43, 43]); +// expect(list.length).toStrictEqual(4); +// }); +// }); + +// xdescribe('Testing challenge 8', () => { +// test('It should shorten the string based on the first argument', () => { +// expect(removeLastCharacters('Gregor', 2)).toStrictEqual('Greg'); +// expect(removeLastCharacters('Gregor', 2).length).toStrictEqual(4); +// }); +// test('It should return the complete string when passed a negative number', () => { +// expect(removeLastCharacters('hello', -1)).toStrictEqual('hello'); +// expect(removeLastCharacters('wowow', -700)).toStrictEqual('wowow'); +// }); +// test('It should return an empty string when called with a number larger than the string length', () => { +// expect(removeLastCharacters('hello', 12)).toStrictEqual(''); +// expect(removeLastCharacters('', 1)).toStrictEqual(''); +// expect(removeLastCharacters('a', 1)).toStrictEqual(''); +// }); +// }); + +// xdescribe('Testing challenge 9', () => { +// test('It should add up the numbers contained within the string', () => { +// expect(totalSumCSV('1,4,5,7,2')).toStrictEqual(19); +// expect(totalSumCSV('147')).toStrictEqual(147); +// }); +// }); + +// xdescribe('Testing challenge 10', () => { +// test('It should return the string without vowels', () => { +// expect(removeVowels('gregor')).toStrictEqual('grgr'); +// expect(removeVowels('gregor').length).toStrictEqual(4); +// expect(removeVowels('asdf')).toStrictEqual('sdf'); +// expect(removeVowels('why')).toStrictEqual('why'); +// }); +// }); + +// xdescribe('Testing challenge 11', () => { +// test('It should return the string without vowels', () => { +// expect(extractVowels('gregor')).toStrictEqual(['grgr', 'eo']); +// expect(extractVowels('gregor').length).toStrictEqual(2); + +// expect(extractVowels('The quick brown fox')).toStrictEqual(['Th qck brwn fx', 'eioou']); +// }); +// }); + + +// function createSnippetWithJQuery(html){ +// return cheerio.load(html); +// }; \ No newline at end of file diff --git a/code-challenges/challenges-06.test.js b/code-challenges/challenges-06.test.js new file mode 100644 index 0000000..0609992 --- /dev/null +++ b/code-challenges/challenges-06.test.js @@ -0,0 +1,289 @@ +'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'); +const Mustache = require('mustache'); + +/* ------------------------------------------------------------------------------------------------ + +CHALLENGE 1 - Review + +Use the characters data below for all of the challenges except challenge 2. + +Write a function named templatingWithMustache that uses mustache to create the markup templates for each of the characters. Use the snippet as your guide for creating your templates. Return an array of template strings. Note: this function does not need to actually append the markup to the DOM. + +------------------------------------------------------------------------------------------------ */ +let characters = [ + { + name: 'Eddard', + spouse: 'Catelyn', + children: ['Robb', 'Sansa', 'Arya', 'Bran', 'Rickon'], + house: 'Stark' + }, + { + name: 'Jon A.', + 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: 'Euron', + spouse: null, + children: [], + house: 'Greyjoy' + }, + { + name: 'Jon S.', + spouse: null, + children: [], + house: 'Snow' + } +]; + +let $ = createSnippetWithJQuery(` + +`); + +const templatingWithMustache = () => { + // Solution code here... + let templateArray =[]; + characters.forEach(character => { + let template = $('#template').html(); + let html = Mustache.render(template, { + 'name': character.name, + 'spouse': character.spouse, + 'children': character.children, + 'house': character.house + }); + templateArray.push(html); + }) + return templateArray; + +}; + +/* ------------------------------------------------------------------------------------------------ +CHALLENGE 2 + +Write a function named getCourseKeys that takes in the courseInfo object and returns an array containing the keys for the courseInfo object. + +For example: (['name', 'duration', 'topics', 'finalExam']). +------------------------------------------------------------------------------------------------ */ +const courseInfo = { name: 'Code 301', duration: { dayTrack: '4 weeks', eveningTrack: '8 weeks'}, + topics: ['SMACSS', 'APIs', 'NodeJS', 'SQL', 'jQuery', 'functional programming'], + finalExam: true +}; + + // Solution code here... + const getCourseKeys = (obj) => Object.keys(obj); + + + +/* ------------------------------------------------------------------------------------------------ +CHALLENGE 3 + +Write a function named getHouses that returns a new array containing the names of all of the houses in the data set. +------------------------------------------------------------------------------------------------ */ + +const getHouses = (arr) => { + let houses = []; + // Solution code here... + arr.forEach(value => { + let findHouse = value.house; + houses.push(findHouse); + }) + + return houses; +}; + +/*------------------------------------------------------------------------------------------------ +CHALLENGE 4 + +Write a function named hasChildrenValues that uses Object.values to determine if any given character in the data set has children. + +This function should take in an array of data and a character name and return a Boolean. + +For example: +hasChildrenValues(characters, 'Cersei') will return true +hasChildrenValues(characters, 'Sansa') will return false +------------------------------------------------------------------------------------------------ */ + +const hasChildrenValues = (arr, character) => { + // Solution code here... + let variable; + arr.forEach(value => { + let checkIfParent = value.children; + let parentName = value.name; + if( parentName === character && checkIfParent.length > 0){ + variable = true; + } else if (parentName === character && checkIfParent.length === 0){ + variable = false; + } + + + }); + return variable; + +}; + +/* ------------------------------------------------------------------------------------------------ +CHALLENGE 5 - Stretch Goal + +Write a function named hasChildrenEntries that is similar to your hasChildrenValues function from challenge 4, but uses the data's entries instead of its values. + +The input and output of this function are the same as the input and output from challenge 3. +------------------------------------------------------------------------------------------------ */ + +const hasChildrenEntries = (arr, character) => { + // Solution code here... +}; + +/* ------------------------------------------------------------------------------------------------ +CHALLENGE 6 - Stretch Goal + +Write a function named totalCharacters that takes in an array and returns the number of characters in the array. +------------------------------------------------------------------------------------------------ */ + +const totalCharacters = (arr) => { + // Solution code here... +}; + +/* ------------------------------------------------------------------------------------------------ +CHALLENGE 7 - Stretch Goal + +Write a function named houseSize that takes in the array of characters and creates an object for each house containing the name of the house and the number of members. + +All of these objects should be added to an array named "sizes". Return the "sizes" array from the function. + +For example: [{ house: 'Stark', members: 7 }, { house: 'Arryn', members: 3 }, ... ]. +------------------------------------------------------------------------------------------------ */ + +const houseSize = (arr) => { + const sizes = []; + // Solution code here... + return sizes; +}; + +/* ------------------------------------------------------------------------------------------------ +CHALLENGE 8 - Stretch Goal + +As fans are well aware, "When you play the game of thrones, you win or you die. There is no middle ground." + +We will assume that Alerie Tyrell is deceased. She missed her daughter's wedding. Twice. + +Write a function named houseSurvivors. You may modify your houseSize function from challenge 6 to use as the basis of this function. + +This function should create an object for each house containing the name of the house and the number of members. If the spouse is deceased, do not include him/her in the total number of family members. + +All of these objects should be added to an array named "survivors". Return the "survivors" array from the function. + +For example: [ { house: 'Stark', members: 6 }, { house: 'Arryn', members: 2 }, ... ]. +------------------------------------------------------------------------------------------------ */ + +const deceasedSpouses = ['Catelyn', 'Lysa', 'Robert', 'Khal Drogo', 'Alerie']; + +const houseSurvivors = (arr) => { + const survivors = []; + // Solution code here... + return survivors; +}; + +/* ------------------------------------------------------------------------------------------------ +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-06.test.js + +------------------------------------------------------------------------------------------------ */ + +describe('Testing challenge 1', () => { + test('It should return html markup with the character', () => { + const filledTemplates = templatingWithMustache(); + const $ = cheerio.load(filledTemplates[0]); + expect($('h2').text()).toStrictEqual('Eddard'); + }); +}); + +describe('Testing challenge 2', () => { + test('It should return the keys from an object', () => { + expect(getCourseKeys(courseInfo)).toStrictEqual(['name', 'duration', 'topics', 'finalExam']); + }); +}); + +describe('Testing challenge 3', () => { + test('It should return an array of the names of the houses', () => { + expect(getHouses(characters)).toStrictEqual(['Stark', 'Arryn', 'Lannister', 'Targaryen', 'Tyrell', 'Greyjoy', 'Snow']); + expect(getHouses(characters).length).toStrictEqual(7); + }); +}); + +describe('Testing challenge 4', () => { + test('It should return true for characters that have children', () => { + expect(hasChildrenValues(characters, 'Daenarys')).toBeTruthy(); + }); + + test('It should return false to characters who do not have children', () => { + expect(hasChildrenValues(characters, 'Sansa')).toBeFalsy(); + }); +}); + +xdescribe('Testing challenge 5', () => { + test('It should return true for characters that have children', () => { + expect(hasChildrenEntries(characters, 'Eddard')).toBeTruthy(); + }); + + test('It should return false to characters who do not have children', () => { + expect(hasChildrenEntries(characters, 'Jon S.')).toBeFalsy(); + }); +}); + +xdescribe('Testing challenge 6', () => { + test('It should return the number of characters in the array', () => { + expect(totalCharacters(characters)).toStrictEqual(26); + }); +}); + +xdescribe('Testing challenge 7', () => { + test('It should return an object for each house containing the name and size', () => { + expect(houseSize(characters)).toStrictEqual([{ house: 'Stark', members: 7 }, { house: 'Arryn', members: 3 }, { house: 'Lannister', members: 5 }, { house: 'Targaryen', members: 5 }, { house: 'Tyrell', members: 4 }, { house: 'Greyjoy', members: 1 }, { house: 'Snow', members: 1 }]); + expect(houseSize(characters).length).toStrictEqual(7); + }); +}); + +xdescribe('Testing challenge 8', () => { + test('It should not include any deceased spouses', () => { + expect(houseSurvivors(characters)).toStrictEqual([{ house: 'Stark', members: 6 }, { house: 'Arryn', members: 2 }, { house: 'Lannister', members: 4 }, { house: 'Targaryen', members: 4 }, { house: 'Tyrell', members: 3 }, { house: 'Greyjoy', members: 1 }, { house: 'Snow', members: 1 }]); + }); +}); + + +function createSnippetWithJQuery(html){ + return cheerio.load(html); +} diff --git a/code-challenges/challenges-13.test.js b/code-challenges/challenges-13.test.js new file mode 100644 index 0000000..f48264f --- /dev/null +++ b/code-challenges/challenges-13.test.js @@ -0,0 +1,339 @@ +'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 + +There's a typo in the markup. The Pear is misspelled Perr. +Cheerio is a alternative implementation of jQuery that works on server +Use Cheerio with jQuery syntax to fix the typo +------------------------------------------------------------------------------------------------ */ + +const $ = createSnippetWithJQuery(` + +`); + +const fixTheTypo = () => { +// Solution code here... +$('ul li:nth-child(3)').text('Pear'); + +}; + +/* ------------------------------------------------------------------------------------------------ +CHALLENGE 2 + +Write a function named firstLetters that takes in an array of strings and returns an array containing only the first letter of each string. + +For example, ['this is great :)', 'wow', 'whyyyyyy :(', ':)))))'] returns ['t', 'w', 'w', ':'] +------------------------------------------------------------------------------------------------ */ + +const firstLetters = (arr) => { + // Solution code here... + let newArr = []; + for (let i = 0; i < arr.length; i++) { + newArr.push(arr[i][0]); + } + return newArr; +}; + +/* ------------------------------------------------------------------------------------------------ +CHALLENGE 3 + +Write a function named findHappiness that takes in an array of strings and returns an array containing only the strings from the input array that contain ":)". + +For example, ['this is great :)', 'wow', 'whyyyyyy :(', ':)))))'] returns ['this is great :)', ':)))))'] +------------------------------------------------------------------------------------------------ */ + +const findHappiness = (arr) => { + // Solution code here... + return arr.filter(sentence => sentence.includes(':)')); + +}; + +/* ------------------------------------------------------------------------------------------------ +CHALLENGE 4 + +Write a function named standardizePhoneNumbers that takes in an array of phone number strings in (XXX) XXX-XXXX format and returns an array with the phone number strings in XXXXXXXXXX format. + +For example, (123) 456-7890 returns 1234567890 +------------------------------------------------------------------------------------------------ */ + +const standardizePhoneNumbers = (arr) => { + // Solution code here... + let numsArray = arr.map((phonenum) => { + let numstring = ''; + for (let i = 0; i < phonenum.length; i++) { + if (phonenum.charAt(i) !== '(' && phonenum.charAt(i) !== ')' && phonenum.charAt(i) !== ' ' && phonenum.charAt(i) !== '-') { + numstring += phonenum[i]; + } + } + return numstring; + }); + return numsArray; +}; + +/* ------------------------------------------------------------------------------------------------ +CHALLENGE 5 - Stretch Goal + +Write a function named onlyOddChars that takes in a string and returns only the odd-index characters from that string. + +For example, 'abcdefg' returns 'bdf' +------------------------------------------------------------------------------------------------ */ + +const onlyOddChars = (str) => { + // Solution code here... + let newstr = ''; + for (let i = 0; i < str.length; i++) { + if (i % 2 !== 0) { + newstr += str.charAt(i); + } + } + if (newstr.length > 0) { + return newstr; + } + else { + return ''; + } +}; + +/* ------------------------------------------------------------------------------------------------ +CHALLENGE 6 - Stretch Goal + +Write a function named allHappy that takes in an array of strings and returns a Boolean indicating whether all those strings contain ":)". +------------------------------------------------------------------------------------------------ */ + +const allHappy = (arr) => { + // Solution code here... + const checkSmiley = str => str.includes(':)'); + return arr.every(checkSmiley); +}; + +/* ------------------------------------------------------------------------------------------------ +CHALLENGE 7 - Stretch Goal + +Write a function named findAnything that takes in an array of strings, along with a target string. Return an array containing only those strings from the original array that contain the target string. +------------------------------------------------------------------------------------------------ */ + +const findAnything = (arr, target) => { + // Solution code here... + return arr.filter(str => str.includes(target)); + +}; + +/* ------------------------------------------------------------------------------------------------ +CHALLENGE 8 - Stretch Goal + +Write a function named findEvery that takes in an array of strings, along with a target string. Return a Boolean based on whether or not every string in the array contains the target string. +------------------------------------------------------------------------------------------------ */ + +const findEvery = (arr, target) => { + // Solution code here... + const checkTarget = str => str.includes(target); + return arr.every(checkTarget); +}; + +/* ------------------------------------------------------------------------------------------------ +CHALLENGE 9 - Stretch Goal + +We've been testing a new course enrollment system, and we think we have the bugs worked out, but in the meantime, Brook enrolled himself in a bunch of different classes to test if it was working. + +Write a function named unenrollBrook that takes in a two-dimensional array, where each array represents one course's roster and is an array of strings of the names of the people in that course. + +Return a two-dimensional array with the same roster, but where anyone whose name includes Brook is removed from every course. + +For example, [['Brook Testing', 'Actual Person'], ['Human Person', 'Brook again', 'still Brook']] returns [['Actual Person'], ['Human Person']] +------------------------------------------------------------------------------------------------ */ + +const unenrollBrook = (arr) => { + // Solution code here... + return arr.map(subarr => subarr.filter(str => !str.includes('Brook'))); + +}; + +/* ------------------------------------------------------------------------------------------------ +CHALLENGE 10 - Stretch Goal + +Write a function named sortByDay that takes in an array of strings, each of which represents an event's day and time. + +Return a two-dimensional array that organizes those strings based on the day on which they occur. For example, all events on Monday are in the first array, all events on Tuesday are in the second array, etc. + +If an event takes place on multiple days (i.e. "Dancing on Mondays and Tuesdays"), it should appear in both arrays. + +For example, ['Tuesday', 'Monday', 'Wednesday and Thursday', 'Tuesday 2', 'Thursday'] returns +[ + ['Monday'], + ['Tuesday', 'Tuesday 2'], + ['Wednesday and Thursday'], + ['Wednesday and Thursday', 'Thursday'], + [], + [], + [] +] +------------------------------------------------------------------------------------------------ */ + +const daysOfWeek = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']; + +const sortByDay = (arr) => { + // Solution code here... +}; + +/* ------------------------------------------------------------------------------------------------ +CHALLENGE 11 - Stretch Goal + +Write a function named characterByIndex that takes in an array of strings and returns an array containing the first character of the first string, the second character of the second string, etc. + +For example, ['abcd', 'efgh', 'ijkl', 'mnop'] returns ['a', 'f', 'k', 'p'] +------------------------------------------------------------------------------------------------ */ + +const characterByIndex = (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-13.test.js + +------------------------------------------------------------------------------------------------ */ + +describe('Testing challenge 1', () => { + test('It should return markup with typo fixed', () => { + fixTheTypo(); + + expect($('.pear').text()).toStrictEqual('Pear'); + }); +}); + +describe('Testing challenge 2', () => { + test('It should return the first letter of each element of the array', () => { + const words = ['apple', 'banana', 'cantaloupe']; + + expect(firstLetters(words)).toStrictEqual(['a', 'b', 'c']); + expect(firstLetters(['a', 'b', 'c', 'd'])).toStrictEqual(['a', 'b', 'c', 'd']); + expect(firstLetters([])).toStrictEqual([]); + }); +}); + +describe('Testing challenge 3', () => { + test('It should return only the strings that contain smiley faces', () => { + const words = ['things', 'apple (:)', ':)banana', 'missing that thing', 'cant:)aloupe']; + + expect(findHappiness(words)).toStrictEqual(['apple (:)', ':)banana', 'cant:)aloupe']); + expect(findHappiness([])).toStrictEqual([]); + expect(findHappiness(['sadness'])).toStrictEqual([]); + expect(findHappiness([':) yay', ':( no', '', '', '', ''])).toStrictEqual([':) yay']); + }); +}); + +describe('Testing challenge 4', () => { + test('It should return a standardized set of phone numbers', () => { + const nums = ['(123) 456-7890', '(222) 222-2222']; + + expect(standardizePhoneNumbers(nums)).toStrictEqual(['1234567890', '2222222222']); + expect(standardizePhoneNumbers([nums[0]])).toStrictEqual(['1234567890']); + }); +}); + +describe('Testing challenge 5', () => { + test('It should only return the odd indexed characters from the string', () => { + expect(onlyOddChars('0123456789')).toStrictEqual('13579'); + expect(onlyOddChars('abcd')).toStrictEqual('bd'); + expect(onlyOddChars('a')).toStrictEqual(''); + expect(onlyOddChars('')).toStrictEqual(''); + }); +}); + +describe('Testing challenge 6', () => { + test('It should correctly assess whether all the strings are happy', () => { + const words = ['things', 'apple (:)', ':)banana', 'missing that thing', 'cant:)aloupe']; + + expect(allHappy(words)).toStrictEqual(false); + expect(allHappy(['apple (:)', ':)banana', 'cant:)aloupe'])).toStrictEqual(true); + expect(allHappy([])).toStrictEqual(true); + }); +}); + +describe('Testing challenge 7', () => { + test('It should find all the strings that contain a given string', () => { + const words = ['things', 'apple (:)', ':)banana', 'missing that thing', 'cant:)aloupe']; + + expect(findAnything(words, ':)')).toStrictEqual(findHappiness(words)); + expect(findAnything(words, 'i')).toStrictEqual(['things', 'missing that thing']); + }); +}); + +describe('Testing challenge 8', () => { + test('It should determine whether all the strings contain a given string', () => { + const words = ['things', 'apple pie (:)', ':)banana pie', 'missing that thing', 'cant:)aloupe is tasty']; + + expect(findEvery(words, 'a')).toStrictEqual(false); + expect(findEvery(words, '')).toStrictEqual(true); + expect(findEvery(words, 'i')).toStrictEqual(true); + }); +}); + +describe('Testing challenge 9', () => { + test('It should remove Brook from all courses', () => { + const roster = [ + ['Michelle', 'Allie', 'Brook TESTING'], + ['Brook Riggio', 'hey look it\'s Brook', 'Jennifer'], + ['Nicholas', 'Sam', 'Scott', 'Vinicio'] + ]; + + expect(unenrollBrook(roster)).toStrictEqual([ + ['Michelle', 'Allie'], + ['Jennifer'], + ['Nicholas', 'Sam', 'Scott', 'Vinicio'] + ]); + expect(unenrollBrook([['Brook', 'person'], [], ['person', 'person', 'Brook']])).toStrictEqual([['person'], [], ['person', 'person']]); + expect(unenrollBrook([])).toStrictEqual([]); + }); +}); + +xdescribe('Testing challenge 10', () => { + test('It should sort events by the day on which they happen', () => { + const events = ['Dancing on Mondays and Tuesdays', 'Meet the inventors! Monday, August 7', 'in the club on a Tuesday', 'Thursday Night Code', 'Saturday Night Fever']; + const sortedEvents = sortByDay(events); + expect(sortedEvents[0]).toEqual(expect.arrayContaining(['Dancing on Mondays and Tuesdays', 'Meet the inventors! Monday, August 7'])); + expect(sortedEvents[1]).toEqual(expect.arrayContaining(['Dancing on Mondays and Tuesdays', 'in the club on a Tuesday'])); + expect(sortedEvents[2]).toStrictEqual([]); + expect(sortedEvents[3]).toStrictEqual(['Thursday Night Code']); + expect(sortedEvents[4]).toStrictEqual([]); + expect(sortedEvents[5]).toStrictEqual(['Saturday Night Fever']); + expect(sortedEvents[6]).toStrictEqual([]); + + const events2 = ['Tuesday', 'Monday', 'Wednesday and Thursday', 'Tuesday 2', 'Thursday']; + const sortedEvents2 = sortByDay(events2); + expect(sortedEvents2[0]).toStrictEqual(['Monday']); + expect(sortedEvents2[1]).toEqual(expect.arrayContaining(['Tuesday', 'Tuesday 2'])); + expect(sortedEvents2[2]).toStrictEqual(['Wednesday and Thursday']); + expect(sortedEvents2[3]).toEqual(expect.arrayContaining(['Wednesday and Thursday', 'Thursday'])); + expect(sortedEvents2[4]).toStrictEqual([]); + expect(sortedEvents2[5]).toStrictEqual([]); + expect(sortedEvents2[6]).toStrictEqual([]); + }); +}); + +xdescribe('Testing challenge 11', () => { + test('It should return the ith character of the ith string', () => { + const words = ['apple', 'banana', 'cantaloupe']; + + expect(characterByIndex(words)).toStrictEqual(['a', 'a', 'n']); + expect(characterByIndex(['abc', 'def', 'ghi'])).toStrictEqual(['a', 'e', 'i']); + expect(characterByIndex(['wow', 'wow', 'wow'])).toStrictEqual(['w', 'o', 'w']); + }); +}); + +function createSnippetWithJQuery(html){ + return cheerio.load(html); +} diff --git a/code-challenges/challenges-14.test.js b/code-challenges/challenges-14.test.js new file mode 100644 index 0000000..a062fc2 --- /dev/null +++ b/code-challenges/challenges-14.test.js @@ -0,0 +1,340 @@ +'use strict'; + +/* ------------------------------------------------------------------------------------------------ +CHALLENGE 1 - Review + +Complete the createServer function to include routes +a GET request to / should respond with status of 200 +a DELETE request to /things/1 should respond with status of 405 +any other route should return status of 404 +------------------------------------------------------------------------------------------------ */ +const createServer = () => { + const express = require('express'); + const app = express(); + + // solution code goes here ... + + var server = app.listen(3000, function () { + var port = server.address().port; + console.log('Example app listening at port', port); + }); + return server; +}; + +/* ------------------------------------------------------------------------------------------------ +CHALLENGE 2 + +Write a function named toTitleCase that takes in an array of strings and returns an array of strings with the first character in upper case and the rest as is. + +For example, ['apple', 'banana', 'MacGyver'] returns ['Apple', 'Banana', 'MacGyver']. +------------------------------------------------------------------------------------------------ */ + +const toTitleCase = (arr) => { + // Solution code here... + return arr.map((word) => { + let newWord = ''; + for (let i = 0; i < word.length; i++) { + if (i === 0) { + newWord += word[i].toUpperCase(); + } + else { + newWord += word[i]; + } + } + return newWord; + }); +}; + +/* ------------------------------------------------------------------------------------------------ +CHALLENGE 3 + +Write a function named biggerThanLuke that, given the Star Wars data, below, returns the names of the characters whose mass is greater than Luke's. + +The names should be combined into a single string with each character name separated by a dash. + +For example, "Lando Calrisian - Boba Fett - Princess Amidala". +------------------------------------------------------------------------------------------------ */ + +let starWarsData = [{ + name: 'Luke Skywalker', + height: '172', + mass: '77', + hair_color: 'blond', + skin_color: 'fair', + eye_color: 'blue', + birth_year: '19BBY', + gender: 'male', +}, +{ + name: 'C-3PO', + height: '167', + mass: '75', + hair_color: 'n/a', + skin_color: 'gold', + eye_color: 'yellow', + birth_year: '112BBY', + gender: 'n/a' +}, +{ + name: 'R2-D2', + height: '96', + mass: '32', + hair_color: 'n/a', + skin_color: 'white, blue', + eye_color: 'red', + birth_year: '33BBY', + gender: 'n/a' +}, +{ + name: 'Darth Vader', + height: '202', + mass: '136', + hair_color: 'none', + skin_color: 'white', + eye_color: 'yellow', + birth_year: '41.9BBY', + gender: 'male' +}, +{ + name: 'Leia Organa', + height: '150', + mass: '49', + hair_color: 'brown', + skin_color: 'light', + eye_color: 'brown', + birth_year: '19BBY', + gender: 'female' +}, +{ + name: 'Pex Kylar', + height: '180', + mass: '190', + hair_color: 'orange', + skin_color: 'brown', + eye_color: 'none', + birth_year: '27BBY', + gender: 'n/a' +}]; + +let biggerThanLuke = (arr) => { + // Solution code here... + let lukeMass; + let str = ''; + let flag = false; + arr.forEach(person => { + if (person.name === 'Luke Skywalker') { + lukeMass = parseInt(person.mass, 10); + } + if (parseInt(person.mass, 10) > lukeMass && flag === false) { + str += person.name; + flag = true; + } + else if (parseInt(person.mass, 10) > lukeMass && flag === true) { + str += ` - ${person.name}`; + } + }); + return str; +}; + +/* ------------------------------------------------------------------------------------------------ +CHALLENGE 4 +Write a function named sortBy that takes in an array of objects, each of which has a particular property, and sorts those objects by that property, lowest to highest, returning the same array. + +Here is an example of the input: +[ + {name: 'Sweatshirt', price: 45}, + {name: 'Bookmark', price: 2.50}, + {name: 'Tote bag', price: 15} +]; + +This data could be sorted by name or price. +------------------------------------------------------------------------------------------------ */ + +const sortBy = (property, arr) => { + // Solution code here... + if (property === 'name') { + return arr.sort((a, b) => { + if (a.name < b.name) { + return -1; + } + else if (a.name > b.name) { + return 1; + } + else { + return 0; + } + }); + } + else if (property === 'price') { + return arr.sort((a, b) => { + if (a.price < b.price) { + return -1; + } + else if (a.price > b.price) { + return 1; + } + else { + return 0; + } + }); + } +}; + +/* ------------------------------------------------------------------------------------------------ +CHALLENGE 5 - Stretch Goal + +Write a function that determines if a given URL is secure, beginning with https:// + +Guard against malformed URLs, such as: https:missing-slashes.bad + +For example: +http://www.insecure.com returns false because the URL is not secure +https://secure.com returns true because the URL is secure +https:/missingslash.org returns false because the URL is malformed +------------------------------------------------------------------------------------------------ */ +const isSecure = (url) => { + // Solution code here... + console.log(url.substring(0, 7)); + if (url.substring(0, 8) !== 'https://') { + return false; + } + else { + return true; + } +}; + +/* ------------------------------------------------------------------------------------------------ +CHALLENGE 6 - Stretch Goal + +Write a function named detectTicTacToeWin that accepts a two-dimensional array of strings. Each string is guaranteed to be either "X", "O" or an empty string. Your function should check to see if any row, column, or either diagonal direction has three matching "X" or "O" symbols (non-empty strings), three-in-a-line. + +This function should return either true or false to indicate if someone won the game. + +Instead of trying to write crazy for loops to automate checking the rows, columns and diagonals consider writing one helper function that accepts three coordinate pairs and checks the values of the array at those locations. For instance helpCheck(row1, col1, row2, col2, row3, col3). + +Your function does not need to work for boards of any size other than 3x3. + +Here is a sample board: +[ + ['X', '', 'O'], + ['X', 'O', ''], + ['X', 'O', 'X'], +]; +------------------------------------------------------------------------------------------------ */ + +const detectTicTacToeWin = (board) => { + // 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 challenge-14.test.js + +------------------------------------------------------------------------------------------------ */ + +describe('Testing challenge 1', function () { + + const request = require('supertest'); + + let server; + + beforeEach(function () { + server = createServer(); + }); + + afterEach(function () { + server.close(); + }); + + test('responds to /', function testSlash(done) { + request(server) + .get('/') + .expect(200, done); + }); + + test('responds to /things/1', function testSlash(done) { + request(server) + .delete('/things/1') + .expect(405, done); + }); + + test('404 everything else', function testPath(done) { + request(server) + .get('/foo/bar') + .expect(404, done); + }); +}); + +describe('Testing challenge 2', () => { + test('It should convert each word to title case', () => { + const words = ['apple', 'banana', 'MacGyver']; + expect(toTitleCase(words)).toStrictEqual(['Apple', 'Banana', 'MacGyver']); + + expect(toTitleCase([])).toStrictEqual([]); + }); +}); + +describe('Testing challenge 3', () => { + test('It should return only characters that are bigger than Luke', () => { + expect(biggerThanLuke(starWarsData)).toStrictEqual('Darth Vader - Pex Kylar'); + expect(biggerThanLuke([])).toStrictEqual(''); + }); +}); + +describe('Testing challenge 4', () => { + test('It should sort items by a price', () => { + + expect(sortBy('price', [ + { name: 'Sweatshirt', price: 45 }, + { name: 'Bookmark', price: 2.50 }, + { name: 'Tote bag', price: 15 } + ])).toStrictEqual([ + { name: 'Bookmark', price: 2.50 }, + { name: 'Tote bag', price: 15 }, + { name: 'Sweatshirt', price: 45 }, + ]); + + }); + + test('It should sort items by name', () => { + + expect(sortBy('name', [ + { name: 'Sweatshirt', price: 45 }, + { name: 'Bookmark', price: 2.50 }, + { name: 'Tote bag', price: 15 } + ])).toStrictEqual([ + { name: 'Bookmark', price: 2.50 }, + { name: 'Sweatshirt', price: 45 }, + { name: 'Tote bag', price: 15 }, + ]); + }); +}); + +describe('Testing challenge 5', () => { + test('It should check if url is https', () => { + + expect(isSecure('http://www.insecure.com')).toBe(false); + expect(isSecure('https://secure.com')).toBe(true); + expect(isSecure('https:/missingslash.org')).toBe(false); + }); +}); + +xdescribe('Testing challenge 6', () => { + test('It should return true if there are three in a row', () => { + expect(detectTicTacToeWin([['X', '', 'O'], ['X', 'O', ''], ['X', 'O', 'X']])).toStrictEqual(true); + expect(detectTicTacToeWin([['O', '', 'X'], ['X', 'O', 'X'], ['X', '', 'O']])).toStrictEqual(true); + }); + + test('It should return false if there are not three in a row', () => { + expect(detectTicTacToeWin([['X', '', 'O'], ['O', 'O', ''], ['X', 'O', 'X']])).toStrictEqual(false); + }); + + test('It should not treat empty 3 in row as winner', () => { + expect(detectTicTacToeWin([['', '', ''], ['O', 'O', ''], ['X', 'O', 'X']])).toEqual(false); + }); +}); diff --git a/package-lock.json b/package-lock.json index 8557305..f8c0c85 100644 --- a/package-lock.json +++ b/package-lock.json @@ -342,9 +342,9 @@ } }, "@eslint/eslintrc": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.1.3.tgz", - "integrity": "sha512-4YVwPkANLeNtRjMekzux1ci8hIaH5eGKktGqR0d3LWsKNn5B2X/1Z6Trxy7jQXl9EBGE6Yj02O+t09FMeRllaA==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.2.0.tgz", + "integrity": "sha512-+cIGPCBdLCzqxdtwppswP+zTsH9BOIGzAeKfBIbtb4gW/giMlfMwP0HUSFfhzh20f9u8uZ8hOp62+4GPquTbwQ==", "requires": { "ajv": "^6.12.4", "debug": "^4.1.1", @@ -383,46 +383,46 @@ "integrity": "sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw==" }, "@jest/console": { - "version": "26.5.2", - "resolved": "https://registry.npmjs.org/@jest/console/-/console-26.5.2.tgz", - "integrity": "sha512-lJELzKINpF1v74DXHbCRIkQ/+nUV1M+ntj+X1J8LxCgpmJZjfLmhFejiMSbjjD66fayxl5Z06tbs3HMyuik6rw==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-26.6.1.tgz", + "integrity": "sha512-cjqcXepwC5M+VeIhwT6Xpi/tT4AiNzlIx8SMJ9IihduHnsSrnWNvTBfKIpmqOOCNOPqtbBx6w2JqfoLOJguo8g==", "requires": { - "@jest/types": "^26.5.2", + "@jest/types": "^26.6.1", "@types/node": "*", "chalk": "^4.0.0", - "jest-message-util": "^26.5.2", - "jest-util": "^26.5.2", + "jest-message-util": "^26.6.1", + "jest-util": "^26.6.1", "slash": "^3.0.0" } }, "@jest/core": { - "version": "26.5.3", - "resolved": "https://registry.npmjs.org/@jest/core/-/core-26.5.3.tgz", - "integrity": "sha512-CiU0UKFF1V7KzYTVEtFbFmGLdb2g4aTtY0WlyUfLgj/RtoTnJFhh50xKKr7OYkdmBUlGFSa2mD1TU3UZ6OLd4g==", - "requires": { - "@jest/console": "^26.5.2", - "@jest/reporters": "^26.5.3", - "@jest/test-result": "^26.5.2", - "@jest/transform": "^26.5.2", - "@jest/types": "^26.5.2", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-26.6.1.tgz", + "integrity": "sha512-p4F0pgK3rKnoS9olXXXOkbus1Bsu6fd8pcvLMPsUy4CVXZ8WSeiwQ1lK5hwkCIqJ+amZOYPd778sbPha/S8Srw==", + "requires": { + "@jest/console": "^26.6.1", + "@jest/reporters": "^26.6.1", + "@jest/test-result": "^26.6.1", + "@jest/transform": "^26.6.1", + "@jest/types": "^26.6.1", "@types/node": "*", "ansi-escapes": "^4.2.1", "chalk": "^4.0.0", "exit": "^0.1.2", "graceful-fs": "^4.2.4", - "jest-changed-files": "^26.5.2", - "jest-config": "^26.5.3", - "jest-haste-map": "^26.5.2", - "jest-message-util": "^26.5.2", + "jest-changed-files": "^26.6.1", + "jest-config": "^26.6.1", + "jest-haste-map": "^26.6.1", + "jest-message-util": "^26.6.1", "jest-regex-util": "^26.0.0", - "jest-resolve": "^26.5.2", - "jest-resolve-dependencies": "^26.5.3", - "jest-runner": "^26.5.3", - "jest-runtime": "^26.5.3", - "jest-snapshot": "^26.5.3", - "jest-util": "^26.5.2", - "jest-validate": "^26.5.3", - "jest-watcher": "^26.5.2", + "jest-resolve": "^26.6.1", + "jest-resolve-dependencies": "^26.6.1", + "jest-runner": "^26.6.1", + "jest-runtime": "^26.6.1", + "jest-snapshot": "^26.6.1", + "jest-util": "^26.6.1", + "jest-validate": "^26.6.1", + "jest-watcher": "^26.6.1", "micromatch": "^4.0.2", "p-each-series": "^2.1.0", "rimraf": "^3.0.0", @@ -441,49 +441,49 @@ } }, "@jest/environment": { - "version": "26.5.2", - "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-26.5.2.tgz", - "integrity": "sha512-YjhCD/Zhkz0/1vdlS/QN6QmuUdDkpgBdK4SdiVg4Y19e29g4VQYN5Xg8+YuHjdoWGY7wJHMxc79uDTeTOy9Ngw==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-26.6.1.tgz", + "integrity": "sha512-GNvHwkOFJtNgSwdzH9flUPzF9AYAZhUg124CBoQcwcZCM9s5TLz8Y3fMtiaWt4ffbigoetjGk5PU2Dd8nLrSEw==", "requires": { - "@jest/fake-timers": "^26.5.2", - "@jest/types": "^26.5.2", + "@jest/fake-timers": "^26.6.1", + "@jest/types": "^26.6.1", "@types/node": "*", - "jest-mock": "^26.5.2" + "jest-mock": "^26.6.1" } }, "@jest/fake-timers": { - "version": "26.5.2", - "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-26.5.2.tgz", - "integrity": "sha512-09Hn5Oraqt36V1akxQeWMVL0fR9c6PnEhpgLaYvREXZJAh2H2Y+QLCsl0g7uMoJeoWJAuz4tozk1prbR1Fc1sw==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-26.6.1.tgz", + "integrity": "sha512-T/SkMLgOquenw/nIisBRD6XAYpFir0kNuclYLkse5BpzeDUukyBr+K31xgAo9M0hgjU9ORlekAYPSzc0DKfmKg==", "requires": { - "@jest/types": "^26.5.2", + "@jest/types": "^26.6.1", "@sinonjs/fake-timers": "^6.0.1", "@types/node": "*", - "jest-message-util": "^26.5.2", - "jest-mock": "^26.5.2", - "jest-util": "^26.5.2" + "jest-message-util": "^26.6.1", + "jest-mock": "^26.6.1", + "jest-util": "^26.6.1" } }, "@jest/globals": { - "version": "26.5.3", - "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-26.5.3.tgz", - "integrity": "sha512-7QztI0JC2CuB+Wx1VdnOUNeIGm8+PIaqngYsZXQCkH2QV0GFqzAYc9BZfU0nuqA6cbYrWh5wkuMzyii3P7deug==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-26.6.1.tgz", + "integrity": "sha512-acxXsSguuLV/CeMYmBseefw6apO7NuXqpE+v5r3yD9ye2PY7h1nS20vY7Obk2w6S7eJO4OIAJeDnoGcLC/McEQ==", "requires": { - "@jest/environment": "^26.5.2", - "@jest/types": "^26.5.2", - "expect": "^26.5.3" + "@jest/environment": "^26.6.1", + "@jest/types": "^26.6.1", + "expect": "^26.6.1" } }, "@jest/reporters": { - "version": "26.5.3", - "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-26.5.3.tgz", - "integrity": "sha512-X+vR0CpfMQzYcYmMFKNY9n4jklcb14Kffffp7+H/MqitWnb0440bW2L76NGWKAa+bnXhNoZr+lCVtdtPmfJVOQ==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-26.6.1.tgz", + "integrity": "sha512-J6OlXVFY3q1SXWJhjme5i7qT/BAZSikdOK2t8Ht5OS32BDo6KfG5CzIzzIFnAVd82/WWbc9Hb7SJ/jwSvVH9YA==", "requires": { "@bcoe/v8-coverage": "^0.2.3", - "@jest/console": "^26.5.2", - "@jest/test-result": "^26.5.2", - "@jest/transform": "^26.5.2", - "@jest/types": "^26.5.2", + "@jest/console": "^26.6.1", + "@jest/test-result": "^26.6.1", + "@jest/transform": "^26.6.1", + "@jest/types": "^26.6.1", "chalk": "^4.0.0", "collect-v8-coverage": "^1.0.0", "exit": "^0.1.2", @@ -494,10 +494,10 @@ "istanbul-lib-report": "^3.0.0", "istanbul-lib-source-maps": "^4.0.0", "istanbul-reports": "^3.0.2", - "jest-haste-map": "^26.5.2", - "jest-resolve": "^26.5.2", - "jest-util": "^26.5.2", - "jest-worker": "^26.5.0", + "jest-haste-map": "^26.6.1", + "jest-resolve": "^26.6.1", + "jest-util": "^26.6.1", + "jest-worker": "^26.6.1", "node-notifier": "^8.0.0", "slash": "^3.0.0", "source-map": "^0.6.0", @@ -517,43 +517,43 @@ } }, "@jest/test-result": { - "version": "26.5.2", - "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-26.5.2.tgz", - "integrity": "sha512-E/Zp6LURJEGSCWpoMGmCFuuEI1OWuI3hmZwmULV0GsgJBh7u0rwqioxhRU95euUuviqBDN8ruX/vP/4bwYolXw==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-26.6.1.tgz", + "integrity": "sha512-wqAgIerIN2gSdT2A8WeA5+AFh9XQBqYGf8etK143yng3qYd0mF0ie2W5PVmgnjw4VDU6ammI9NdXrKgNhreawg==", "requires": { - "@jest/console": "^26.5.2", - "@jest/types": "^26.5.2", + "@jest/console": "^26.6.1", + "@jest/types": "^26.6.1", "@types/istanbul-lib-coverage": "^2.0.0", "collect-v8-coverage": "^1.0.0" } }, "@jest/test-sequencer": { - "version": "26.5.3", - "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-26.5.3.tgz", - "integrity": "sha512-Wqzb7aQ13L3T47xHdpUqYMOpiqz6Dx2QDDghp5AV/eUDXR7JieY+E1s233TQlNyl+PqtqgjVokmyjzX/HA51BA==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-26.6.1.tgz", + "integrity": "sha512-0csqA/XApZiNeTIPYh6koIDCACSoR6hi29T61tKJMtCZdEC+tF3PoNt7MS0oK/zKC6daBgCbqXxia5ztr/NyCQ==", "requires": { - "@jest/test-result": "^26.5.2", + "@jest/test-result": "^26.6.1", "graceful-fs": "^4.2.4", - "jest-haste-map": "^26.5.2", - "jest-runner": "^26.5.3", - "jest-runtime": "^26.5.3" + "jest-haste-map": "^26.6.1", + "jest-runner": "^26.6.1", + "jest-runtime": "^26.6.1" } }, "@jest/transform": { - "version": "26.5.2", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-26.5.2.tgz", - "integrity": "sha512-AUNjvexh+APhhmS8S+KboPz+D3pCxPvEAGduffaAJYxIFxGi/ytZQkrqcKDUU0ERBAo5R7087fyOYr2oms1seg==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-26.6.1.tgz", + "integrity": "sha512-oNFAqVtqRxZRx6vXL3I4bPKUK0BIlEeaalkwxyQGGI8oXDQBtYQBpiMe5F7qPs4QdvvFYB42gPGIMMcxXaBBxQ==", "requires": { "@babel/core": "^7.1.0", - "@jest/types": "^26.5.2", + "@jest/types": "^26.6.1", "babel-plugin-istanbul": "^6.0.0", "chalk": "^4.0.0", "convert-source-map": "^1.4.0", "fast-json-stable-stringify": "^2.0.0", "graceful-fs": "^4.2.4", - "jest-haste-map": "^26.5.2", + "jest-haste-map": "^26.6.1", "jest-regex-util": "^26.0.0", - "jest-util": "^26.5.2", + "jest-util": "^26.6.1", "micromatch": "^4.0.2", "pirates": "^4.0.1", "slash": "^3.0.0", @@ -562,9 +562,9 @@ } }, "@jest/types": { - "version": "26.5.2", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-26.5.2.tgz", - "integrity": "sha512-QDs5d0gYiyetI8q+2xWdkixVQMklReZr4ltw7GFDtb4fuJIBCE6mzj2LnitGqCuAlLap6wPyb8fpoHgwZz5fdg==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-26.6.1.tgz", + "integrity": "sha512-ywHavIKNpAVrStiRY5wiyehvcktpijpItvGiK72RAn5ctqmzvPk8OvKnvHeBqa1XdQr959CTWAJMqxI8BTibyg==", "requires": { "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", @@ -627,9 +627,9 @@ } }, "@types/graceful-fs": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.3.tgz", - "integrity": "sha512-AiHRaEB50LQg0pZmm659vNBb9f4SJ0qrAnteuzhSeAUcJKxoYgEnprg/83kppCnc2zvtCKbdZry1a5pVY3lOTQ==", + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.4.tgz", + "integrity": "sha512-mWA/4zFQhfvOA8zWkXobwJvBD7vzcxgrOQ0J5CH1votGqdq9m7+FwtGaqyCZqC3NyyBkc9z4m+iry4LlqcMWJg==", "requires": { "@types/node": "*" } @@ -842,12 +842,12 @@ "integrity": "sha512-zg7Hz2k5lI8kb7U32998pRRFin7zJlkfezGJjUc2heaD4Pw2wObakCDVzkKztTm/Ln7eiVvYsjqak0Ed4LkMDA==" }, "babel-jest": { - "version": "26.5.2", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-26.5.2.tgz", - "integrity": "sha512-U3KvymF3SczA3vOL/cgiUFOznfMET+XDIXiWnoJV45siAp2pLMG8i2+/MGZlAC3f/F6Q40LR4M4qDrWZ9wkK8A==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-26.6.1.tgz", + "integrity": "sha512-duMWEOKrSBYRVTTNpL2SipNIWnZOjP77auOBMPQ3zXAdnDbyZQWU8r/RxNWpUf9N6cgPFecQYelYLytTVXVDtA==", "requires": { - "@jest/transform": "^26.5.2", - "@jest/types": "^26.5.2", + "@jest/transform": "^26.6.1", + "@jest/types": "^26.6.1", "@types/babel__core": "^7.1.7", "babel-plugin-istanbul": "^6.0.0", "babel-preset-jest": "^26.5.0", @@ -1116,6 +1116,11 @@ "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==" }, + "cjs-module-lexer": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-0.4.3.tgz", + "integrity": "sha512-5RLK0Qfs0PNDpEyBXIr3bIT1Muw3ojSlvpw6dAmkUcO0+uTrsBn7GuEIgx40u+OzbCBLDta7nvmud85P4EmTsQ==" + }, "class-utils": { "version": "0.3.6", "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", @@ -1555,12 +1560,12 @@ } }, "eslint": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.11.0.tgz", - "integrity": "sha512-G9+qtYVCHaDi1ZuWzBsOWo2wSwd70TXnU6UHA3cTYHp7gCTXZcpggWFoUVAMRarg68qtPoNfFbzPh+VdOgmwmw==", + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.12.0.tgz", + "integrity": "sha512-n5pEU27DRxCSlOhJ2rO57GDLcNsxO0LPpAbpFdh7xmcDmjmlGUfoyrsB3I7yYdQXO5N3gkSTiDrPSPNFiiirXA==", "requires": { "@babel/code-frame": "^7.0.0", - "@eslint/eslintrc": "^0.1.3", + "@eslint/eslintrc": "^0.2.0", "ajv": "^6.10.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", @@ -1804,15 +1809,15 @@ } }, "expect": { - "version": "26.5.3", - "resolved": "https://registry.npmjs.org/expect/-/expect-26.5.3.tgz", - "integrity": "sha512-kkpOhGRWGOr+TEFUnYAjfGvv35bfP+OlPtqPIJpOCR9DVtv8QV+p8zG0Edqafh80fsjeE+7RBcVUq1xApnYglw==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/expect/-/expect-26.6.1.tgz", + "integrity": "sha512-BRfxIBHagghMmr1D2MRY0Qv5d3Nc8HCqgbDwNXw/9izmM5eBb42a2YjLKSbsqle76ozGkAEPELQX4IdNHAKRNA==", "requires": { - "@jest/types": "^26.5.2", + "@jest/types": "^26.6.1", "ansi-styles": "^4.0.0", "jest-get-type": "^26.3.0", - "jest-matcher-utils": "^26.5.2", - "jest-message-util": "^26.5.2", + "jest-matcher-utils": "^26.6.1", + "jest-message-util": "^26.6.1", "jest-regex-util": "^26.0.0" }, "dependencies": { @@ -2034,6 +2039,11 @@ "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", "optional": true }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, "functional-red-black-tree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", @@ -2129,6 +2139,14 @@ "har-schema": "^2.0.0" } }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "requires": { + "function-bind": "^1.1.1" + } + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -2318,6 +2336,14 @@ "ci-info": "^2.0.0" } }, + "is-core-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.0.0.tgz", + "integrity": "sha512-jq1AH6C8MuteOoBPwkxHafmByhL9j5q4OaPGdbuD+ZtQJVzH+i6E3BJDQcBA09k57i2Hh2yQbEG8yObZ0jdlWw==", + "requires": { + "has": "^1.0.3" + } + }, "is-data-descriptor": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", @@ -2517,31 +2543,31 @@ } }, "jest": { - "version": "26.5.3", - "resolved": "https://registry.npmjs.org/jest/-/jest-26.5.3.tgz", - "integrity": "sha512-uJi3FuVSLmkZrWvaDyaVTZGLL8WcfynbRnFXyAHuEtYiSZ+ijDDIMOw1ytmftK+y/+OdAtsG9QrtbF7WIBmOyA==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/jest/-/jest-26.6.1.tgz", + "integrity": "sha512-f+ahfqw3Ffy+9vA7sWFGpTmhtKEMsNAZiWBVXDkrpIO73zIz22iimjirnV78kh/eWlylmvLh/0WxHN6fZraZdA==", "requires": { - "@jest/core": "^26.5.3", + "@jest/core": "^26.6.1", "import-local": "^3.0.2", - "jest-cli": "^26.5.3" + "jest-cli": "^26.6.1" }, "dependencies": { "jest-cli": { - "version": "26.5.3", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-26.5.3.tgz", - "integrity": "sha512-HkbSvtugpSXBf2660v9FrNVUgxvPkssN8CRGj9gPM8PLhnaa6zziFiCEKQAkQS4uRzseww45o0TR+l6KeRYV9A==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-26.6.1.tgz", + "integrity": "sha512-aPLoEjlwFrCWhiPpW5NUxQA1X1kWsAnQcQ0SO/fHsCvczL3W75iVAcH9kP6NN+BNqZcHNEvkhxT5cDmBfEAh+w==", "requires": { - "@jest/core": "^26.5.3", - "@jest/test-result": "^26.5.2", - "@jest/types": "^26.5.2", + "@jest/core": "^26.6.1", + "@jest/test-result": "^26.6.1", + "@jest/types": "^26.6.1", "chalk": "^4.0.0", "exit": "^0.1.2", "graceful-fs": "^4.2.4", "import-local": "^3.0.2", "is-ci": "^2.0.0", - "jest-config": "^26.5.3", - "jest-util": "^26.5.2", - "jest-validate": "^26.5.3", + "jest-config": "^26.6.1", + "jest-util": "^26.6.1", + "jest-validate": "^26.6.1", "prompts": "^2.0.1", "yargs": "^15.4.1" } @@ -2549,11 +2575,11 @@ } }, "jest-changed-files": { - "version": "26.5.2", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-26.5.2.tgz", - "integrity": "sha512-qSmssmiIdvM5BWVtyK/nqVpN3spR5YyvkvPqz1x3BR1bwIxsWmU/MGwLoCrPNLbkG2ASAKfvmJpOduEApBPh2w==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-26.6.1.tgz", + "integrity": "sha512-NhSdZ5F6b/rIN5V46x1l31vrmukD/bJUXgYAY8VtP1SknYdJwjYDRxuLt7Z8QryIdqCjMIn2C0Cd98EZ4umo8Q==", "requires": { - "@jest/types": "^26.5.2", + "@jest/types": "^26.6.1", "execa": "^4.0.0", "throat": "^5.0.0" }, @@ -2598,39 +2624,39 @@ } }, "jest-config": { - "version": "26.5.3", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-26.5.3.tgz", - "integrity": "sha512-NVhZiIuN0GQM6b6as4CI5FSCyXKxdrx5ACMCcv/7Pf+TeCajJhJc+6dwgdAVPyerUFB9pRBIz3bE7clSrRge/w==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-26.6.1.tgz", + "integrity": "sha512-mtJzIynIwW1d1nMlKCNCQiSgWaqFn8cH/fOSNY97xG7Y9tBCZbCSuW2GTX0RPmceSJGO7l27JgwC18LEg0Vg+g==", "requires": { "@babel/core": "^7.1.0", - "@jest/test-sequencer": "^26.5.3", - "@jest/types": "^26.5.2", - "babel-jest": "^26.5.2", + "@jest/test-sequencer": "^26.6.1", + "@jest/types": "^26.6.1", + "babel-jest": "^26.6.1", "chalk": "^4.0.0", "deepmerge": "^4.2.2", "glob": "^7.1.1", "graceful-fs": "^4.2.4", - "jest-environment-jsdom": "^26.5.2", - "jest-environment-node": "^26.5.2", + "jest-environment-jsdom": "^26.6.1", + "jest-environment-node": "^26.6.1", "jest-get-type": "^26.3.0", - "jest-jasmine2": "^26.5.3", + "jest-jasmine2": "^26.6.1", "jest-regex-util": "^26.0.0", - "jest-resolve": "^26.5.2", - "jest-util": "^26.5.2", - "jest-validate": "^26.5.3", + "jest-resolve": "^26.6.1", + "jest-util": "^26.6.1", + "jest-validate": "^26.6.1", "micromatch": "^4.0.2", - "pretty-format": "^26.5.2" + "pretty-format": "^26.6.1" } }, "jest-diff": { - "version": "26.5.2", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-26.5.2.tgz", - "integrity": "sha512-HCSWDUGwsov5oTlGzrRM+UPJI/Dpqi9jzeV0fdRNi3Ch5bnoXhnyJMmVg2juv9081zLIy3HGPI5mcuGgXM2xRA==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-26.6.1.tgz", + "integrity": "sha512-BBNy/zin2m4kG5In126O8chOBxLLS/XMTuuM2+YhgyHk87ewPzKTuTJcqj3lOWOi03NNgrl+DkMeV/exdvG9gg==", "requires": { "chalk": "^4.0.0", "diff-sequences": "^26.5.0", "jest-get-type": "^26.3.0", - "pretty-format": "^26.5.2" + "pretty-format": "^26.6.1" } }, "jest-docblock": { @@ -2642,42 +2668,42 @@ } }, "jest-each": { - "version": "26.5.2", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-26.5.2.tgz", - "integrity": "sha512-w7D9FNe0m2D3yZ0Drj9CLkyF/mGhmBSULMQTypzAKR746xXnjUrK8GUJdlLTWUF6dd0ks3MtvGP7/xNFr9Aphg==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-26.6.1.tgz", + "integrity": "sha512-gSn8eB3buchuq45SU7pLB7qmCGax1ZSxfaWuEFblCyNMtyokYaKFh9dRhYPujK6xYL57dLIPhLKatjmB5XWzGA==", "requires": { - "@jest/types": "^26.5.2", + "@jest/types": "^26.6.1", "chalk": "^4.0.0", "jest-get-type": "^26.3.0", - "jest-util": "^26.5.2", - "pretty-format": "^26.5.2" + "jest-util": "^26.6.1", + "pretty-format": "^26.6.1" } }, "jest-environment-jsdom": { - "version": "26.5.2", - "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-26.5.2.tgz", - "integrity": "sha512-fWZPx0bluJaTQ36+PmRpvUtUlUFlGGBNyGX1SN3dLUHHMcQ4WseNEzcGGKOw4U5towXgxI4qDoI3vwR18H0RTw==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-26.6.1.tgz", + "integrity": "sha512-A17RiXuHYNVlkM+3QNcQ6n5EZyAc6eld8ra9TW26luounGWpku4tj03uqRgHJCI1d4uHr5rJiuCH5JFRtdmrcA==", "requires": { - "@jest/environment": "^26.5.2", - "@jest/fake-timers": "^26.5.2", - "@jest/types": "^26.5.2", + "@jest/environment": "^26.6.1", + "@jest/fake-timers": "^26.6.1", + "@jest/types": "^26.6.1", "@types/node": "*", - "jest-mock": "^26.5.2", - "jest-util": "^26.5.2", + "jest-mock": "^26.6.1", + "jest-util": "^26.6.1", "jsdom": "^16.4.0" } }, "jest-environment-node": { - "version": "26.5.2", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-26.5.2.tgz", - "integrity": "sha512-YHjnDsf/GKFCYMGF1V+6HF7jhY1fcLfLNBDjhAOvFGvt6d8vXvNdJGVM7uTZ2VO/TuIyEFhPGaXMX5j3h7fsrA==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-26.6.1.tgz", + "integrity": "sha512-YffaCp6h0j1kbcf1NVZ7umC6CPgD67YS+G1BeornfuSkx5s3xdhuwG0DCxSiHPXyT81FfJzA1L7nXvhq50OWIg==", "requires": { - "@jest/environment": "^26.5.2", - "@jest/fake-timers": "^26.5.2", - "@jest/types": "^26.5.2", + "@jest/environment": "^26.6.1", + "@jest/fake-timers": "^26.6.1", + "@jest/types": "^26.6.1", "@types/node": "*", - "jest-mock": "^26.5.2", - "jest-util": "^26.5.2" + "jest-mock": "^26.6.1", + "jest-util": "^26.6.1" } }, "jest-get-type": { @@ -2686,11 +2712,11 @@ "integrity": "sha512-TpfaviN1R2pQWkIihlfEanwOXK0zcxrKEE4MlU6Tn7keoXdN6/3gK/xl0yEh8DOunn5pOVGKf8hB4R9gVh04ig==" }, "jest-haste-map": { - "version": "26.5.2", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-26.5.2.tgz", - "integrity": "sha512-lJIAVJN3gtO3k4xy+7i2Xjtwh8CfPcH08WYjZpe9xzveDaqGw9fVNCpkYu6M525wKFVkLmyi7ku+DxCAP1lyMA==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-26.6.1.tgz", + "integrity": "sha512-9kPafkv0nX6ta1PrshnkiyhhoQoFWncrU/uUBt3/AP1r78WSCU5iLceYRTwDvJl67H3RrXqSlSVDDa/AsUB7OQ==", "requires": { - "@jest/types": "^26.5.2", + "@jest/types": "^26.6.1", "@types/graceful-fs": "^4.1.2", "@types/node": "*", "anymatch": "^3.0.3", @@ -2699,65 +2725,65 @@ "graceful-fs": "^4.2.4", "jest-regex-util": "^26.0.0", "jest-serializer": "^26.5.0", - "jest-util": "^26.5.2", - "jest-worker": "^26.5.0", + "jest-util": "^26.6.1", + "jest-worker": "^26.6.1", "micromatch": "^4.0.2", "sane": "^4.0.3", "walker": "^1.0.7" } }, "jest-jasmine2": { - "version": "26.5.3", - "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-26.5.3.tgz", - "integrity": "sha512-nFlZOpnGlNc7y/+UkkeHnvbOM+rLz4wB1AimgI9QhtnqSZte0wYjbAm8hf7TCwXlXgDwZxAXo6z0a2Wzn9FoOg==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-26.6.1.tgz", + "integrity": "sha512-2uYdT32o/ZzSxYAPduAgokO8OlAL1YdG/9oxcEY138EDNpIK5XRRJDaGzTZdIBWSxk0aR8XxN44FvfXtHB+Fiw==", "requires": { "@babel/traverse": "^7.1.0", - "@jest/environment": "^26.5.2", + "@jest/environment": "^26.6.1", "@jest/source-map": "^26.5.0", - "@jest/test-result": "^26.5.2", - "@jest/types": "^26.5.2", + "@jest/test-result": "^26.6.1", + "@jest/types": "^26.6.1", "@types/node": "*", "chalk": "^4.0.0", "co": "^4.6.0", - "expect": "^26.5.3", + "expect": "^26.6.1", "is-generator-fn": "^2.0.0", - "jest-each": "^26.5.2", - "jest-matcher-utils": "^26.5.2", - "jest-message-util": "^26.5.2", - "jest-runtime": "^26.5.3", - "jest-snapshot": "^26.5.3", - "jest-util": "^26.5.2", - "pretty-format": "^26.5.2", + "jest-each": "^26.6.1", + "jest-matcher-utils": "^26.6.1", + "jest-message-util": "^26.6.1", + "jest-runtime": "^26.6.1", + "jest-snapshot": "^26.6.1", + "jest-util": "^26.6.1", + "pretty-format": "^26.6.1", "throat": "^5.0.0" } }, "jest-leak-detector": { - "version": "26.5.2", - "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-26.5.2.tgz", - "integrity": "sha512-h7ia3dLzBFItmYERaLPEtEKxy3YlcbcRSjj0XRNJgBEyODuu+3DM2o62kvIFvs3PsaYoIIv+e+nLRI61Dj1CNw==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-26.6.1.tgz", + "integrity": "sha512-j9ZOtJSJKlHjrs4aIxWjiQUjyrffPdiAQn2Iw0916w7qZE5Lk0T2KhIH6E9vfhzP6sw0Q0jtnLLb4vQ71o1HlA==", "requires": { "jest-get-type": "^26.3.0", - "pretty-format": "^26.5.2" + "pretty-format": "^26.6.1" } }, "jest-matcher-utils": { - "version": "26.5.2", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-26.5.2.tgz", - "integrity": "sha512-W9GO9KBIC4gIArsNqDUKsLnhivaqf8MSs6ujO/JDcPIQrmY+aasewweXVET8KdrJ6ADQaUne5UzysvF/RR7JYA==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-26.6.1.tgz", + "integrity": "sha512-9iu3zrsYlUnl8pByhREF9rr5eYoiEb1F7ymNKg6lJr/0qD37LWS5FSW/JcoDl8UdMX2+zAzabDs7sTO+QFKjCg==", "requires": { "chalk": "^4.0.0", - "jest-diff": "^26.5.2", + "jest-diff": "^26.6.1", "jest-get-type": "^26.3.0", - "pretty-format": "^26.5.2" + "pretty-format": "^26.6.1" } }, "jest-message-util": { - "version": "26.5.2", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-26.5.2.tgz", - "integrity": "sha512-Ocp9UYZ5Jl15C5PNsoDiGEk14A4NG0zZKknpWdZGoMzJuGAkVt10e97tnEVMYpk7LnQHZOfuK2j/izLBMcuCZw==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-26.6.1.tgz", + "integrity": "sha512-cqM4HnqncIebBNdTKrBoWR/4ufHTll0pK/FWwX0YasK+TlBQEMqw3IEdynuuOTjDPFO3ONlFn37280X48beByw==", "requires": { "@babel/code-frame": "^7.0.0", - "@jest/types": "^26.5.2", + "@jest/types": "^26.6.1", "@types/stack-utils": "^2.0.0", "chalk": "^4.0.0", "graceful-fs": "^4.2.4", @@ -2767,11 +2793,11 @@ } }, "jest-mock": { - "version": "26.5.2", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-26.5.2.tgz", - "integrity": "sha512-9SiU4b5PtO51v0MtJwVRqeGEroH66Bnwtq4ARdNP7jNXbpT7+ByeWNAk4NeT/uHfNSVDXEXgQo1XRuwEqS6Rdw==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-26.6.1.tgz", + "integrity": "sha512-my0lPTBu1awY8iVG62sB2sx9qf8zxNDVX+5aFgoB8Vbqjb6LqIOsfyFA8P1z6H2IsqMbvOX9oCJnK67Y3yUIMA==", "requires": { - "@jest/types": "^26.5.2", + "@jest/types": "^26.6.1", "@types/node": "*" } }, @@ -2786,85 +2812,86 @@ "integrity": "sha512-Gv3ZIs/nA48/Zvjrl34bf+oD76JHiGDUxNOVgUjh3j890sblXryjY4rss71fPtD/njchl6PSE2hIhvyWa1eT0A==" }, "jest-resolve": { - "version": "26.5.2", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-26.5.2.tgz", - "integrity": "sha512-XsPxojXGRA0CoDD7Vis59ucz2p3cQFU5C+19tz3tLEAlhYKkK77IL0cjYjikY9wXnOaBeEdm1rOgSJjbZWpcZg==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-26.6.1.tgz", + "integrity": "sha512-hiHfQH6rrcpAmw9xCQ0vD66SDuU+7ZulOuKwc4jpbmFFsz0bQG/Ib92K+9/489u5rVw0btr/ZhiHqBpmkbCvuQ==", "requires": { - "@jest/types": "^26.5.2", + "@jest/types": "^26.6.1", "chalk": "^4.0.0", "graceful-fs": "^4.2.4", "jest-pnp-resolver": "^1.2.2", - "jest-util": "^26.5.2", + "jest-util": "^26.6.1", "read-pkg-up": "^7.0.1", - "resolve": "^1.17.0", + "resolve": "^1.18.1", "slash": "^3.0.0" } }, "jest-resolve-dependencies": { - "version": "26.5.3", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-26.5.3.tgz", - "integrity": "sha512-+KMDeke/BFK+mIQ2IYSyBz010h7zQaVt4Xie6cLqUGChorx66vVeQVv4ErNoMwInnyYHi1Ud73tDS01UbXbfLQ==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-26.6.1.tgz", + "integrity": "sha512-MN6lufbZJ3RBfTnJesZtHu3hUCBqPdHRe2+FhIt0yiqJ3fMgzWRqMRQyN/d/QwOE7KXwAG2ekZutbPhuD7s51A==", "requires": { - "@jest/types": "^26.5.2", + "@jest/types": "^26.6.1", "jest-regex-util": "^26.0.0", - "jest-snapshot": "^26.5.3" + "jest-snapshot": "^26.6.1" } }, "jest-runner": { - "version": "26.5.3", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-26.5.3.tgz", - "integrity": "sha512-qproP0Pq7IIule+263W57k2+8kWCszVJTC9TJWGUz0xJBr+gNiniGXlG8rotd0XxwonD5UiJloYoSO5vbUr5FQ==", - "requires": { - "@jest/console": "^26.5.2", - "@jest/environment": "^26.5.2", - "@jest/test-result": "^26.5.2", - "@jest/types": "^26.5.2", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-26.6.1.tgz", + "integrity": "sha512-DmpNGdgsbl5s0FGkmsInmqnmqCtliCSnjWA2TFAJS1m1mL5atwfPsf+uoZ8uYQ2X0uDj4NM+nPcDnUpbNTRMBA==", + "requires": { + "@jest/console": "^26.6.1", + "@jest/environment": "^26.6.1", + "@jest/test-result": "^26.6.1", + "@jest/types": "^26.6.1", "@types/node": "*", "chalk": "^4.0.0", "emittery": "^0.7.1", "exit": "^0.1.2", "graceful-fs": "^4.2.4", - "jest-config": "^26.5.3", + "jest-config": "^26.6.1", "jest-docblock": "^26.0.0", - "jest-haste-map": "^26.5.2", - "jest-leak-detector": "^26.5.2", - "jest-message-util": "^26.5.2", - "jest-resolve": "^26.5.2", - "jest-runtime": "^26.5.3", - "jest-util": "^26.5.2", - "jest-worker": "^26.5.0", + "jest-haste-map": "^26.6.1", + "jest-leak-detector": "^26.6.1", + "jest-message-util": "^26.6.1", + "jest-resolve": "^26.6.1", + "jest-runtime": "^26.6.1", + "jest-util": "^26.6.1", + "jest-worker": "^26.6.1", "source-map-support": "^0.5.6", "throat": "^5.0.0" } }, "jest-runtime": { - "version": "26.5.3", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-26.5.3.tgz", - "integrity": "sha512-IDjalmn2s/Tc4GvUwhPHZ0iaXCdMRq5p6taW9P8RpU+FpG01O3+H8z+p3rDCQ9mbyyyviDgxy/LHPLzrIOKBkQ==", - "requires": { - "@jest/console": "^26.5.2", - "@jest/environment": "^26.5.2", - "@jest/fake-timers": "^26.5.2", - "@jest/globals": "^26.5.3", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-26.6.1.tgz", + "integrity": "sha512-7uOCNeezXDWgjEyzYbRN2ViY7xNZzusNVGAMmU0UHRUNXuY4j4GBHKGMqPo/cBPZA9bSYp+lwK2DRRBU5Dv6YQ==", + "requires": { + "@jest/console": "^26.6.1", + "@jest/environment": "^26.6.1", + "@jest/fake-timers": "^26.6.1", + "@jest/globals": "^26.6.1", "@jest/source-map": "^26.5.0", - "@jest/test-result": "^26.5.2", - "@jest/transform": "^26.5.2", - "@jest/types": "^26.5.2", + "@jest/test-result": "^26.6.1", + "@jest/transform": "^26.6.1", + "@jest/types": "^26.6.1", "@types/yargs": "^15.0.0", "chalk": "^4.0.0", + "cjs-module-lexer": "^0.4.2", "collect-v8-coverage": "^1.0.0", "exit": "^0.1.2", "glob": "^7.1.3", "graceful-fs": "^4.2.4", - "jest-config": "^26.5.3", - "jest-haste-map": "^26.5.2", - "jest-message-util": "^26.5.2", - "jest-mock": "^26.5.2", + "jest-config": "^26.6.1", + "jest-haste-map": "^26.6.1", + "jest-message-util": "^26.6.1", + "jest-mock": "^26.6.1", "jest-regex-util": "^26.0.0", - "jest-resolve": "^26.5.2", - "jest-snapshot": "^26.5.3", - "jest-util": "^26.5.2", - "jest-validate": "^26.5.3", + "jest-resolve": "^26.6.1", + "jest-snapshot": "^26.6.1", + "jest-util": "^26.6.1", + "jest-validate": "^26.6.1", "slash": "^3.0.0", "strip-bom": "^4.0.0", "yargs": "^15.4.1" @@ -2880,34 +2907,34 @@ } }, "jest-snapshot": { - "version": "26.5.3", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-26.5.3.tgz", - "integrity": "sha512-ZgAk0Wm0JJ75WS4lGaeRfa0zIgpL0KD595+XmtwlIEMe8j4FaYHyZhP1LNOO+8fXq7HJ3hll54+sFV9X4+CGVw==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-26.6.1.tgz", + "integrity": "sha512-JA7bZp7HRTIJYAi85pJ/OZ2eur2dqmwIToA5/6d7Mn90isGEfeF9FvuhDLLEczgKP1ihreBzrJ6Vr7zteP5JNA==", "requires": { "@babel/types": "^7.0.0", - "@jest/types": "^26.5.2", + "@jest/types": "^26.6.1", "@types/babel__traverse": "^7.0.4", "@types/prettier": "^2.0.0", "chalk": "^4.0.0", - "expect": "^26.5.3", + "expect": "^26.6.1", "graceful-fs": "^4.2.4", - "jest-diff": "^26.5.2", + "jest-diff": "^26.6.1", "jest-get-type": "^26.3.0", - "jest-haste-map": "^26.5.2", - "jest-matcher-utils": "^26.5.2", - "jest-message-util": "^26.5.2", - "jest-resolve": "^26.5.2", + "jest-haste-map": "^26.6.1", + "jest-matcher-utils": "^26.6.1", + "jest-message-util": "^26.6.1", + "jest-resolve": "^26.6.1", "natural-compare": "^1.4.0", - "pretty-format": "^26.5.2", + "pretty-format": "^26.6.1", "semver": "^7.3.2" } }, "jest-util": { - "version": "26.5.2", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-26.5.2.tgz", - "integrity": "sha512-WTL675bK+GSSAYgS8z9FWdCT2nccO1yTIplNLPlP0OD8tUk/H5IrWKMMRudIQQ0qp8bb4k+1Qa8CxGKq9qnYdg==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-26.6.1.tgz", + "integrity": "sha512-xCLZUqVoqhquyPLuDXmH7ogceGctbW8SMyQVjD9o+1+NPWI7t0vO08udcFLVPLgKWcvc+zotaUv/RuaR6l8HIA==", "requires": { - "@jest/types": "^26.5.2", + "@jest/types": "^26.6.1", "@types/node": "*", "chalk": "^4.0.0", "graceful-fs": "^4.2.4", @@ -2916,16 +2943,16 @@ } }, "jest-validate": { - "version": "26.5.3", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-26.5.3.tgz", - "integrity": "sha512-LX07qKeAtY+lsU0o3IvfDdN5KH9OulEGOMN1sFo6PnEf5/qjS1LZIwNk9blcBeW94pQUI9dLN9FlDYDWI5tyaA==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-26.6.1.tgz", + "integrity": "sha512-BEFpGbylKocnNPZULcnk+TGaz1oFZQH/wcaXlaXABbu0zBwkOGczuWgdLucUouuQqn7VadHZZeTvo8VSFDLMOA==", "requires": { - "@jest/types": "^26.5.2", + "@jest/types": "^26.6.1", "camelcase": "^6.0.0", "chalk": "^4.0.0", "jest-get-type": "^26.3.0", "leven": "^3.1.0", - "pretty-format": "^26.5.2" + "pretty-format": "^26.6.1" }, "dependencies": { "camelcase": { @@ -2936,23 +2963,23 @@ } }, "jest-watcher": { - "version": "26.5.2", - "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-26.5.2.tgz", - "integrity": "sha512-i3m1NtWzF+FXfJ3ljLBB/WQEp4uaNhX7QcQUWMokcifFTUQBDFyUMEwk0JkJ1kopHbx7Een3KX0Q7+9koGM/Pw==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-26.6.1.tgz", + "integrity": "sha512-0LBIPPncNi9CaLKK15bnxyd2E8OMl4kJg0PTiNOI+MXztXw1zVdtX/x9Pr6pXaQYps+eS/ts43O4+HByZ7yJSw==", "requires": { - "@jest/test-result": "^26.5.2", - "@jest/types": "^26.5.2", + "@jest/test-result": "^26.6.1", + "@jest/types": "^26.6.1", "@types/node": "*", "ansi-escapes": "^4.2.1", "chalk": "^4.0.0", - "jest-util": "^26.5.2", + "jest-util": "^26.6.1", "string-length": "^4.0.1" } }, "jest-worker": { - "version": "26.5.0", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-26.5.0.tgz", - "integrity": "sha512-kTw66Dn4ZX7WpjZ7T/SUDgRhapFRKWmisVAF0Rv4Fu8SLFD7eLbqpLvbxVqYhSgaWa7I+bW7pHnbyfNsH6stug==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-26.6.1.tgz", + "integrity": "sha512-R5IE3qSGz+QynJx8y+ICEkdI2OJ3RJjRQVEyCcFAd3yVhQSEtquziPO29Mlzgn07LOVE8u8jhJ1FqcwegiXWOw==", "requires": { "@types/node": "*", "merge-stream": "^2.0.0", @@ -3558,14 +3585,14 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==" }, "pretty-format": { - "version": "26.5.2", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-26.5.2.tgz", - "integrity": "sha512-VizyV669eqESlkOikKJI8Ryxl/kPpbdLwNdPs2GrbQs18MpySB5S0Yo0N7zkg2xTRiFq4CFw8ct5Vg4a0xP0og==", + "version": "26.6.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-26.6.1.tgz", + "integrity": "sha512-MeqqsP5PYcRBbGMvwzsyBdmAJ4EFX7pWFyl7x4+dMVg5pE0ZDdBIvEH2ergvIO+Gvwv1wh64YuOY9y5LuyY/GA==", "requires": { - "@jest/types": "^26.5.2", + "@jest/types": "^26.6.1", "ansi-regex": "^5.0.0", "ansi-styles": "^4.0.0", - "react-is": "^16.12.0" + "react-is": "^17.0.1" }, "dependencies": { "ansi-styles": { @@ -3635,9 +3662,9 @@ "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" }, "react-is": { - "version": "16.13.1", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", - "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" + "version": "17.0.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.1.tgz", + "integrity": "sha512-NAnt2iGDXohE5LI7uBnLnqvLQMtzhkiAOLXTmv+qnF9Ky7xAPcX8Up/xWIhxvLVGJvuLiNc4xQLtuqDRzb4fSA==" }, "read-pkg": { "version": "5.2.0", @@ -3789,10 +3816,11 @@ "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" }, "resolve": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", - "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.18.1.tgz", + "integrity": "sha512-lDfCPaMKfOJXjy0dPayzPdF1phampNWr3qFCjAu+rw/qbQmr5jWH5xN2hwh9QKfw9E5v4hwV7A+jrCmL8yjjqA==", "requires": { + "is-core-module": "^2.0.0", "path-parse": "^1.0.6" } }, diff --git a/package.json b/package.json index 7a2bcb5..2e10fcf 100644 --- a/package.json +++ b/package.json @@ -12,9 +12,9 @@ "license": "MIT", "dependencies": { "cheerio": "^1.0.0-rc.3", + "eslint": "^7.12.0", + "jest": "^26.6.1", "mustache": "^4.0.1", - "supertest": "^4.0.2", - "eslint": "^7.2.0", - "jest": "^26.0.1" + "supertest": "^4.0.2" } }