[go: up one dir, main page]

Skip to content

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 pass envVar as the string mainly to resolve the circular dependency between feature and testhelpers

    1. tests for feature use testhelpers.SetEnvironmentVariable
    2. I'd love this function func StubFeatureFlagValue(t testing.TB, f feature.Feature, value bool), but it would be circular dependency
    3. 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 by Feature type

    I think we can iterate on solution later.