-
Notifications
You must be signed in to change notification settings - Fork 41.9k
Removed array syntax in multiply test #359
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
Conversation
The test for the 'multiply' function used array brackets [] for the input parameters, which caused the test to return an error when rest parameters (...args) are used in the function, like so: const multiply = function(...args){ return args.reduce((acc, cur) => acc * cur); }
This is a good idea I think. Can you also do a PR to the solutions branch? the solution we have is geared toward these tests, and expects an array as a parameter.. but none of the other base-math functions (add, subtract, etc.) expect an array, so it makes sense to be consistent here. |
I don't want to merge this one until the solutions are updated... so let me know when that PR is ready |
See separate PR "Removed array syntax in multiply test TheOdinProject#359" TheOdinProject#359
Thanks. Done - see this PR: #364 |
If that's the case, we should also modify the test for the sum function in calculator.spec.js to expect rest parameters instead of expecting an array parameter. The same thing applies to the calculator-solution.spec.js file, in which the test for sum and multiply functions expects an array instead of rest parameters, causing it to fail two tests. |
I opened a PR |
See separate PR "Removed array syntax in multiply test TheOdinProject#359" TheOdinProject#359
Removed array syntax in multiply test
See separate PR "Removed array syntax in multiply test #359" TheOdinProject/javascript-exercises#359
Because
The test for the 'multiply' function used array brackets [] for the input parameters:
expect(calculator.multiply([2,4])).toBe(8);
This causes the test to return an error when rest parameters (...args) are used in the function, like so:
This PR
Issue
Closes #XXXXX
Additional Information
Pull Request Requirements
location of change: brief description of change
format, e.g.01_helloWorld: Update test cases
Because
section summarizes the reason for this PRThis PR
section has a bullet point list describing the changes in this PRIssue
sectionsolutions
branch, I have created another PR (and linked it to this PR).