2020-09-29 11:10:57 +02:00
|
|
|
package utils
|
|
|
|
|
|
|
|
import (
|
2022-09-13 18:30:08 +02:00
|
|
|
"io"
|
|
|
|
|
2021-12-29 02:37:15 +02:00
|
|
|
"github.com/jesseduffield/lazygit/pkg/common"
|
|
|
|
"github.com/jesseduffield/lazygit/pkg/config"
|
|
|
|
"github.com/jesseduffield/lazygit/pkg/i18n"
|
2020-09-29 11:10:57 +02:00
|
|
|
"github.com/sirupsen/logrus"
|
|
|
|
)
|
|
|
|
|
|
|
|
// NewDummyLog creates a new dummy Log for testing
|
|
|
|
func NewDummyLog() *logrus.Entry {
|
|
|
|
log := logrus.New()
|
2022-09-13 12:11:03 +02:00
|
|
|
log.Out = io.Discard
|
2020-09-29 11:10:57 +02:00
|
|
|
return log.WithField("test", "test")
|
|
|
|
}
|
2021-12-29 02:37:15 +02:00
|
|
|
|
|
|
|
func NewDummyCommon() *common.Common {
|
|
|
|
tr := i18n.EnglishTranslationSet()
|
|
|
|
return &common.Common{
|
|
|
|
Log: NewDummyLog(),
|
|
|
|
Tr: &tr,
|
2021-12-29 03:03:35 +02:00
|
|
|
UserConfig: config.GetDefaultConfig(),
|
2021-12-29 02:37:15 +02:00
|
|
|
}
|
|
|
|
}
|
2022-01-02 01:34:33 +02:00
|
|
|
|
2022-01-08 04:22:29 +02:00
|
|
|
func NewDummyCommonWithUserConfig(userConfig *config.UserConfig) *common.Common {
|
|
|
|
tr := i18n.EnglishTranslationSet()
|
|
|
|
return &common.Common{
|
|
|
|
Log: NewDummyLog(),
|
|
|
|
Tr: &tr,
|
|
|
|
UserConfig: userConfig,
|
|
|
|
}
|
|
|
|
}
|