package main import ( "net/http" "testing" "codeberg.org/vlbeaudoin/voki/v3" "github.com/spf13/viper" ) func TestAPI(t *testing.T) { var cfg Config if err := viper.Unmarshal(&cfg); err != nil { t.Error(err) return } httpClient := http.DefaultClient defer httpClient.CloseIdleConnections() vokiClient := voki.New(httpClient, "localhost", cfg.API.Key, cfg.API.Port, "http") apiClient := APIClient{vokiClient} t.Run("get API health", func(t *testing.T) { health, err := apiClient.GetHealth() if err != nil { t.Error(err) } want := "ok" got := health if want != got { t.Errorf("want=%s got=%s", want, got) } }) }