London | 26-ITP-May | Khaliun Baatarkhuu | Sprint 2 | Coursework - #1287
London | 26-ITP-May | Khaliun Baatarkhuu | Sprint 2 | Coursework#1287khaliun-dev wants to merge 18 commits into
Conversation
Updated loop to use Object.values for iterating over a plain object.
Updated console log to display ingredients correctly.
Removed comment about ignoring empty pairs for clarity.
Added tests for handling empty query strings and decoding spaces.
Add input validation and counting logic to tally function.
Implemented the invert function to swap keys and values of an object and added tests to verify its functionality.
hey-hammad
left a comment
There was a problem hiding this comment.
Good effort overall, few changes required
| alive: true, | ||
| }; | ||
|
|
||
| for (const value of Object.values(author)) { |
There was a problem hiding this comment.
This works, but can we do it using only for loop?
There was a problem hiding this comment.
yes, done. refactored and commit generated
|
|
||
|
|
||
|
|
||
| describe("invert", () => { |
There was a problem hiding this comment.
please fix the errors in this file and move the tests to a separate test.js file.
There was a problem hiding this comment.
Hi @khaliun-dev, could you please review the file and try running it? There still appears to be some syntax issues. Also, please think about code duplication and how to handle things that are not part of the code.
Nice job moving the tests to a dedicated file. However, looking at the other test files, could you rename this test file to be more descriptive and follow the naming convention used by the other files?
Updated author object and changed iteration method to a for loop.
Removed unit tests for the invert function from invert.js.
Added unit tests for the invert function to verify its behavior with various inputs.
|
@hey-hammad i have fixed both issues raised, could you have another look, please? |
Fix the invert function to correctly swap keys and values in the object.
|
@hey-hammad i have renamed the test file and worked out the syntax problem. All tests passed . |
Self checklist
Changelist
Questions
None