Skip to content

Commit

Permalink
add unit test for VCSRemoteForImport
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry S authored and dmitris committed Feb 11, 2025
1 parent 5ad920f commit c3f83d8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
4 changes: 3 additions & 1 deletion go_modules/helpers/importresolver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ func VCSRemoteForImport(args *Args) (interface{}, error) {
if err != nil {
return nil, err
}

defer func() {
os.RemoveAll(repo.LocalPath())
}()
return repo.Remote(), nil
}
15 changes: 15 additions & 0 deletions go_modules/helpers/importresolver/main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package importresolver

import (
"testing"
)

func TestVCSRemoteForImport(t *testing.T) {
args := &Args{
Import: "https://github.com/dependabot/dependabot-core",
}
_, err := VCSRemoteForImport(args)
if err != nil {
t.Fatalf("failed to get VCS remote for import %s: %v", args.Import, err)
}
}

0 comments on commit c3f83d8

Please sign in to comment.