TestIsBranchRef tests the isBranchRef helper that distinguishes branch names from semantic version tags and commit SHAs
(t *testing.T)
| 1014 | // TestIsBranchRef tests the isBranchRef helper that distinguishes branch names |
| 1015 | // from semantic version tags and commit SHAs |
| 1016 | func TestIsBranchRef(t *testing.T) { |
| 1017 | tests := []struct { |
| 1018 | name string |
| 1019 | ref string |
| 1020 | expected bool |
| 1021 | }{ |
| 1022 | {"branch main", "main", true}, |
| 1023 | {"branch develop", "develop", true}, |
| 1024 | {"branch with slash", "feature/foo", true}, |
| 1025 | {"semver tag", "v1.2.3", false}, |
| 1026 | {"semver tag with v", "v0.1.0", false}, |
| 1027 | {"commit SHA", "ea350161ad5dcc9624cf510f134c6a9e39a6f94d", false}, |
| 1028 | } |
| 1029 | |
| 1030 | for _, tt := range tests { |
| 1031 | t.Run(tt.name, func(t *testing.T) { |
| 1032 | result := isBranchRef(tt.ref) |
| 1033 | assert.Equal(t, tt.expected, result, "isBranchRef(%q) should return %v", tt.ref, tt.expected) |
| 1034 | }) |
| 1035 | } |
| 1036 | } |
| 1037 | |
| 1038 | // TestRunUpdateWorkflows_NoSourceWorkflows tests that RunUpdateWorkflows reports a message (not an error) when no source workflows exist |
| 1039 | func TestRunUpdateWorkflows_NoSourceWorkflows(t *testing.T) { |
nothing calls this directly
no test coverage detected