Skip to content

Commit

Permalink
Clean Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeTurki committed Jan 16, 2025
1 parent 6d4bee0 commit e9f56cd
Showing 1 changed file with 2 additions and 51 deletions.
53 changes: 2 additions & 51 deletions candidate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -899,55 +899,6 @@ func TestCandidateExtensionsDeepEqual(t *testing.T) {
}
}

func TestCandidateGetExtension(t *testing.T) {
t.Run("valid", func(t *testing.T) {
candidate := mustCandidateHostWithExtensions(
t,
&CandidateHostConfig{
Network: NetworkTypeTCP4.String(),
Address: "192.168.0.196",
Port: 0,
Priority: 2128609279,
Foundation: "1052353102",
TCPType: TCPTypeActive,
},
[]CandidateExtension{
{"tcptype", TCPTypeActive.String()},
{"generation", "0"},
},
)

value, ok := candidate.GetExtension("tcptype")
require.Equal(t, TCPTypeActive.String(), value)
require.True(t, ok)

value, ok = candidate.GetExtension("generation")
require.Equal(t, "0", value)
require.True(t, ok)

value, ok = candidate.GetExtension("INVALID")
require.Equal(t, "", value)
require.False(t, ok)
})

t.Run("tcptype value no extenstion", func(t *testing.T) {
candidate := mustCandidateHost(
&CandidateHostConfig{
Network: NetworkTypeTCP4.String(),
Address: "192.168.0.196",
Port: 0,
Priority: 2128609279,
Foundation: "1052353102",
TCPType: TCPTypeActive,
},
)

value, ok := candidate.GetExtension("tcptype")
require.Equal(t, TCPTypeActive.String(), value)
require.True(t, ok)
})
}

func TestUnmarshalCandidateExtensions(t *testing.T) {
testCases := []struct {
name string
Expand Down Expand Up @@ -1011,7 +962,7 @@ func TestUnmarshalCandidateExtensions(t *testing.T) {
}
}

func TestExtensionGet(t *testing.T) {
func TestCandidateGetExtension(t *testing.T) {
t.Run("Get extension", func(t *testing.T) {
extensions := []CandidateExtension{
{"a", "b"},
Expand Down Expand Up @@ -1123,7 +1074,7 @@ func TestExtensionGet(t *testing.T) {
})
}

func TestExtensionMarhshal(t *testing.T) {
func TestBaseCandidateMarshalExtensions(t *testing.T) {
t.Run("Marshal extension", func(t *testing.T) {
extensions := []CandidateExtension{
{"generation", "0"},
Expand Down

0 comments on commit e9f56cd

Please sign in to comment.