github.com/codefly-dev/core@v0.1.107/resources/network_test.go (about) 1 package resources_test 2 3 import ( 4 "testing" 5 6 "github.com/codefly-dev/core/resources" 7 "github.com/stretchr/testify/require" 8 ) 9 10 func TestParsingFromAddress(t *testing.T) { 11 tcs := []struct { 12 address string 13 hostname string 14 port uint16 15 }{ 16 {"localhost:8080", "localhost", 8080}, 17 {"http://localhost:8080", "localhost", 8080}, 18 } 19 for _, tc := range tcs { 20 t.Run(tc.address, func(t *testing.T) { 21 add, err := resources.ParseAddress(tc.address) 22 require.NoError(t, err) 23 require.Equal(t, tc.port, add.Port) 24 require.Equal(t, tc.hostname, add.Hostname) 25 }) 26 } 27 }