A container registry that uses the AT Protocol for manifest storage and S3 for blob storage.

remove old test file

evan.jarrett.net af99929a 7f2d780b

verified
-65
-65
pkg/appview/utils_test.go
··· 1 - package appview 2 - 3 - import ( 4 - "testing" 5 - 6 - "atcr.io/pkg/atproto" 7 - ) 8 - 9 - func TestResolveHoldURL(t *testing.T) { 10 - tests := []struct { 11 - name string 12 - input string 13 - expected string 14 - }{ 15 - { 16 - name: "DID with HTTPS domain", 17 - input: "did:web:hold.example.com", 18 - expected: "https://hold.example.com", 19 - }, 20 - { 21 - name: "DID with HTTP and port (IP)", 22 - input: "did:web:172.28.0.3:8080", 23 - expected: "http://172.28.0.3:8080", 24 - }, 25 - { 26 - name: "DID with HTTP and port (localhost)", 27 - input: "did:web:127.0.0.1:8080", 28 - expected: "http://127.0.0.1:8080", 29 - }, 30 - { 31 - name: "DID with localhost", 32 - input: "did:web:localhost:8080", 33 - expected: "http://localhost:8080", 34 - }, 35 - { 36 - name: "Already HTTPS URL (passthrough)", 37 - input: "https://hold.example.com", 38 - expected: "https://hold.example.com", 39 - }, 40 - { 41 - name: "Already HTTP URL (passthrough)", 42 - input: "http://172.28.0.3:8080", 43 - expected: "http://172.28.0.3:8080", 44 - }, 45 - { 46 - name: "Plain hostname (fallback to HTTPS)", 47 - input: "hold.example.com", 48 - expected: "https://hold.example.com", 49 - }, 50 - { 51 - name: "DID with subdomain", 52 - input: "did:web:hold01.atcr.io", 53 - expected: "https://hold01.atcr.io", 54 - }, 55 - } 56 - 57 - for _, tt := range tests { 58 - t.Run(tt.name, func(t *testing.T) { 59 - result := atproto.ResolveHoldURL(tt.input) 60 - if result != tt.expected { 61 - t.Errorf("ResolveHoldURL(%q) = %q, want %q", tt.input, result, tt.expected) 62 - } 63 - }) 64 - } 65 - }