tangled
alpha
login
or
join now
cuducos.me
/
at-container-registry
forked from
evan.jarrett.net/at-container-registry
0
fork
atom
A container registry that uses the AT Protocol for manifest storage and S3 for blob storage.
0
fork
atom
overview
issues
pulls
pipelines
remove old test file
evan.jarrett.net
2 months ago
af99929a
7f2d780b
verified
This commit was signed with the committer's
known signature
.
evan.jarrett.net
SSH Key Fingerprint:
SHA256:bznk0uVPp7XFOl67P0uTM1pCjf2A4ojeP/lsUE7uauQ=
-65
1 changed file
expand all
collapse all
unified
split
pkg
appview
utils_test.go
-65
pkg/appview/utils_test.go
···
1
1
-
package appview
2
2
-
3
3
-
import (
4
4
-
"testing"
5
5
-
6
6
-
"atcr.io/pkg/atproto"
7
7
-
)
8
8
-
9
9
-
func TestResolveHoldURL(t *testing.T) {
10
10
-
tests := []struct {
11
11
-
name string
12
12
-
input string
13
13
-
expected string
14
14
-
}{
15
15
-
{
16
16
-
name: "DID with HTTPS domain",
17
17
-
input: "did:web:hold.example.com",
18
18
-
expected: "https://hold.example.com",
19
19
-
},
20
20
-
{
21
21
-
name: "DID with HTTP and port (IP)",
22
22
-
input: "did:web:172.28.0.3:8080",
23
23
-
expected: "http://172.28.0.3:8080",
24
24
-
},
25
25
-
{
26
26
-
name: "DID with HTTP and port (localhost)",
27
27
-
input: "did:web:127.0.0.1:8080",
28
28
-
expected: "http://127.0.0.1:8080",
29
29
-
},
30
30
-
{
31
31
-
name: "DID with localhost",
32
32
-
input: "did:web:localhost:8080",
33
33
-
expected: "http://localhost:8080",
34
34
-
},
35
35
-
{
36
36
-
name: "Already HTTPS URL (passthrough)",
37
37
-
input: "https://hold.example.com",
38
38
-
expected: "https://hold.example.com",
39
39
-
},
40
40
-
{
41
41
-
name: "Already HTTP URL (passthrough)",
42
42
-
input: "http://172.28.0.3:8080",
43
43
-
expected: "http://172.28.0.3:8080",
44
44
-
},
45
45
-
{
46
46
-
name: "Plain hostname (fallback to HTTPS)",
47
47
-
input: "hold.example.com",
48
48
-
expected: "https://hold.example.com",
49
49
-
},
50
50
-
{
51
51
-
name: "DID with subdomain",
52
52
-
input: "did:web:hold01.atcr.io",
53
53
-
expected: "https://hold01.atcr.io",
54
54
-
},
55
55
-
}
56
56
-
57
57
-
for _, tt := range tests {
58
58
-
t.Run(tt.name, func(t *testing.T) {
59
59
-
result := atproto.ResolveHoldURL(tt.input)
60
60
-
if result != tt.expected {
61
61
-
t.Errorf("ResolveHoldURL(%q) = %q, want %q", tt.input, result, tt.expected)
62
62
-
}
63
63
-
})
64
64
-
}
65
65
-
}