Skip to content

Commit 01e3717

Browse files
add robust test and use temp dir for tests
Signed-off-by: Muhammad Akewukanwo <muhammadolammi@gmail.com>
1 parent 477ce39 commit 01e3717

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

generators/github/package_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ func TestGenerateCompFromGitHub(t *testing.T) {
162162
t.Errorf("error while generating components: %v", err)
163163
return
164164
}
165+
currentDirectory := t.TempDir()
165166
for _, comp := range comps {
166-
currentDirectory, _ := os.Getwd()
167167
if comp.Model == nil {
168168
t.Errorf("component %s has nil Model", comp.Component.Kind)
169169
continue
@@ -178,7 +178,6 @@ func TestGenerateCompFromGitHub(t *testing.T) {
178178
}
179179
}
180180
byt, _ := json.MarshalIndent(comp, "", "")
181-
182181
f, err := os.Create(fmt.Sprintf("%s/%s%s", dirName, comp.Component.Kind, ".json"))
183182
if err != nil {
184183
t.Errorf("error creating file for %s: %v", comp.Component.Kind, err)

0 commit comments

Comments
 (0)