48 lines
1 KiB
Go
48 lines
1 KiB
Go
package main
|
|
|
|
import (
|
|
"recipe-manager/config"
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func Test_loadConfig(t *testing.T) {
|
|
type args struct {
|
|
path string
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
want *config.ServerConfig
|
|
wantErr bool
|
|
}{
|
|
// TODO: Add test cases.
|
|
{
|
|
name: "Test Config Local",
|
|
args: args{
|
|
".",
|
|
},
|
|
want: &config.ServerConfig{
|
|
ServerPort: 8080,
|
|
ServerDomain: "http://localhost:8080",
|
|
AllowedOrigins: "http://localhost:4200,http://localhost:8080,http://localhost:3001",
|
|
ClientRedirectURL: "http://localhost:4200/callback",
|
|
APIKey: "AIzaSyDBdJMFN210IcJVmEGJ4AaPQm0FN50iH0s",
|
|
Debug: true,
|
|
},
|
|
wantErr: false,
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
got, err := loadConfig(tt.args.path)
|
|
if (err != nil) != tt.wantErr {
|
|
t.Errorf("loadConfig() error = %v, wantErr %v", err, tt.wantErr)
|
|
return
|
|
}
|
|
if !reflect.DeepEqual(got, tt.want) {
|
|
t.Errorf("loadConfig() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|