test works, but in real app does not because is executed async