oops noticed now it wasn't a bug. The line before it `var doMock = mockSwitch.mockApi();` called the function.