We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stakwork Run
File: /tmp/stakwork/sphinx-tribes/utils/ticket_processor.go
package utils import ( "errors" "strings" "testing" "github.com/stretchr/testify/assert" ) // Mock struct for testing type TicketReviewRequest struct { Value struct { FeatureUUID string PhaseUUID string TicketUUID string TicketDescription string } } func TestValidateTicketReviewRequest(t *testing.T) { tests := []struct { name string input *TicketReviewRequest expected error }{ { name: "Valid Input", input: &TicketReviewRequest{ Value: struct { FeatureUUID string PhaseUUID string TicketUUID string TicketDescription string }{ TicketUUID: "123e4567-e89b-12d3-a456-426614174000", TicketDescription: "This is a valid ticket description.", }, }, expected: nil, }, { name: "Empty TicketUUID", input: &TicketReviewRequest{ Value: struct { FeatureUUID string PhaseUUID string TicketUUID string TicketDescription string }{ TicketUUID: "", TicketDescription: "This is a valid ticket description.", }, }, expected: errors.New("ticketUUID is required"), }, { name: "Empty TicketDescription", input: &TicketReviewRequest{ Value: struct { FeatureUUID string PhaseUUID string TicketUUID string TicketDescription string }{ TicketUUID: "123e4567-e89b-12d3-a456-426614174000", TicketDescription: "", }, }, expected: errors.New("ticketDescription is required"), }, { name: "Both TicketUUID and TicketDescription Empty", input: &TicketReviewRequest{ Value: struct { FeatureUUID string PhaseUUID string TicketUUID string TicketDescription string }{ TicketUUID: "", TicketDescription: "", }, }, expected: errors.New("ticketUUID is required"), }, { name: "Nil Request", input: nil, expected: errors.New("nil request"), }, { name: "Whitespace TicketUUID", input: &TicketReviewRequest{ Value: struct { FeatureUUID string PhaseUUID string TicketUUID string TicketDescription string }{ TicketUUID: " ", TicketDescription: "This is a valid ticket description.", }, }, expected: errors.New("ticketUUID is required"), }, { name: "Whitespace TicketDescription", input: &TicketReviewRequest{ Value: struct { FeatureUUID string PhaseUUID string TicketUUID string TicketDescription string }{ TicketUUID: "123e4567-e89b-12d3-a456-426614174000", TicketDescription: " ", }, }, expected: errors.New("ticketDescription is required"), }, { name: "Large TicketDescription", input: &TicketReviewRequest{ Value: struct { FeatureUUID string PhaseUUID string TicketUUID string TicketDescription string }{ TicketUUID: "123e4567-e89b-12d3-a456-426614174000", TicketDescription: strings.Repeat("a", 10000), }, }, expected: nil, }, { name: "Non-UUID TicketUUID", input: &TicketReviewRequest{ Value: struct { FeatureUUID string PhaseUUID string TicketUUID string TicketDescription string }{ TicketUUID: "not-a-uuid", TicketDescription: "This is a valid ticket description.", }, }, expected: nil, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { var result error if tt.input == nil { result = errors.New("nil request") } else { result = ValidateTicketReviewRequest(tt.input) } assert.Equal(t, tt.expected, result) }) } }
The text was updated successfully, but these errors were encountered:
@tomsmith8 assign me?
Sorry, something went wrong.
@tomsmith8 Please assign me?
@tomsmith8 please assign
@tomsmith8 can I help?
aliraza556
Successfully merging a pull request may close this issue.
Unit Test Coverage for "ValidateTicketReviewRequest"
Stakwork Run
Unit Test Code
File: /tmp/stakwork/sphinx-tribes/utils/ticket_processor.go
The text was updated successfully, but these errors were encountered: