MCPcopy
hub / github.com/go-task/task / TestGitNode_buildURL

Function TestGitNode_buildURL

taskfile/node_git_test.go:106–151  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

104}
105
106func TestGitNode_buildURL(t *testing.T) {
107 t.Parallel()
108
109 tests := []struct {
110 name string
111 entrypoint string
112 expectedURL string
113 }{
114 {
115 name: "HTTPS with ref",
116 entrypoint: "https://github.com/foo/bar.git//Taskfile.yml?ref=main",
117 expectedURL: "git::https://github.com/foo/bar.git?ref=main&depth=1",
118 },
119 {
120 name: "SSH with ref",
121 entrypoint: "git@github.com:foo/bar.git//Taskfile.yml?ref=main",
122 expectedURL: "git::ssh://git@github.com/foo/bar.git?ref=main&depth=1",
123 },
124 {
125 name: "HTTPS with tag ref",
126 entrypoint: "https://github.com/foo/bar.git//Taskfile.yml?ref=v1.0.0",
127 expectedURL: "git::https://github.com/foo/bar.git?ref=v1.0.0&depth=1",
128 },
129 {
130 name: "HTTPS without ref (uses remote default branch)",
131 entrypoint: "https://github.com/foo/bar.git//Taskfile.yml",
132 expectedURL: "git::https://github.com/foo/bar.git?depth=1",
133 },
134 {
135 name: "SSH with directory path",
136 entrypoint: "git@github.com:foo/bar.git//directory/Taskfile.yml?ref=dev",
137 expectedURL: "git::ssh://git@github.com/foo/bar.git?ref=dev&depth=1",
138 },
139 }
140
141 for _, tt := range tests {
142 t.Run(tt.name, func(t *testing.T) {
143 t.Parallel()
144
145 node, err := NewGitNode(tt.entrypoint, "", false)
146 require.NoError(t, err)
147 gotURL := node.buildURL()
148 assert.Equal(t, tt.expectedURL, gotURL)
149 })
150 }
151}
152
153func TestRepoCacheKey_SameRepoSameRef(t *testing.T) {
154 t.Parallel()

Callers

nothing calls this directly

Calls 3

buildURLMethod · 0.95
NewGitNodeFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…