mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-09 20:44:03 -08:00
43 lines
742 B
Go
43 lines
742 B
Go
package main
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestEnvvarAvailable(t *testing.T) {
|
|
name := "HERP"
|
|
expected := "derp"
|
|
env := new(MockedEnvironment)
|
|
env.On("getenv", name).Return(expected)
|
|
props := &properties{
|
|
values: map[Property]interface{}{
|
|
VarName: name,
|
|
},
|
|
}
|
|
e := &envvar{
|
|
env: env,
|
|
props: props,
|
|
}
|
|
assert.True(t, e.enabled())
|
|
assert.Equal(t, expected, e.string())
|
|
}
|
|
|
|
func TestEnvvarNotAvailable(t *testing.T) {
|
|
name := "HERP"
|
|
expected := ""
|
|
env := new(MockedEnvironment)
|
|
env.On("getenv", name).Return(expected)
|
|
props := &properties{
|
|
values: map[Property]interface{}{
|
|
VarName: name,
|
|
},
|
|
}
|
|
e := &envvar{
|
|
env: env,
|
|
props: props,
|
|
}
|
|
assert.False(t, e.enabled())
|
|
}
|