Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 10 additions & 30 deletions pkg/workflow/strings_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package workflow

import "testing"
import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestSortStrings(t *testing.T) {
tests := []struct {
Expand Down Expand Up @@ -48,16 +52,7 @@ func TestSortStrings(t *testing.T) {

SortStrings(result)

if len(result) != len(tt.expected) {
t.Errorf("SortStrings() length = %d, want %d", len(result), len(tt.expected))
return
}

for i := range result {
if result[i] != tt.expected[i] {
t.Errorf("SortStrings() at index %d = %q, want %q", i, result[i], tt.expected[i])
}
}
assert.Equal(t, tt.expected, result, "SortStrings should return correctly sorted slice")
})
}
}
Expand Down Expand Up @@ -103,16 +98,7 @@ func TestSortPermissionScopes(t *testing.T) {

SortPermissionScopes(result)

if len(result) != len(tt.expected) {
t.Errorf("SortPermissionScopes() length = %d, want %d", len(result), len(tt.expected))
return
}

for i := range result {
if result[i] != tt.expected[i] {
t.Errorf("SortPermissionScopes() at index %d = %q, want %q", i, result[i], tt.expected[i])
}
}
assert.Equal(t, tt.expected, result, "SortPermissionScopes should return correctly sorted slice")
})
}
}
Expand Down Expand Up @@ -198,9 +184,7 @@ func TestSanitizeWorkflowName(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result := SanitizeWorkflowName(tt.input)
if result != tt.expected {
t.Errorf("SanitizeWorkflowName(%q) = %q, want %q", tt.input, result, tt.expected)
}
assert.Equal(t, tt.expected, result, "SanitizeWorkflowName should sanitize input correctly")
})
}
}
Expand Down Expand Up @@ -256,9 +240,7 @@ func TestShortenCommand(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result := ShortenCommand(tt.input)
if result != tt.expected {
t.Errorf("ShortenCommand(%q) = %q, want %q", tt.input, result, tt.expected)
}
assert.Equal(t, tt.expected, result, "ShortenCommand should process input correctly")
})
}
}
Expand Down Expand Up @@ -437,9 +419,7 @@ func TestSanitizeName(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result := SanitizeName(tt.input, tt.opts)
if result != tt.expected {
t.Errorf("SanitizeName(%q, %+v) = %q, want %q", tt.input, tt.opts, result, tt.expected)
}
assert.Equal(t, tt.expected, result, "SanitizeName should sanitize input according to options")
})
}
}
Loading