From 8dc3ca4db0033d729e559ce477588d08fb4b5dc9 Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Fri, 5 Jan 2024 14:16:32 -0600 Subject: [PATCH] use ToUpper instead --- backend/internal/core/currencies/currencies.go | 4 ++-- backend/internal/core/services/main_test.go | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/backend/internal/core/currencies/currencies.go b/backend/internal/core/currencies/currencies.go index 505b6b1..b6a12c0 100644 --- a/backend/internal/core/currencies/currencies.go +++ b/backend/internal/core/currencies/currencies.go @@ -90,10 +90,10 @@ func (cs *CurrencyRegistry) Slice() []Currency { } func (cs *CurrencyRegistry) IsSupported(code string) bool { - lower := strings.ToLower(code) + upper := strings.ToUpper(code) cs.mu.RLock() defer cs.mu.RUnlock() - _, ok := cs.registry[lower] + _, ok := cs.registry[upper] return ok } diff --git a/backend/internal/core/services/main_test.go b/backend/internal/core/services/main_test.go index 57dce95..ecb07b0 100644 --- a/backend/internal/core/services/main_test.go +++ b/backend/internal/core/services/main_test.go @@ -6,6 +6,7 @@ import ( "os" "testing" + "github.com/hay-kot/homebox/backend/internal/core/currencies" "github.com/hay-kot/homebox/backend/internal/core/services/reporting/eventbus" "github.com/hay-kot/homebox/backend/internal/data/ent" "github.com/hay-kot/homebox/backend/internal/data/repo" @@ -61,7 +62,12 @@ func TestMain(m *testing.M) { tClient = client tRepos = repo.New(tClient, tbus, os.TempDir()+"/homebox") - tSvc = New(tRepos) + + defaults, _ := currencies.CollectionCurrencies( + currencies.CollectDefaults(), + ) + + tSvc = New(tRepos, WithCurrencies(defaults)) defer func() { _ = client.Close() }() bootstrap()