package flags

import (
	"os"
	"testing"
)

func TestIsEnabled_Disabled(t *testing.T) {
	// Reset cache for test isolation
	cacheMu.Lock()
	cache = make(map[string]bool)
	cacheMu.Unlock()

	os.Unsetenv("TEST_FLAG")

	if IsEnabled("TEST_FLAG") {
		t.Error("Expected disabled flag to return false")
	}
}

func TestIsEnabled_True(t *testing.T) {
	// Reset cache for test isolation
	cacheMu.Lock()
	cache = make(map[string]bool)
	cacheMu.Unlock()

	os.Setenv("TEST_FLAG", "true")
	defer os.Unsetenv("TEST_FLAG")

	if !IsEnabled("TEST_FLAG") {
		t.Error("Expected 'true' to enable flag")
	}
}
