From this below line of code, package level exported variable from unit testing code is overwriting package level exported variable of service layer, basically to change the service(to use).
services.MessagesService = &serviceMock{} // overwrite with another mock service
Given the scenario, that we do not introduce more than one implementation of messageServiceInterface
by hard coding a service(MessagesService messageServiceInterface = &messagesService{}
) as mentioned here:
Does overwriting package level exported variable approach cause side affects in regular functional flow?
Aucun commentaire:
Enregistrer un commentaire