From dce57a70ab8cad907983ab0c809962ccee31bd4f Mon Sep 17 00:00:00 2001 From: Hadidreem17 Date: Thu, 4 Sep 2025 16:01:36 +0200 Subject: [PATCH 1/7] submit week2 assignment --- .test-summary/TEST_SUMMARY.md | 14 ++++ .../Week2/assignment/ex1-giveCompliment.js | 41 +++++----- .../Week2/assignment/ex1-giveCompliment1.js | 68 ++++++++++++++++ 1-JavaScript/Week2/assignment/ex2-dogYears.js | 37 ++++----- .../Week2/assignment/ex3-tellFortune.js | 72 ++++------------- .../Week2/assignment/ex4-shoppingCart.js | 77 ++++--------------- .../Week2/assignment/ex5-shoppingCartPure.js | 65 +++------------- .../Week2/assignment/ex6-totalCost.js | 42 +++++----- .../Week2/assignment/ex7-mindPrivacy.js | 64 ++++++--------- .../ex1-giveCompliment.report.txt | 48 ++++++++++++ .../test-reports/ex2-dogYears.report.txt | 41 ++++++++++ .../test-reports/ex3-tellFortune.report.txt | 45 +++++++++++ .../test-reports/ex4-shoppingCart.report.txt | 3 + .../ex5-shoppingCartPure.report.txt | 3 + .../test-reports/ex6-totalCost.report.txt | 3 + Assignments-Cohort54 | 1 + 16 files changed, 342 insertions(+), 282 deletions(-) create mode 100644 .test-summary/TEST_SUMMARY.md create mode 100644 1-JavaScript/Week2/assignment/ex1-giveCompliment1.js create mode 100644 1-JavaScript/Week2/test-reports/ex1-giveCompliment.report.txt create mode 100644 1-JavaScript/Week2/test-reports/ex2-dogYears.report.txt create mode 100644 1-JavaScript/Week2/test-reports/ex3-tellFortune.report.txt create mode 100644 1-JavaScript/Week2/test-reports/ex4-shoppingCart.report.txt create mode 100644 1-JavaScript/Week2/test-reports/ex5-shoppingCartPure.report.txt create mode 100644 1-JavaScript/Week2/test-reports/ex6-totalCost.report.txt create mode 160000 Assignments-Cohort54 diff --git a/.test-summary/TEST_SUMMARY.md b/.test-summary/TEST_SUMMARY.md new file mode 100644 index 000000000..a0dff3975 --- /dev/null +++ b/.test-summary/TEST_SUMMARY.md @@ -0,0 +1,14 @@ +## Test Summary + +**Mentors**: For more information on how to review homework assignments, please refer to the [Review Guide](https://github.com/HackYourFuture/mentors/blob/main/assignment-support/review-guide.md). + +### 1-JavaScript - Week2 + +| Exercise | Passed | Failed | ESLint | +|----------------------|--------|--------|--------| +| ex1-giveCompliment | 3 | 4 | ✓ | +| ex2-dogYears | 4 | 3 | ✓ | +| ex3-tellFortune | 7 | 3 | ✓ | +| ex4-shoppingCart | - | - | ✓ | +| ex5-shoppingCartPure | - | - | ✓ | +| ex6-totalCost | - | - | ✓ | diff --git a/1-JavaScript/Week2/assignment/ex1-giveCompliment.js b/1-JavaScript/Week2/assignment/ex1-giveCompliment.js index 93806cfaf..7b75aa172 100644 --- a/1-JavaScript/Week2/assignment/ex1-giveCompliment.js +++ b/1-JavaScript/Week2/assignment/ex1-giveCompliment.js @@ -3,40 +3,35 @@ Full description at: https://github.com/HackYourFuture/Assignments/tree/main/1-J 1. Complete the function named `giveCompliment`as follows: - - It should take a single parameter: `name`. - - Its function body should include a variable that holds an array, - `compliments`, initialized with 10 strings. Each string should be a - compliment, like `"great"`, `"awesome"` and so on. - - It should randomly select a compliment from the array. - - It should return the string "You are `compliment`, `name`!", where - `compliment` is a randomly selected compliment and `name` is the name that - was passed as an argument to the function. - -2. Call the function three times, giving each function call the same argument: - your name. - Use `console.log` each time to display the return value of the - `giveCompliment` function to the console. ------------------------------------------------------------------------------*/ -export function giveCompliment(/* TODO parameter(s) go here */) { - // TODO complete this function + export function giveCompliment(name) { + const compliments = [ + "great", + "awesome", + "fantastic", + "brilliant", + "wonderful", + "amazing", + "incredible", + "outstanding", + "marvelous", + "exceptional" + ]; + const i = Math.floor(Math.random() * compliments.length); + return `You are ${compliments[i]}, ${name}!`; } function main() { - // TODO substitute your own name for "HackYourFuture" - const myName = 'HackYourFuture'; - + const myName = "HackYourFuture"; console.log(giveCompliment(myName)); console.log(giveCompliment(myName)); console.log(giveCompliment(myName)); - const yourName = 'Amsterdam'; - + const yourName = "Amsterdam"; console.log(giveCompliment(yourName)); console.log(giveCompliment(yourName)); console.log(giveCompliment(yourName)); } -// ! Do not change or remove the code below -if (process.env.NODE_ENV !== 'test') { +if (process.env.NODE_ENV !== "test") { main(); } diff --git a/1-JavaScript/Week2/assignment/ex1-giveCompliment1.js b/1-JavaScript/Week2/assignment/ex1-giveCompliment1.js new file mode 100644 index 000000000..c8cee5047 --- /dev/null +++ b/1-JavaScript/Week2/assignment/ex1-giveCompliment1.js @@ -0,0 +1,68 @@ +export const compliments = [ + "great", + "awesome", + "fantastic", + "brilliant", + "wonderful", + "amazing", + "incredible", + "outstanding", + "marvelous", + "exceptional" +]; + +export function giveCompliment(name) { + const i = Math.floor(Math.random() * compliments.length); + return `You are ${compliments[i]}, ${name}!`; +} + +function main() { + const myName = "HackYourFuture"; + console.log(giveCompliment(myName)); + console.log(giveCompliment(myName)); + console.log(giveCompliment(myName)); + + const yourName = "Amsterdam"; + console.log(giveCompliment(yourName)); + console.log(giveCompliment(yourName)); + console.log(giveCompliment(yourName)); +} + +if (process.env.NODE_ENV !== "test") { + main(); +} +1. Complete the function named `giveCompliment`as follows: + + export function giveCompliment(name) { + const compliments = [ + "great", + "awesome", + "fantastic", + "brilliant", + "wonderful", + "amazing", + "incredible", + "outstanding", + "marvelous", + "exceptional" + ]; + const i = Math.floor(Math.random() * compliments.length); + return `You are ${compliments[i]}, ${name}!`; +} + +function main() { + const myName = "HackYourFuture"; + console.log(giveCompliment(myName)); + console.log(giveCompliment(myName)); + console.log(giveCompliment(myName)); + + const yourName = "Amsterdam"; + console.log(giveCompliment(yourName)); + console.log(giveCompliment(yourName)); + console.log(giveCompliment(yourName)); +} + +if (process.env.NODE_ENV !== "test") { + main(); +} + diff --git a/1-JavaScript/Week2/assignment/ex2-dogYears.js b/1-JavaScript/Week2/assignment/ex2-dogYears.js index c88d88dd6..072033c5e 100644 --- a/1-JavaScript/Week2/assignment/ex2-dogYears.js +++ b/1-JavaScript/Week2/assignment/ex2-dogYears.js @@ -1,31 +1,20 @@ -/*------------------------------------------------------------------------------ -Full description at: https://github.com/HackYourFuture/Assignment/tree/main/1-JavaScript/Week3#exercise-2-dog-years - -You know how old your dog is in human years, but what about dog years? Let's -calculate it! - -1. Complete the function named `calculateDogAge`. - - - It takes one parameter: your (fictional) puppy's age (number). - - Calculate your dog's age based on the conversion rate of 1 human year to - 7 dog years. - - Return a string: "Your doggie is `age` years old in dog years!" - -2. Use `console.log` to display the result of the function for three different - ages. ------------------------------------------------------------------------------*/ - -export function calculateDogAge(/* TODO parameter(s) go here */) { - // TODO complete this function +export function calculateDogAge(humanYears) { + return humanYears * 7; } function main() { - console.log(calculateDogAge(1)); // -> "Your doggie is 7 years old in dog years!" - console.log(calculateDogAge(2)); // -> "Your doggie is 14 years old in dog years!" - console.log(calculateDogAge(3)); // -> "Your doggie is 21 years old in dog years!" + const myAge = 25; + console.log( + `If you are ${myAge} years old, that's ${calculateDogAge(myAge)} in dog years!` + ); + + const yourAge = 40; + console.log( + `If you are ${yourAge} years old, that's ${calculateDogAge(yourAge)} in dog years!` + ); } -// ! Do not change or remove the code below -if (process.env.NODE_ENV !== 'test') { +if (process.env.NODE_ENV !== "test") { main(); } + diff --git a/1-JavaScript/Week2/assignment/ex3-tellFortune.js b/1-JavaScript/Week2/assignment/ex3-tellFortune.js index c80aae955..d8283ab91 100644 --- a/1-JavaScript/Week2/assignment/ex3-tellFortune.js +++ b/1-JavaScript/Week2/assignment/ex3-tellFortune.js @@ -1,68 +1,22 @@ -/*------------------------------------------------------------------------------ -Full description at: https://github.com/HackYourFuture/Assignments/tree/main/1-JavaScript/Week3#exercise-3-be-your-own-fortune-teller +export function tellFortune() { + const numKids = [0, 1, 2, 3, 4]; + const partnerNames = ["Alex", "Sam", "Taylor", "Jordan", "Casey"]; + const locations = ["Amsterdam", "Rotterdam", "Utrecht", "The Hague", "Eindhoven"]; + const jobs = ["developer", "designer", "teacher", "engineer", "chef"]; -Why pay a fortune teller when you can just program your fortune yourself? + const pick = (arr) => arr[Math.floor(Math.random() * arr.length)]; -1. Create four arrays, `numKids`, `partnerNames`, `locations` and `jobTitles`. - Give each array five random values that have to do with the name of - the variable. - -2. Complete the function `selectRandomly`. This function should take an array - as a parameter and return a randomly selected element as its return value. - -3. Complete the function named `tellFortune` as follows: - - - It should take four arguments (in the order listed): - * the array with the options for the number of children, - * the array with the options for the partner's name, - * the array with the options for the geographic location and - * the array with the options for the job title. - - It should use the `selectRandomly` function to randomly select values from - the arrays. - - It should return a string: "You will be a `jobTitle` in `location`, - married to `partnerName` with `numKids` kids." - -4. Call the function three times, passing the arrays as arguments. Use ` - console.log` to display the results. - -Note: The DRY principle is put into practice here: instead of repeating the code to -randomly select array elements four times inside the `tellFortune` function -body, this code is now written once only in a separated function. ------------------------------------------------------------------------------*/ - -// This function should take an array as its parameter and return -// a randomly selected element as its return value. -function selectRandomly(/* TODO parameter(s) go here */) { - // TODO complete this function -} - -export function tellFortune(/* TODO add parameter(s) here */) { - // TODO complete this function + return `You will be a ${pick(jobs)} in ${pick(locations)}, and married to ${pick(partnerNames)} with ${pick(numKids)} kids.`; } function main() { - const numKids = [ - // TODO add elements here - ]; - - const partnerNames = [ - // TODO add elements here - ]; - - const locations = [ - // TODO add elements here - ]; - - const jobTitles = [ - // TODO add elements here - ]; - - console.log(tellFortune(numKids, partnerNames, locations, jobTitles)); - console.log(tellFortune(numKids, partnerNames, locations, jobTitles)); - console.log(tellFortune(numKids, partnerNames, locations, jobTitles)); + console.log(tellFortune()); + console.log(tellFortune()); + console.log(tellFortune()); } -// ! Do not change or remove the code below -if (process.env.NODE_ENV !== 'test') { +if (process.env.NODE_ENV !== "test") { main(); } + + diff --git a/1-JavaScript/Week2/assignment/ex4-shoppingCart.js b/1-JavaScript/Week2/assignment/ex4-shoppingCart.js index a3f15a2a7..added9a74 100644 --- a/1-JavaScript/Week2/assignment/ex4-shoppingCart.js +++ b/1-JavaScript/Week2/assignment/ex4-shoppingCart.js @@ -5,68 +5,25 @@ Let's do some grocery shopping! We're going to get some things to cook dinner with. However, you like to spend money and always buy too many things. So when you have more than 3 items in your shopping cart the first item gets taken out. -1. Complete the function named `addToShoppingCart` as follows: - - - It should take one argument: a grocery item (string) - - It should add the grocery item to the `shoppingCart` array. If the number of items is - more than three remove the first one in the array. - - It should return a string "You bought !", where - is a comma-separated list of items from the shopping cart - array. - -2. Confirm that your code passes the unit tests. ------------------------------------------------------------------------------*/ -const shoppingCart = ['bananas', 'milk']; - -// ! Function to be tested -function addToShoppingCart(/* parameters go here */) { - // TODO complete this function -} - -// ! Test functions (plain vanilla JavaScript) -function test1() { - console.log( - 'Test 1: addShoppingCart() called without an argument should leave the shopping cart unchanged' - ); - const expected = 'You bought bananas, milk!'; - const actual = addToShoppingCart(); - console.assert(actual === expected); -} - -function test2() { - console.log('Test 2: addShoppingCart() should take one parameter'); - const expected = 1; - const actual = addToShoppingCart.length; - console.assert(actual === expected); -} - -function test3() { - console.log('Test 3: `chocolate` should be added'); - const expected = 'You bought bananas, milk, chocolate!'; - const actual = addToShoppingCart('chocolate'); - console.assert(actual === expected); +const shoppingCart = ["bananas", "milk"]; + +export function addToShoppingCart(item) { + if (item !== undefined) { + shoppingCart.push(item); + if (shoppingCart.length > 3) { + shoppingCart.shift(); + } + } + return `You bought ${shoppingCart.join(", ")}!`; } -function test4() { - console.log('Test 4: `waffles` should be added and `bananas` removed'); - const expected = 'You bought milk, chocolate, waffles!'; - const actual = addToShoppingCart('waffles'); - console.assert(actual === expected); +function main() { + console.log(addToShoppingCart()); + console.log(addToShoppingCart("chocolate")); + console.log(addToShoppingCart("waffles")); + console.log(addToShoppingCart("tea")); } -function test5() { - console.log('Test 5: `tea` should be added and `milk` removed'); - const expected = 'You bought chocolate, waffles, tea!'; - const actual = addToShoppingCart('tea'); - console.assert(actual === expected); +if (process.env.NODE_ENV !== "test") { + main(); } - -function test() { - test1(); - test2(); - test3(); - test4(); - test5(); -} - -test(); diff --git a/1-JavaScript/Week2/assignment/ex5-shoppingCartPure.js b/1-JavaScript/Week2/assignment/ex5-shoppingCartPure.js index fc5e02f23..82d3aa3f0 100644 --- a/1-JavaScript/Week2/assignment/ex5-shoppingCartPure.js +++ b/1-JavaScript/Week2/assignment/ex5-shoppingCartPure.js @@ -4,61 +4,20 @@ Full description at: https://github.com/HackYourFuture/Assignments/tree/main/1-J In the current exercise we will rewrite the `addToShoppingCart` function to make it pure. Do the following: -1. Complete the parameter list of `addToShopping()`. As a first parameter it - should accept a shopping cart array and as a second parameter it should - accept a grocery item to be added. -2. The function should return a new shopping cart array, following the same rule - as in the previous exercise: it should contain a maximum of three items. -3. The shopping cart passed as an argument should not be mutated. -4. When constructing the new shopping cart array you should make use of the ES6 - spread syntax. -5. Confirm that you function passes the provided unit tests. -------------------------------------------------------------------------------*/ -// ! Function under test -function addToShoppingCart(/* TODO parameter(s) go here */) { - // TODO complete this function +1. export function addToShoppingCart(cart, item) { + const newCart = [...cart, item]; + if (newCart.length > 3) { + return newCart.slice(newCart.length - 3); + } + return newCart; } -// ! Test functions (plain vanilla JavaScript) -function test1() { - console.log('Test 1: addToShoppingCart should take two parameters'); - console.assert(addToShoppingCart.length === 2); +function main() { + const initialCart = ["bananas", "milk"]; + console.log(addToShoppingCart(initialCart, "chocolate")); + console.log(addToShoppingCart(initialCart, "waffles")); } -function test2() { - console.log('Test 2: addToShoppingCart should be a pure function'); - // A pure function should return the same result when called with - // identical arguments. It should also have no side effects (not tested here). - const initialCart = ['bananas', 'milk']; - const result1 = addToShoppingCart(initialCart, 'chocolate'); - const result2 = addToShoppingCart(initialCart, 'chocolate'); - console.assert(JSON.stringify(result1) === JSON.stringify(result2)); - console.assert( - JSON.stringify(initialCart) === JSON.stringify(['bananas', 'milk']) - ); +if (process.env.NODE_ENV !== "test") { + main(); } - -function test3() { - console.log('Test 3: `chocolate` should be added'); - const initialCart = ['bananas', 'milk']; - const result = addToShoppingCart(initialCart, 'chocolate'); - console.assert(result.length === 3); - console.assert(result.includes('chocolate')); -} - -function test4() { - console.log('Test 4: `waffles` should be added'); - const initialCart = ['bananas', 'milk', 'chocolate']; - const result = addToShoppingCart(initialCart, 'waffles'); - console.assert(result.length === 3); - console.assert(result.includes('waffles')); -} - -function test() { - test1(); - test2(); - test3(); - test4(); -} - -test(); diff --git a/1-JavaScript/Week2/assignment/ex6-totalCost.js b/1-JavaScript/Week2/assignment/ex6-totalCost.js index eba643bca..a3a15044f 100644 --- a/1-JavaScript/Week2/assignment/ex6-totalCost.js +++ b/1-JavaScript/Week2/assignment/ex6-totalCost.js @@ -5,37 +5,33 @@ You want to buy a couple of things from the supermarket to prepare for a party. After scanning all the items the cashier wants to give you the total price, but the machine is broken! Let's write her a function that does it for her instead! - -1. Create an object named `cartForParty` with five properties. Each property - should be a grocery item (like `beers` or `chips`) and hold a number value - (like `1.75` or `0.99`). - -2. Complete the function called `calculateTotalPrice`. - - - It takes one parameter: an object that contains properties that only contain - number values. - - Loop through the object and add all the number values together. - - Return a string: "Total: €`amount`". - -3. Complete the unit test functions and verify that all is working as expected. ------------------------------------------------------------------------------*/ const cartForParty = { - // TODO complete this object + beers: 1.75, + chips: 0.99, + pizza: 4.5, + soda: 1.25, + cake: 6.0, }; -function calculateTotalPrice(/* TODO parameter(s) go here */) { - // TODO replace this comment with your code +export function calculateTotalPrice(cart) { + let total = 0; + for (const key in cart) { + total += cart[key]; + } + return `Total: €${total}`; } // ! Test functions (plain vanilla JavaScript) function test1() { - console.log('\nTest 1: calculateTotalPrice should take one parameter'); - // TODO replace this comment with your code + console.log("\nTest 1: calculateTotalPrice should take one parameter"); + console.assert(calculateTotalPrice.length === 1); } function test2() { - console.log('\nTest 2: return correct output when passed cartForParty'); - // TODO replace this comment with your code + console.log("\nTest 2: return correct output when passed cartForParty"); + const expected = "Total: €14.49"; + const actual = calculateTotalPrice(cartForParty); + console.assert(actual === expected); } function test() { @@ -43,4 +39,6 @@ function test() { test2(); } -test(); +if (process.env.NODE_ENV !== "test") { + test(); +} diff --git a/1-JavaScript/Week2/assignment/ex7-mindPrivacy.js b/1-JavaScript/Week2/assignment/ex7-mindPrivacy.js index ae686deab..c93584d32 100644 --- a/1-JavaScript/Week2/assignment/ex7-mindPrivacy.js +++ b/1-JavaScript/Week2/assignment/ex7-mindPrivacy.js @@ -1,65 +1,47 @@ -/*------------------------------------------------------------------------------ -Full description at: https://github.com/HackYourFuture/Assignments/tree/main/1-JavaScript/Week3#exercise-7-mind-the-privacy - -1. Complete the `filterPrivateData()` function. It should take a single - parameter: the array of employee records. -2. It should create a _new_ array, containing employee data without the private - data. -3. Use object destructuring to extract the non-private properties from an - employee record (an `object`) and object literal shorthand to create a new - employee record with just the non-private parts (name, occupation and email). -4. Return the new array as the return value of the function. -5. Run the exercise and verify that it passes all the unit tests. -------------------------------------------------------------------------------*/ const employeeRecords = [ { - name: 'John', - occupation: 'developer', - gender: 'M', - email: 'john.doe@somewhere.net', + name: "John", + occupation: "developer", + gender: "M", + email: "john.doe@somewhere.net", salary: 50000, }, { - name: 'Jane', - occupation: 'manager', - gender: 'F', - email: 'jane.eyre@somewhere.net', + name: "Jane", + occupation: "manager", + gender: "F", + email: "jane.eyre@somewhere.net", salary: 60000, }, ]; -// ! Function under test -function filterPrivateData(/* TODO parameter(s) go here */) { - // TODO complete this function +export function filterPrivateData(records) { + return records.map(({ name, occupation, email }) => ({ + name, + occupation, + email, + })); } // ! Test functions (plain vanilla JavaScript) function test1() { - console.log('Test 1: filterPrivateData should take one parameter'); + console.log("Test 1: filterPrivateData should take one parameter"); console.assert(filterPrivateData.length === 1); } function test2() { - console.log('Test 2: gender and salary should be filtered out'); + console.log("Test 2: gender and salary should be filtered out"); const expected = [ { - name: 'John', - occupation: 'developer', - email: 'john.doe@somewhere.net', + name: "John", + occupation: "developer", + email: "john.doe@somewhere.net", }, { - name: 'Jane', - occupation: 'manager', - email: 'jane.eyre@somewhere.net', + name: "Jane", + occupation: "manager", + email: "jane.eyre@somewhere.net", }, ]; const result = filterPrivateData(employeeRecords); - console.assert(JSON.stringify(result) === JSON.stringify(expected)); -} - -function test() { - test1(); - test2(); -} - -test(); + console.ass diff --git a/1-JavaScript/Week2/test-reports/ex1-giveCompliment.report.txt b/1-JavaScript/Week2/test-reports/ex1-giveCompliment.report.txt new file mode 100644 index 000000000..dd603b5dd --- /dev/null +++ b/1-JavaScript/Week2/test-reports/ex1-giveCompliment.report.txt @@ -0,0 +1,48 @@ +*** Unit Test Error Report *** + +Command failed: npx jest C:/Users/Rimha/Assignments-Cohort54/.dist/1-JavaScript/Week2/unit-tests/ex1-giveCompliment.test.js --colors --noStackTrace --json + FAIL .dist/1-JavaScript/Week2/unit-tests/ex1-giveCompliment.test.js + js-wk2-ex1-giveCompliment + ❌ should exist and be executable (4 ms) + ✅ should have all TODO comments removed (1 ms) + ✅ `giveCompliment` should not contain unneeded console.log calls (1 ms) + ❌ should take a single parameter (1 ms) + ✅ should include a `compliments` array inside its function body (1 ms) + ❌ the `compliments` array should be initialized with 10 strings (1 ms) + ❌ should give a random compliment: You are `compliment`, `name`! + + ● js-wk2-ex1-giveCompliment › should exist and be executable + + expect(received).toBeDefined() + + Received: undefined + + ● js-wk2-ex1-giveCompliment › should take a single parameter + + expect(received).toHaveLength(expected) + + Matcher error: received value must have a length property whose value must be a number + + Received has value: undefined + + ● js-wk2-ex1-giveCompliment › the `compliments` array should be initialized with 10 strings + + expect(received).toHaveLength(expected) + + Expected length: 10 + Received length: 0 + Received array: [] + + ● js-wk2-ex1-giveCompliment › should give a random compliment: You are `compliment`, `name`! + + expect(received).toBeDefined() + + Received: undefined + +Test Suites: 1 failed, 1 total +Tests: 4 failed, 3 passed, 7 total +Snapshots: 0 total +Time: 1.293 s +Ran all test suites matching /C:\\Users\\Rimha\\Assignments-Cohort54\\.dist\\1-JavaScript\\Week2\\unit-tests\\ex1-giveCompliment.test.js/i. +No linting errors detected. +No spelling errors detected. diff --git a/1-JavaScript/Week2/test-reports/ex2-dogYears.report.txt b/1-JavaScript/Week2/test-reports/ex2-dogYears.report.txt new file mode 100644 index 000000000..9eef79805 --- /dev/null +++ b/1-JavaScript/Week2/test-reports/ex2-dogYears.report.txt @@ -0,0 +1,41 @@ +*** Unit Test Error Report *** + +Command failed: npx jest C:/Users/Rimha/Assignments-Cohort54/.dist/1-JavaScript/Week2/unit-tests/ex2-dogYears.test.js --colors --noStackTrace --json + FAIL .dist/1-JavaScript/Week2/unit-tests/ex2-dogYears.test.js + js-wk2-ex2-dogYears + ✅ should exist and be executable (3 ms) + ✅ should have all TODO comments removed + ✅ `calculateDogAge` should not contain unneeded console.log calls (2 ms) + ✅ should take a single parameter (1 ms) + ❌ should give 7 dog years for 1 human year (3 ms) + ❌ should give 14 dog years for 2 human years + ❌ give 21 dog years for 3 human years (1 ms) + + ● js-wk2-ex2-dogYears › should give 7 dog years for 1 human year + + expect(received).toBe(expected) // Object.is equality + + Expected: "Your doggie is 7 years old in dog years!" + Received: 7 + + ● js-wk2-ex2-dogYears › should give 14 dog years for 2 human years + + expect(received).toBe(expected) // Object.is equality + + Expected: "Your doggie is 14 years old in dog years!" + Received: 14 + + ● js-wk2-ex2-dogYears › give 21 dog years for 3 human years + + expect(received).toBe(expected) // Object.is equality + + Expected: "Your doggie is 21 years old in dog years!" + Received: 21 + +Test Suites: 1 failed, 1 total +Tests: 3 failed, 4 passed, 7 total +Snapshots: 0 total +Time: 1.221 s +Ran all test suites matching /C:\\Users\\Rimha\\Assignments-Cohort54\\.dist\\1-JavaScript\\Week2\\unit-tests\\ex2-dogYears.test.js/i. +No linting errors detected. +No spelling errors detected. diff --git a/1-JavaScript/Week2/test-reports/ex3-tellFortune.report.txt b/1-JavaScript/Week2/test-reports/ex3-tellFortune.report.txt new file mode 100644 index 000000000..4fc6ed81d --- /dev/null +++ b/1-JavaScript/Week2/test-reports/ex3-tellFortune.report.txt @@ -0,0 +1,45 @@ +*** Unit Test Error Report *** + +Command failed: npx jest C:/Users/Rimha/Assignments-Cohort54/.dist/1-JavaScript/Week2/unit-tests/ex3-tellFortune.test.js --colors --noStackTrace --json + FAIL .dist/1-JavaScript/Week2/unit-tests/ex3-tellFortune.test.js + js-wk2-ex3-tellFortune + ✅ should exist and be executable (3 ms) + ✅ should have all TODO comments removed (1 ms) + ✅ `tellFortune` should not contain unneeded console.log calls (1 ms) + ❌ should take four parameters (2 ms) + ✅ should call function `selectRandomly` for each of its arguments (1 ms) + ✅ `numKids` should be an array initialized with 5 elements (1 ms) + ✅ `locations` should be an array initialized with 5 elements (1 ms) + ✅ `partnerNames` should be an array initialized with 5 elements + ❌ `jobTitles` should be an array initialized with 5 elements (1 ms) + ❌ should tell the fortune by randomly selecting array values (4 ms) + + ● js-wk2-ex3-tellFortune › should take four parameters + + expect(received).toHaveLength(expected) + + Expected length: 4 + Received length: 0 + Received function: [Function tellFortune] + + ● js-wk2-ex3-tellFortune › `jobTitles` should be an array initialized with 5 elements + + expect(received).toBe(expected) // Object.is equality + + Expected: true + Received: false + + ● js-wk2-ex3-tellFortune › should tell the fortune by randomly selecting array values + + expect(received).toBe(expected) // Object.is equality + + Expected: "You will be a undefined in Amsterdam, married to Alex with 0 kids." + Received: "You will be a developer in Amsterdam, and married to Alex with 0 kids." + +Test Suites: 1 failed, 1 total +Tests: 3 failed, 7 passed, 10 total +Snapshots: 0 total +Time: 1.258 s +Ran all test suites matching /C:\\Users\\Rimha\\Assignments-Cohort54\\.dist\\1-JavaScript\\Week2\\unit-tests\\ex3-tellFortune.test.js/i. +No linting errors detected. +No spelling errors detected. diff --git a/1-JavaScript/Week2/test-reports/ex4-shoppingCart.report.txt b/1-JavaScript/Week2/test-reports/ex4-shoppingCart.report.txt new file mode 100644 index 000000000..d985f405c --- /dev/null +++ b/1-JavaScript/Week2/test-reports/ex4-shoppingCart.report.txt @@ -0,0 +1,3 @@ +A unit test file was not provided for this exercise. +No linting errors detected. +No spelling errors detected. diff --git a/1-JavaScript/Week2/test-reports/ex5-shoppingCartPure.report.txt b/1-JavaScript/Week2/test-reports/ex5-shoppingCartPure.report.txt new file mode 100644 index 000000000..d985f405c --- /dev/null +++ b/1-JavaScript/Week2/test-reports/ex5-shoppingCartPure.report.txt @@ -0,0 +1,3 @@ +A unit test file was not provided for this exercise. +No linting errors detected. +No spelling errors detected. diff --git a/1-JavaScript/Week2/test-reports/ex6-totalCost.report.txt b/1-JavaScript/Week2/test-reports/ex6-totalCost.report.txt new file mode 100644 index 000000000..d985f405c --- /dev/null +++ b/1-JavaScript/Week2/test-reports/ex6-totalCost.report.txt @@ -0,0 +1,3 @@ +A unit test file was not provided for this exercise. +No linting errors detected. +No spelling errors detected. diff --git a/Assignments-Cohort54 b/Assignments-Cohort54 new file mode 160000 index 000000000..c50e3cebe --- /dev/null +++ b/Assignments-Cohort54 @@ -0,0 +1 @@ +Subproject commit c50e3cebeac3c278b9994f72695cc11fc2f2f1dc From 85288a510d6c57bd9bc99b34dff44a97575f3515 Mon Sep 17 00:00:00 2001 From: Hadidreem17 Date: Thu, 4 Sep 2025 16:26:12 +0200 Subject: [PATCH 2/7] test (w2) : ran ex7 mindPrivacy locally --- .test-summary/TEST_SUMMARY.md | 1 + 1-JavaScript/Week2/test-reports/ex7-mindPrivacy.report.txt | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 1-JavaScript/Week2/test-reports/ex7-mindPrivacy.report.txt diff --git a/.test-summary/TEST_SUMMARY.md b/.test-summary/TEST_SUMMARY.md index a0dff3975..7ff3f6bdd 100644 --- a/.test-summary/TEST_SUMMARY.md +++ b/.test-summary/TEST_SUMMARY.md @@ -12,3 +12,4 @@ | ex4-shoppingCart | - | - | ✓ | | ex5-shoppingCartPure | - | - | ✓ | | ex6-totalCost | - | - | ✓ | +| ex7-mindPrivacy | - | - | ✓ | diff --git a/1-JavaScript/Week2/test-reports/ex7-mindPrivacy.report.txt b/1-JavaScript/Week2/test-reports/ex7-mindPrivacy.report.txt new file mode 100644 index 000000000..d985f405c --- /dev/null +++ b/1-JavaScript/Week2/test-reports/ex7-mindPrivacy.report.txt @@ -0,0 +1,3 @@ +A unit test file was not provided for this exercise. +No linting errors detected. +No spelling errors detected. From 84f2263e9a17390a0385c454dd29cbfb9d9fab90 Mon Sep 17 00:00:00 2001 From: Hadidreem17 Date: Sun, 21 Sep 2025 20:55:52 +0200 Subject: [PATCH 3/7] Week2: fix solution for ex3-tellFortune --- .../Week2/assignment/ex3-tellFortune.js | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/1-JavaScript/Week2/assignment/ex3-tellFortune.js b/1-JavaScript/Week2/assignment/ex3-tellFortune.js index d8283ab91..bfa3777a9 100644 --- a/1-JavaScript/Week2/assignment/ex3-tellFortune.js +++ b/1-JavaScript/Week2/assignment/ex3-tellFortune.js @@ -1,22 +1,34 @@ -export function tellFortune() { - const numKids = [0, 1, 2, 3, 4]; - const partnerNames = ["Alex", "Sam", "Taylor", "Jordan", "Casey"]; - const locations = ["Amsterdam", "Rotterdam", "Utrecht", "The Hague", "Eindhoven"]; - const jobs = ["developer", "designer", "teacher", "engineer", "chef"]; - const pick = (arr) => arr[Math.floor(Math.random() * arr.length)]; +function selectRandomly(arr) { + return arr[Math.floor(Math.random() * arr.length)]; +} - return `You will be a ${pick(jobs)} in ${pick(locations)}, and married to ${pick(partnerNames)} with ${pick(numKids)} kids.`; +export function tellFortune(numKids, partnerNames, locations, jobTitles) { + return `You will be a ${selectRandomly(jobTitles)} in ${selectRandomly( + locations + )}, married to ${selectRandomly(partnerNames)} with ${selectRandomly( + numKids + )} kids.`; } function main() { - console.log(tellFortune()); - console.log(tellFortune()); - console.log(tellFortune()); + const numKids = [0, 1, 2, 3, 4]; + const partnerNames = ["Alex", "Sam", "Taylor", "Jordan", "Casey"]; + const locations = ["Amsterdam", "Rotterdam", "Utrecht", "The Hague", "Eindhoven"]; + const jobTitles = ["developer", "designer", "teacher", "engineer", "chef"]; + + console.log(tellFortune(numKids, partnerNames, locations, jobTitles)); + console.log(tellFortune(numKids, partnerNames, locations, jobTitles)); + console.log(tellFortune(numKids, partnerNames, locations, jobTitles)); } -if (process.env.NODE_ENV !== "test") { +// ! Do not change or remove the code below +if (process.env.NODE_ENV !== 'test') { main(); } + + + + From 2223d933a59b4226f5f5962abf556155da236d70 Mon Sep 17 00:00:00 2001 From: Hadidreem17 Date: Sun, 21 Sep 2025 21:16:57 +0200 Subject: [PATCH 4/7] Fix Week2 ex4-shoppingCart based on feedback --- .../Week2/assignment/ex4-shoppingCart.js | 62 ++++++++++++++----- 1 file changed, 45 insertions(+), 17 deletions(-) diff --git a/1-JavaScript/Week2/assignment/ex4-shoppingCart.js b/1-JavaScript/Week2/assignment/ex4-shoppingCart.js index added9a74..73749b04c 100644 --- a/1-JavaScript/Week2/assignment/ex4-shoppingCart.js +++ b/1-JavaScript/Week2/assignment/ex4-shoppingCart.js @@ -1,29 +1,57 @@ -/*------------------------------------------------------------------------------ -Full description at: https://github.com/HackYourFuture/Assignments/tree/main/1-JavaScript/Week3#exercise-4-shopping-at-the-supermarket +const shoppingCart = ['bananas', 'milk']; -Let's do some grocery shopping! We're going to get some things to cook dinner -with. However, you like to spend money and always buy too many things. So when -you have more than 3 items in your shopping cart the first item gets taken out. - -const shoppingCart = ["bananas", "milk"]; - -export function addToShoppingCart(item) { +function addToShoppingCart(item) { if (item !== undefined) { shoppingCart.push(item); if (shoppingCart.length > 3) { shoppingCart.shift(); } } - return `You bought ${shoppingCart.join(", ")}!`; + return `You bought ${shoppingCart.join(', ')}!`; +} + +// ===== manual tests (restore) ===== +function test1() { + console.log('Test 1: add `chocolate` to the cart'); + const expected = 'You bought bananas, milk, chocolate!'; + const actual = addToShoppingCart('chocolate'); + console.assert(actual === expected); +} + +function test2() { + console.log('Test 2: add `waffles` (keep last 3 items)'); + const expected = 'You bought milk, chocolate, waffles!'; + const actual = addToShoppingCart('waffles'); + console.assert(actual === expected); } -function main() { - console.log(addToShoppingCart()); - console.log(addToShoppingCart("chocolate")); - console.log(addToShoppingCart("waffles")); - console.log(addToShoppingCart("tea")); +function test3() { + console.log('Test 3: add `tea` (bananas removed)'); + const expected = 'You bought chocolate, waffles, tea!'; + const actual = addToShoppingCart('tea'); + console.assert(actual === expected); } -if (process.env.NODE_ENV !== "test") { - main(); +function test4() { + console.log('Test 4: add nothing (cart unchanged)'); + const expected = 'You bought chocolate, waffles, tea!'; + const actual = addToShoppingCart(); + console.assert(actual === expected); } + +function test5() { + console.log('Test 5: `tea` should be added and `milk` removed'); + const expected = 'You bought chocolate, waffles, tea!'; + const actual = addToShoppingCart('tea'); + console.assert(actual === expected); +} + +function test() { + test1(); + test2(); + test3(); + test4(); + test5(); +} + +test(); \ No newline at end of file From 1688ff7fb759a5f3841051396710a86bb712268d Mon Sep 17 00:00:00 2001 From: Hadidreem17 Date: Fri, 3 Oct 2025 19:03:44 +0200 Subject: [PATCH 5/7] update ex1 and ex2 --- .../Week2/assignment/ex1-giveCompliment.js | 4 ++-- 1-JavaScript/Week2/assignment/ex2-dogYears.js | 14 ++++---------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/1-JavaScript/Week2/assignment/ex1-giveCompliment.js b/1-JavaScript/Week2/assignment/ex1-giveCompliment.js index 7b75aa172..b62c2aa3e 100644 --- a/1-JavaScript/Week2/assignment/ex1-giveCompliment.js +++ b/1-JavaScript/Week2/assignment/ex1-giveCompliment.js @@ -21,12 +21,12 @@ Full description at: https://github.com/HackYourFuture/Assignments/tree/main/1-J } function main() { - const myName = "HackYourFuture"; + const myName = "Rim"; console.log(giveCompliment(myName)); console.log(giveCompliment(myName)); console.log(giveCompliment(myName)); - const yourName = "Amsterdam"; + const yourName = "Hadid"; console.log(giveCompliment(yourName)); console.log(giveCompliment(yourName)); console.log(giveCompliment(yourName)); diff --git a/1-JavaScript/Week2/assignment/ex2-dogYears.js b/1-JavaScript/Week2/assignment/ex2-dogYears.js index 072033c5e..e8129075f 100644 --- a/1-JavaScript/Week2/assignment/ex2-dogYears.js +++ b/1-JavaScript/Week2/assignment/ex2-dogYears.js @@ -1,17 +1,11 @@ export function calculateDogAge(humanYears) { - return humanYears * 7; + const dogYears = humanYears * 7; + return `If you are ${humanYears} years old, that's ${dogYears} in dog years!`; } function main() { - const myAge = 25; - console.log( - `If you are ${myAge} years old, that's ${calculateDogAge(myAge)} in dog years!` - ); - - const yourAge = 40; - console.log( - `If you are ${yourAge} years old, that's ${calculateDogAge(yourAge)} in dog years!` - ); + console.log(calculateDogAge(25)); + console.log(calculateDogAge(40)); } if (process.env.NODE_ENV !== "test") { From 90daffc518611e821fda5f6d264da56dcec087fb Mon Sep 17 00:00:00 2001 From: Hadidreem17 Date: Fri, 3 Oct 2025 19:25:36 +0200 Subject: [PATCH 6/7] add solve ex1 and ex2 --- .test-summary/TEST_SUMMARY.md | 4 +- 1-JavaScript/Week2/assignment/ex2-dogYears.js | 10 ++--- .../test-reports/ex2-dogYears.report.txt | 40 +++++-------------- 3 files changed, 16 insertions(+), 38 deletions(-) diff --git a/.test-summary/TEST_SUMMARY.md b/.test-summary/TEST_SUMMARY.md index 7ff3f6bdd..88e0059ca 100644 --- a/.test-summary/TEST_SUMMARY.md +++ b/.test-summary/TEST_SUMMARY.md @@ -7,8 +7,8 @@ | Exercise | Passed | Failed | ESLint | |----------------------|--------|--------|--------| | ex1-giveCompliment | 3 | 4 | ✓ | -| ex2-dogYears | 4 | 3 | ✓ | -| ex3-tellFortune | 7 | 3 | ✓ | +| ex2-dogYears | 7 | - | ✓ | +| ex3-tellFortune | 10 | - | ✓ | | ex4-shoppingCart | - | - | ✓ | | ex5-shoppingCartPure | - | - | ✓ | | ex6-totalCost | - | - | ✓ | diff --git a/1-JavaScript/Week2/assignment/ex2-dogYears.js b/1-JavaScript/Week2/assignment/ex2-dogYears.js index e8129075f..8e2b7eed7 100644 --- a/1-JavaScript/Week2/assignment/ex2-dogYears.js +++ b/1-JavaScript/Week2/assignment/ex2-dogYears.js @@ -1,14 +1,14 @@ export function calculateDogAge(humanYears) { const dogYears = humanYears * 7; - return `If you are ${humanYears} years old, that's ${dogYears} in dog years!`; + return `Your doggie is ${dogYears} years old in dog years!`; } function main() { - console.log(calculateDogAge(25)); - console.log(calculateDogAge(40)); + console.log(calculateDogAge(1)); + console.log(calculateDogAge(2)); + console.log(calculateDogAge(3)); } -if (process.env.NODE_ENV !== "test") { +if (process.env.NODE_ENV !== 'test') { main(); } - diff --git a/1-JavaScript/Week2/test-reports/ex2-dogYears.report.txt b/1-JavaScript/Week2/test-reports/ex2-dogYears.report.txt index 9eef79805..0ea0bd8ad 100644 --- a/1-JavaScript/Week2/test-reports/ex2-dogYears.report.txt +++ b/1-JavaScript/Week2/test-reports/ex2-dogYears.report.txt @@ -1,41 +1,19 @@ *** Unit Test Error Report *** -Command failed: npx jest C:/Users/Rimha/Assignments-Cohort54/.dist/1-JavaScript/Week2/unit-tests/ex2-dogYears.test.js --colors --noStackTrace --json - FAIL .dist/1-JavaScript/Week2/unit-tests/ex2-dogYears.test.js + PASS .dist/1-JavaScript/Week2/unit-tests/ex2-dogYears.test.js js-wk2-ex2-dogYears - ✅ should exist and be executable (3 ms) + ✅ should exist and be executable (1 ms) ✅ should have all TODO comments removed - ✅ `calculateDogAge` should not contain unneeded console.log calls (2 ms) + ✅ `calculateDogAge` should not contain unneeded console.log calls ✅ should take a single parameter (1 ms) - ❌ should give 7 dog years for 1 human year (3 ms) - ❌ should give 14 dog years for 2 human years - ❌ give 21 dog years for 3 human years (1 ms) + ✅ should give 7 dog years for 1 human year + ✅ should give 14 dog years for 2 human years (1 ms) + ✅ give 21 dog years for 3 human years - ● js-wk2-ex2-dogYears › should give 7 dog years for 1 human year - - expect(received).toBe(expected) // Object.is equality - - Expected: "Your doggie is 7 years old in dog years!" - Received: 7 - - ● js-wk2-ex2-dogYears › should give 14 dog years for 2 human years - - expect(received).toBe(expected) // Object.is equality - - Expected: "Your doggie is 14 years old in dog years!" - Received: 14 - - ● js-wk2-ex2-dogYears › give 21 dog years for 3 human years - - expect(received).toBe(expected) // Object.is equality - - Expected: "Your doggie is 21 years old in dog years!" - Received: 21 - -Test Suites: 1 failed, 1 total -Tests: 3 failed, 4 passed, 7 total +Test Suites: 1 passed, 1 total +Tests: 7 passed, 7 total Snapshots: 0 total -Time: 1.221 s +Time: 0.733 s, estimated 1 s Ran all test suites matching /C:\\Users\\Rimha\\Assignments-Cohort54\\.dist\\1-JavaScript\\Week2\\unit-tests\\ex2-dogYears.test.js/i. No linting errors detected. No spelling errors detected. From 8b16f3779e457a09613d641fcca961d4c45dff6e Mon Sep 17 00:00:00 2001 From: Hadidreem17 Date: Fri, 3 Oct 2025 19:53:19 +0200 Subject: [PATCH 7/7] Solved ex1-giveCompliment and ex2-dogYears --- .test-summary/TEST_SUMMARY.md | 2 +- .../Week2/assignment/ex1-giveCompliment.js | 10 +--- .../ex1-giveCompliment.report.txt | 59 ++++++------------- 3 files changed, 21 insertions(+), 50 deletions(-) diff --git a/.test-summary/TEST_SUMMARY.md b/.test-summary/TEST_SUMMARY.md index 88e0059ca..ad95f550b 100644 --- a/.test-summary/TEST_SUMMARY.md +++ b/.test-summary/TEST_SUMMARY.md @@ -6,7 +6,7 @@ | Exercise | Passed | Failed | ESLint | |----------------------|--------|--------|--------| -| ex1-giveCompliment | 3 | 4 | ✓ | +| ex1-giveCompliment | 7 | - | ✓ | | ex2-dogYears | 7 | - | ✓ | | ex3-tellFortune | 10 | - | ✓ | | ex4-shoppingCart | - | - | ✓ | diff --git a/1-JavaScript/Week2/assignment/ex1-giveCompliment.js b/1-JavaScript/Week2/assignment/ex1-giveCompliment.js index b62c2aa3e..605e1cd25 100644 --- a/1-JavaScript/Week2/assignment/ex1-giveCompliment.js +++ b/1-JavaScript/Week2/assignment/ex1-giveCompliment.js @@ -1,9 +1,4 @@ -/* ----------------------------------------------------------------------------- -Full description at: https://github.com/HackYourFuture/Assignments/tree/main/1-JavaScript/Week3#exercise-1-you-are-amazing - -1. Complete the function named `giveCompliment`as follows: - - export function giveCompliment(name) { +export function giveCompliment(name) { const compliments = [ "great", "awesome", @@ -16,6 +11,7 @@ Full description at: https://github.com/HackYourFuture/Assignments/tree/main/1-J "marvelous", "exceptional" ]; + const i = Math.floor(Math.random() * compliments.length); return `You are ${compliments[i]}, ${name}!`; } @@ -34,4 +30,4 @@ function main() { if (process.env.NODE_ENV !== "test") { main(); -} +} \ No newline at end of file diff --git a/1-JavaScript/Week2/test-reports/ex1-giveCompliment.report.txt b/1-JavaScript/Week2/test-reports/ex1-giveCompliment.report.txt index dd603b5dd..fac4dbcf7 100644 --- a/1-JavaScript/Week2/test-reports/ex1-giveCompliment.report.txt +++ b/1-JavaScript/Week2/test-reports/ex1-giveCompliment.report.txt @@ -1,48 +1,23 @@ *** Unit Test Error Report *** -Command failed: npx jest C:/Users/Rimha/Assignments-Cohort54/.dist/1-JavaScript/Week2/unit-tests/ex1-giveCompliment.test.js --colors --noStackTrace --json - FAIL .dist/1-JavaScript/Week2/unit-tests/ex1-giveCompliment.test.js + PASS .dist/1-JavaScript/Week2/unit-tests/ex1-giveCompliment.test.js js-wk2-ex1-giveCompliment - ❌ should exist and be executable (4 ms) - ✅ should have all TODO comments removed (1 ms) - ✅ `giveCompliment` should not contain unneeded console.log calls (1 ms) - ❌ should take a single parameter (1 ms) - ✅ should include a `compliments` array inside its function body (1 ms) - ❌ the `compliments` array should be initialized with 10 strings (1 ms) - ❌ should give a random compliment: You are `compliment`, `name`! - - ● js-wk2-ex1-giveCompliment › should exist and be executable - - expect(received).toBeDefined() - - Received: undefined - - ● js-wk2-ex1-giveCompliment › should take a single parameter - - expect(received).toHaveLength(expected) - - Matcher error: received value must have a length property whose value must be a number - - Received has value: undefined - - ● js-wk2-ex1-giveCompliment › the `compliments` array should be initialized with 10 strings - - expect(received).toHaveLength(expected) - - Expected length: 10 - Received length: 0 - Received array: [] - - ● js-wk2-ex1-giveCompliment › should give a random compliment: You are `compliment`, `name`! - - expect(received).toBeDefined() - - Received: undefined - -Test Suites: 1 failed, 1 total -Tests: 4 failed, 3 passed, 7 total + ✅ should exist and be executable (1 ms) + ✅ should have all TODO comments removed + ✅ `giveCompliment` should not contain unneeded console.log calls + ✅ should take a single parameter (1 ms) + ✅ should include a `compliments` array inside its function body + ✅ the `compliments` array should be initialized with 10 strings + ✅ should give a random compliment: You are `compliment`, `name`! + +Test Suites: 1 passed, 1 total +Tests: 7 passed, 7 total Snapshots: 0 total -Time: 1.293 s +Time: 0.715 s, estimated 1 s Ran all test suites matching /C:\\Users\\Rimha\\Assignments-Cohort54\\.dist\\1-JavaScript\\Week2\\unit-tests\\ex1-giveCompliment.test.js/i. No linting errors detected. -No spelling errors detected. + + +*** Spell Checker Report *** + +1-JavaScript/Week2/assignment/ex1-giveCompliment.js:25:21 - Unknown word (Hadid)