refactor: make the feature package easier to mock
The following discussion from !642 (merged) should be addressed:
-
@vshushlin started a discussion: (+2 comments) This is a bit of glue between tests and
feature
package. We passenvVar
as the string mainly to resolve the circular dependency betweenfeature
andtesthelpers
- tests for
feature
usetesthelpers.SetEnvironmentVariable
- I'd love this function
func StubFeatureFlagValue(t testing.TB, f feature.Feature, value bool)
, but it would be circular dependency - I also considered something like
func (f Feature) Stub(t testing.TB, value bool)
, but I don't want to pull the whole testing package anywhere outside of tests
So I just use string names. This is also why
EnvVariable
is exported byFeature
typeI think we can iterate on solution later.
- tests for