Mock socket and $state in client-side tests