config_test.go 851 B

123456789101112131415161718192021222324252627282930313233343536
  1. //Environment file for getting variables
  2. //Currently the only thing it does is set the master password
  3. //Should probably have it take over functions from OS such as port and mongodb connection details
  4. //Reads from the config/environments/dev.yaml file by default
  5. package config
  6. import (
  7. "reflect"
  8. "testing"
  9. )
  10. func Test_readConfig(t *testing.T) {
  11. tests := []struct {
  12. name string
  13. want *EnvironmentConfig
  14. wantErr bool
  15. }{
  16. {
  17. "ensure development config parses",
  18. &EnvironmentConfig{},
  19. false,
  20. },
  21. }
  22. for _, tt := range tests {
  23. t.Run(tt.name, func(t *testing.T) {
  24. got, err := ReadConfig("")
  25. if (err != nil) != tt.wantErr {
  26. t.Errorf("readConfig() error = %v, wantErr %v", err, tt.wantErr)
  27. return
  28. }
  29. if !reflect.DeepEqual(got, tt.want) {
  30. t.Errorf("readConfig() = %v, want %v", got, tt.want)
  31. }
  32. })
  33. }
  34. }