cloudflare/cloudflared
Publicmirrored from https://github.com/cloudflare/cloudflaredAvailable
cmd/cloudflared/access/cmd_test.go
25lines · modecode
| 1 | package access |
| 2 | |
| 3 | import "testing" |
| 4 | |
| 5 | func Test_ensureURLScheme(t *testing.T) { |
| 6 | type args struct { |
| 7 | url string |
| 8 | } |
| 9 | tests := []struct { |
| 10 | name string |
| 11 | args args |
| 12 | want string |
| 13 | }{ |
| 14 | {"no scheme", args{"localhost:123"}, "https://localhost:123"}, |
| 15 | {"http scheme", args{"http://test"}, "https://test"}, |
| 16 | {"https scheme", args{"https://test"}, "https://test"}, |
| 17 | } |
| 18 | for _, tt := range tests { |
| 19 | t.Run(tt.name, func(t *testing.T) { |
| 20 | if got := ensureURLScheme(tt.args.url); got != tt.want { |
| 21 | t.Errorf("ensureURLScheme() = %v, want %v", got, tt.want) |
| 22 | } |
| 23 | }) |
| 24 | } |
| 25 | } |
| 26 | |