You could have in your test:
var geocodeInstance = {
geocode: sinon.spy()
};
$window.google = {
maps: {
Geocoder: sinon.stub().returns(geocodeInstance);
}
};
So here you said that your new $window.google.maps.Geocoder() returns geocodeInstance which has a method geocode. Also i used sinon.spy() because you just wanted to test that it was called. It can be a stub as well.
And later on:
expect(geocodeInstance.geocode).calledOnce;
I used expect since it's the way I am used to write my tests. Also try changing in your directive and inject $window and do:
geocoder = new $window.google.maps.Geocoder();