@EIDuderino
Ideally, your solution should also work by subtracting 2 from total length, since '.find' return iterable object.
Please find below as updates:
const elementsArray = wrapper.find('element');
const secondToLastElement = elementsArray.at(elementsArray.length -
2);
Alternatively, I believe we can use below solution to find count and then use '.at' to find the second last element. which is not the ideal solution but can be of help.
let totalElements = 0;
component.find('MyInnerComponent').forEach( (node) => {
totalElements++; });
once we do have total count, we can make use of code you have suggested.
Below are links which might help add to the answer
React Enzyme find second (or nth) node.
I think alternatively you can use '.get' as well, if this helps the scenario.
However, I am sure you already been through the enzyme documentation, but putting the link for reference on '.get' and '.at' respectively.
I hope, this helps.