Skip to content

Commit

Permalink
add test to make sure new directory is created
Browse files Browse the repository at this point in the history
  • Loading branch information
emilwareus committed Feb 16, 2024
1 parent eb0df46 commit 025fcbb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions internal/fingerprint/fingerprint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,12 @@ func TestFingerprintsToFile(t *testing.T) {
outputFile: "/invalid/path/fingerprints.wfp",
expectedError: true,
},
{
name: "Create non-existent directory",
setupMock: func() {},
outputFile: "test/newfile/debricked.fingerprints.txt",
expectedError: false,
},
}

for _, tt := range tests {
Expand Down Expand Up @@ -268,6 +274,10 @@ func TestFingerprintsToFile(t *testing.T) {
assert.Error(t, err)
} else {
assert.NoError(t, err)

// Check if the file exists
_, err := os.Stat(filepath.Join(dir, tt.outputFile))
assert.NoError(t, err)
}
})
}
Expand Down

0 comments on commit 025fcbb

Please sign in to comment.