summaryrefslogtreecommitdiffstats
path: root/pkg/config/dummies.go
blob: 034d9b88b2be60b2c5626b28470bde0ec06fbc7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package config

import (
	"github.com/spf13/viper"
	yaml "gopkg.in/yaml.v2"
)

// NewDummyAppConfig creates a new dummy AppConfig for testing
func NewDummyAppConfig() *AppConfig {
	userConfig := viper.New()
	userConfig.SetConfigType("yaml")
	if err := LoadDefaults(userConfig, GetDefaultConfig()); err != nil {
		panic(err)
	}
	appConfig := &AppConfig{
		Name:        "lazygit",
		Version:     "unversioned",
		Commit:      "",
		BuildDate:   "",
		Debug:       false,
		BuildSource: "",
		UserConfig:  userConfig,
	}
	_ = yaml.Unmarshal([]byte{}, appConfig.AppState)
	return appConfig
}