package keyspacepoolconfig

import "testing"

func TestCreateRateStoreSeedsCurrentRates(t *testing.T) {
	// Startup config/flags should be written into the current runtime value so
	// the controller sees the configured rate immediately after boot.
	store := NewCreateRateStore(2.5)

	if got, ok := store.Get(); !ok || got != 2.5 {
		t.Fatalf("Get() = (%v, %t), want (2.5, true)", got, ok)
	}
}

func TestCreateRateStoreSetUpdatesCurrentRate(t *testing.T) {
	// Runtime API updates should overwrite the in-memory value directly.
	store := NewCreateRateStore(2.5)

	store.Set(3.5)

	if got, ok := store.Get(); !ok || got != 3.5 {
		t.Fatalf("Get() = (%v, %t), want (3.5, true)", got, ok)
	}
}
