func TestGraph(t *testing.T) {
	fakeFileSystem := afero.NewMemMapFs()
	err := fakeFileSystem.Mkdir("app", 0755)
	appKustomizationFileContents := `
bases:
- same
- ./middle
`
	afero.WriteFile(fakeFileSystem, "app/kustomization.yaml", []byte(appKustomizationFileContents), 0644)
	fakeFileSystem.Mkdir("app/same", 0755)
	sameKustomizationFileContents := ""
	afero.WriteFile(fakeFileSystem, "app/same/kustomization.yaml", []byte(sameKustomizationFileContents), 0644)
	fakeFileSystem.Mkdir("app/middle", 0755)
	middleKustomizationFileContents := `
bases:
- ../base
`
	afero.WriteFile(fakeFileSystem, "app/middle/kustomization.yaml", []byte(middleKustomizationFileContents), 0644)
	fakeFileSystem.Mkdir("app/base", 0755)
	baseKustomizationFileContents := ""
	afero.WriteFile(fakeFileSystem, "app/base/kustomization.yaml", []byte(baseKustomizationFileContents), 0644)
	graphContext := New("main")
	kustomizationFileContext := kustomizationfile.NewFromFileSystem(fakeFileSystem)
	err = graphContext.buildGraph(kustomizationFileContext, "app", "")
	if err != nil {
		t.Fatalf("Could not generate graph %v.", err)
	}
	expectedNodes := []string{
		wrapElement("app"),
		wrapElement("app/same"),
		wrapElement("app/middle"),
		wrapElement("app/base"),
	}
	for _, node := range expectedNodes {
		if !graphContext.IsNode(node) {
			t.Errorf("Expected node %v was not found", node)
		}
	}
	appFolderEdges := graphContext.Edges.SrcToDsts[wrapElement("app")]
	if _, exists := appFolderEdges[wrapElement("app/middle")]; !exists {
		t.Errorf("Expected edge [app -> app/middle] was not found")
	}
	if _, exists := appFolderEdges[wrapElement("app/same")]; !exists {
		t.Errorf("Expected edge [app -> app/same] was not found")
	}
	middleFolderEdges := graphContext.Edges.SrcToDsts[wrapElement("app/middle")]
	if _, exists := middleFolderEdges[wrapElement("app/base")]; !exists {
		t.Errorf("Expected edge [app/middle -> app/base] was not found")
	}
}
TestGraph tests creating a graph using different ways
that a base kustomization file can be referenced (e.g.)

- ./singledot
- justfolder
- ../updirectory
package kustomizationgraph
import (
	"testing"
	"github.com/spf13/afero"
	"github.com/jpreese/kustomize-graph/pkg/kustomizationfile"
)