"Elyses Enchantments" removeItemAtBottom function TEST is not working properly

Below code is for testing the removeItemAtBottom function in Elyses Enchantments problem. But, It’s seems to be not working expectedly. Because, the removeItemAtBottom function returs the stack after removing the bottom element. But, In the test code there is no catching the returned stack. Attached the snapshot of the issue for the reference.

Code issue

const stack = [1, 2, 3];
const expected = [3];

Code Have tobe :

let stack = [1, 2, 3];
stack = removeItemAtBottom(stack);
stack = removeItemAtBottom(stack);
const expected = [3];

Snapshot for Reference:

This task expects you to implement a function that modifies and returns its parameter.
Your solution creates a new array, leaving the parameter unmodified.


Hi @siebenschlaefer

Thanks for your reply. Actually I got the point why the test cases maded in that way. To get that point, I just invested my 3 hours to go around github issues and some topics in this forum.

Freshers like me get frustrated if I don’t know why the test cases not passing, If I doing it correctly in terms of mutability / immutability. But what’s the point doing the same in one function.

Anyway my suggestion to Exercism Exercism Support, Please just make the clear cut instruction in the problem introduction itself.

“Please just make the clear cut instruction in the problem introduction itself.”

The introduction for learning exercises is used to introduce concepts that you will use to complete the exercise. After the introduction are the actual instructions for the exercise. At the beginning of the instructions for this exercise there is a special note that states: “All functions should update the array of cards and then return the modified array.”

“But what’s the point doing the same in one function.”

In the same note at the beginning of the instructions it states doing both “allows you to nicely daisy-chain functions together.”

1 Like

Thankyou @thesaikis for your explanation.

Sorry if I am rude above. I am just frustrated that time. :sweat_smile: