Skip to content

Commit

Permalink
added: unit test file
Browse files Browse the repository at this point in the history
  • Loading branch information
Ash-exp committed Sep 26, 2024
1 parent 49d8a8f commit f141af6
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions pkg/pipeline/util/CiCdUtil_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package util

import "testing"

func TestIsValidUrlSubPath(t *testing.T) {
type args struct {
subPath string
}
tests := []struct {
name string
args args
want bool
}{
{name: "Test Case 1: Invalid URL", args: args{subPath: "%!d(string=)/5.zip%!(EXTRA int=5)"}, want: false},
{name: "Test Case 2: Valid URL", args: args{subPath: "5/5.zip"}, want: true},
{name: "Test Case 3: Valid URL", args: args{subPath: "prefix/1/5.zip"}, want: true},
{name: "Test Case 5: Valid URL", args: args{subPath: "/prefix/1/5.zip"}, want: true},
{name: "Test Case 6: Valid URL", args: args{subPath: "//1/5.zip"}, want: true},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := IsValidUrlSubPath(tt.args.subPath); got != tt.want {
t.Errorf("IsValidUrlSubPath() = %v, want %v", got, tt.want)
}
})
}
}

0 comments on commit f141af6

Please sign in to comment.