summaryrefslogtreecommitdiffstats
path: root/pkg/integration/components/paths.go
blob: bacc96f819bf7a6d4c89b6f88959eabbb4535746 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package components

import "path/filepath"

// convenience struct for easily getting directories within our test directory.
// We have one test directory for each test, found in test/results.
type Paths struct {
	// e.g. test/results/test_name
	root string
}

func NewPaths(root string) Paths {
	return Paths{root: root}
}

// when a test first runs, it's situated in a repo called 'repo' within this
// directory. In its setup step, the test is allowed to create other repos
// alongside the 'repo' repo in this directory, for example, creating remotes
// or repos to add as submodules.
func (self Paths) Actual() string {
	return filepath.Join(self.root, "actual")
}

// this is the 'repo' directory within the 'actual' directory,
// where a lazygit test will start within.
func (self Paths) ActualRepo() string {
	return filepath.Join(self.Actual(), "repo")
}

// When an integration test first runs, we copy everything in the 'actual' directory,
// and copy it into the 'expected' directory so that future runs can be compared
// against what we expect.
func (self Paths) Expected() string {
	return filepath.Join(self.root, "expected")
}

func (self Paths) Config() string {
	return filepath.Join(self.root, "used_config")
}

func (self Paths) Root() string {
	return self.root
}