You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> Built a new hook? [Let us know](https://github.com/open-feature/openfeature.dev/issues/new?assignees=&labels=hook&projects=&template=document-hook.yaml&title=%5BHook%5D%3A+) so we can add it to the docs!
361
361
362
+
## Testing
363
+
364
+
To test interactions with OpenFeature API and Client, you can rely on `openfeature.IEvaluation` & `openfeature.IClient` interfaces.
365
+
366
+
While you may use global methods to interact with the API, it is recommended to obtain the singleton API instance so that you can use appropriate mocks for your testing needs,
367
+
368
+
```go
369
+
// global helper
370
+
openfeature.SetProvider(myProvider)
371
+
372
+
// singleton instance - preferred
373
+
apiInstance:= openfeature.GetApiInstance()
374
+
apiInstance.SetProvider(myProvider)
375
+
```
376
+
377
+
Similarly, while you have option (due to historical reasons) to create a client with `openfeature.NewClient()` helper, it is recommended to use API to generate the client which returns an `IClient` instance.
0 commit comments