forcedotcom / LightningTestingService

Apache License 2.0
122 stars 35 forks source link

Testing a method not exposed through component's public interface #22

Closed FabienTaillon closed 7 years ago

FabienTaillon commented 7 years ago

Is there a way to test a method that is not exposed through the component's public interface ? We may have some methods that need to be tested, but that we don't want to expose.

In exempleTests it seems that all methods are called via an aura:method in the related component.

esalman-sfdc commented 7 years ago

There are a couple of approaches that you could take,

Restrictions around what can be accessed/invoked are controlled by the platform (access checks, locker-service etc.) and apply to component tests as well. Based on personal experience, I think this does makes sense from test-quality perspective as it avoids issues going uncaught due to difference in behavior based on context/mode.

FabienTaillon commented 7 years ago

Ok, thanks !