23 lines
437 B
Go
23 lines
437 B
Go
|
package config
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestReadFile(t *testing.T) {
|
||
|
c := Default()
|
||
|
|
||
|
err := c.ReadFile("../config.example.toml")
|
||
|
|
||
|
if err != nil {
|
||
|
t.Fatalf("failed to read config file: %v", err)
|
||
|
}
|
||
|
|
||
|
// Validate the values are correctly set based on the TOML file
|
||
|
expectedBaseURL := "http://localhost:8080"
|
||
|
if c.BaseUrl != expectedBaseURL {
|
||
|
t.Errorf("expected BaseUrl to be '%v', got '%v'", expectedBaseURL, c.BaseUrl)
|
||
|
}
|
||
|
|
||
|
}
|