I think the intention of this code is to make sure that mockStartDate is always one day back from the current date, but this code will produce a number rather than a date. If this happens to run on the first day of the month, the result is that mockStartDate is 0 which will not produce test cases that reach all of the component's code.
Replace new Date().getDate() - 1 with code that will actually find the previous day's date.
See this line in the tests and this line in the component, for example.
I think the intention of this code is to make sure that
mockStartDate
is always one day back from the current date, but this code will produce a number rather than a date. If this happens to run on the first day of the month, the result is thatmockStartDate
is0
which will not produce test cases that reach all of the component's code.Replace
new Date().getDate() - 1
with code that will actually find the previous day's date.