2024-09-24 13:44:54 -04:00
|
|
|
package taskfile
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestScheme(t *testing.T) {
|
2024-12-12 01:47:10 +01:00
|
|
|
t.Parallel()
|
|
|
|
|
2024-09-24 13:44:54 -04:00
|
|
|
scheme, err := getScheme("https://github.com/foo/bar.git")
|
|
|
|
assert.NoError(t, err)
|
|
|
|
assert.Equal(t, "git", scheme)
|
|
|
|
scheme, err = getScheme("https://github.com/foo/bar.git?ref=v1//taskfile/common.yml")
|
|
|
|
assert.NoError(t, err)
|
|
|
|
assert.Equal(t, "git", scheme)
|
|
|
|
scheme, err = getScheme("git@github.com:foo/bar.git?ref=main//Taskfile.yml")
|
|
|
|
assert.NoError(t, err)
|
|
|
|
assert.Equal(t, "git", scheme)
|
|
|
|
scheme, err = getScheme("https://github.com/foo/common.yml")
|
|
|
|
assert.NoError(t, err)
|
|
|
|
assert.Equal(t, "https", scheme)
|
|
|
|
}
|