MCPcopy Index your code
hub / github.com/devspace-sh/devspace / testExists

Function testExists

pkg/devspace/config/loader/loader_test.go:78–97  ·  view source on GitHub ↗
(testCase existsTestCase, t *testing.T)

Source from the content-addressed store, hash-verified

76}
77
78func testExists(testCase existsTestCase, t *testing.T) {
79 defer func() {
80 for _, path := range []string{".devspace/generated.yaml"} {
81 os.Remove(path)
82 }
83 }()
84 for path, data := range testCase.files {
85 dataAsYaml, err := yaml.Marshal(data)
86 assert.NilError(t, err, "Error parsing data of file %s in testCase %s", path, testCase.name)
87 err = fsutil.WriteToFile([]byte(dataAsYaml), path)
88 assert.NilError(t, err, "Error writing file %s in testCase %s", path, testCase.name)
89 }
90
91 loader := &configLoader{
92 absConfigPath: testCase.configPath,
93 }
94
95 exists := loader.Exists()
96 assert.Equal(t, exists, testCase.expectedanswer, "Unexpected answer in testCase %s", testCase.name)
97}
98
99type cloneTestCase struct {
100 name string

Callers 1

TestExistsFunction · 0.85

Calls 4

ExistsMethod · 0.95
WriteToFileFunction · 0.92
EqualMethod · 0.80
RemoveMethod · 0.65

Tested by

no test coverage detected