Removed array syntax in multiply test

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 commit is contained in:
fruddenfeldt 2023-05-22 21:08:37 +02:00 committed by GitHub
parent 3e530e3f61
commit b6e9e2fac3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -40,11 +40,11 @@ describe('sum', () => {
describe('multiply', () => {
test.skip('multiplies two numbers', () => {
expect(calculator.multiply([2,4])).toBe(8);
expect(calculator.multiply(2,4)).toBe(8);
});
test.skip('multiplies several numbers', () => {
expect(calculator.multiply([2,4,6,8,10,12,14])).toBe(645120);
expect(calculator.multiply(2,4,6,8,10,12,14)).toBe(645120);
});
});