aboutsummaryrefslogtreecommitdiffstats
path: root/internal/configloader/configloader_unix_test.go
blob: 5c65c3702dce749b1bf794959929f34021bbb331 (plain) (blame)
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
27
// go:build unix

package configloader_test

import (
	"os"
	"testing"

	"github.com/eugenetriguba/bolt/internal/configloader"
	"gotest.tools/v3/assert"
)

func TestNewConfigUnixSearchesToRootFilePath(t *testing.T) {
	expectedCfg := configloader.Config{
		MigrationsDir: "differentmigrationsdir",
	}
	createConfigFile(t, &expectedCfg, "/bolt.toml")

	homedir, err := os.UserHomeDir()
	assert.NilError(t, err)
	changeCwd(t, homedir)

	cfg, err := configloader.NewConfig()
	assert.NilError(t, err)

	assert.DeepEqual(t, *cfg, expectedCfg)
}