-
-
Notifications
You must be signed in to change notification settings - Fork 149
London | ITP MAY | Jamal Laqdiem | Module Data Groups | Sprint-2 #588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
//test 1: | ||
const result1 = invert({a:1}); | ||
const expected1 = {1:'a'}; | ||
console.log(`Test 1: Input {a:1}, Expected ${JSON.stringify(expected1)}, Actual ${JSON.stringify(result1)}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you use JSON.stringify() here? What does it do and what benefit does it provide?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for reviewing, I used JSON.stringify() for readability and consistency, which it make it easy to read, compare and copy-paste.
Sprint-2/implement/contains.js
Outdated
|
||
} | ||
|
||
console.log(contains({first_name :'john'}, 'first_name')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you have all of these test cases inside your contains.test.js folder, wouldn't it be cleaner to remove all the console.log lines in this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for reviewing, yes you are right, i will remove them.
}); | ||
}); | ||
|
||
test("ignores empty key-value pairs created by multiple '&'", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add an extra line to this test to check:
expect(Object.keys(result)).not.toContain("");
Let me know what happens, and why so?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for reviewing, It ensures that the object keys are properly formed and don't contain empty or invalid name,and preventing empty string keys, and make the test more robust.
throw new Error ('Error parameter must be an array.') | ||
} | ||
for(count of arr) { | ||
objectResult[count]= (objectResult[count] || 0) +1 ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very clever solution - well done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for reviewing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall a great submission - but have added some comments and changes to do. Once done, let me know and I'll re-review.
Learners, PR Template
Self checklist
Changelist
This pull request addresses several bug fixes and introduces new functionalities within the Module-Data-Groups . The changes include improvements to existing exercises and the implementation of new core functions.
Questions
Ask any questions you have for your reviewer.