Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
36 lines
940 B
Go
36 lines
940 B
Go
package testserver
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestCreateTestConfig(t *testing.T) {
|
|
// Test 1: Default config (no test config file)
|
|
t.Run("DefaultConfig", func(t *testing.T) {
|
|
cfg := createTestConfig(9999, false)
|
|
|
|
expectedDatabaseName := os.Getenv("DLC_DATABASE_NAME")
|
|
if expectedDatabaseName == "" {
|
|
expectedDatabaseName = "dance_lessons_coach"
|
|
}
|
|
|
|
assert.Equal(t, "0.0.0.0", cfg.Server.Host)
|
|
assert.Equal(t, 9999, cfg.Server.Port)
|
|
assert.Equal(t, "test-secret-key-for-bdd-tests", cfg.Auth.JWTSecret)
|
|
assert.Equal(t, "admin123", cfg.Auth.AdminMasterPassword)
|
|
assert.Equal(t, expectedDatabaseName, cfg.Database.Name)
|
|
})
|
|
|
|
// Test 2: Config with v2 enabled
|
|
t.Run("V2EnabledConfig", func(t *testing.T) {
|
|
cfg := createTestConfig(9999, true)
|
|
|
|
assert.Equal(t, "0.0.0.0", cfg.Server.Host)
|
|
assert.Equal(t, 9999, cfg.Server.Port)
|
|
assert.True(t, cfg.API.V2Enabled)
|
|
})
|
|
}
|