MCPcopy Create free account
hub / github.com/github/gh-aw / TestBranchPrefixValidation

Function TestBranchPrefixValidation

pkg/workflow/repo_memory_test.go:842–955  ·  view source on GitHub ↗

TestBranchPrefixValidation tests the validateBranchPrefix function

(t *testing.T)

Source from the content-addressed store, hash-verified

840
841// TestBranchPrefixValidation tests the validateBranchPrefix function
842func TestBranchPrefixValidation(t *testing.T) {
843 tests := []struct {
844 name string
845 prefix string
846 wantErr bool
847 errMsg string
848 }{
849 {
850 name: "empty prefix (use default)",
851 prefix: "",
852 wantErr: false,
853 },
854 {
855 name: "valid prefix - alphanumeric",
856 prefix: "memories",
857 wantErr: false,
858 },
859 {
860 name: "valid prefix - daily (5 chars)",
861 prefix: "daily",
862 wantErr: false,
863 },
864 {
865 name: "valid prefix - with hyphens",
866 prefix: "my-memory",
867 wantErr: false,
868 },
869 {
870 name: "valid prefix - with underscores",
871 prefix: "my_memory",
872 wantErr: false,
873 },
874 {
875 name: "valid prefix - mixed",
876 prefix: "test_mem-123",
877 wantErr: false,
878 },
879 {
880 name: "valid prefix - exactly 4 chars",
881 prefix: "mem1",
882 wantErr: false,
883 },
884 {
885 name: "valid prefix - 5 chars",
886 prefix: "mem12",
887 wantErr: false,
888 },
889 {
890 name: "valid prefix - exactly 32 chars",
891 prefix: "12345678901234567890123456789012",
892 wantErr: false,
893 },
894 {
895 name: "invalid - too short (3 chars)",
896 prefix: "mem",
897 wantErr: true,
898 errMsg: "must be at least 4 characters long",
899 },

Callers

nothing calls this directly

Calls 3

validateBranchPrefixFunction · 0.85
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected