mirror of
https://github.com/pion/webrtc.git
synced 2025-10-07 16:10:55 +08:00

Users are unable to use the callbacks inside `internal/ice`. Even though we alias things like OnSelectedCandidatePairChange are unusable since in the package they use `ice.Candidate` instead of `ICECandidate`
44 lines
841 B
Go
44 lines
841 B
Go
package webrtc
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestNewICETransportPolicy(t *testing.T) {
|
|
testCases := []struct {
|
|
policyString string
|
|
expectedPolicy ICETransportPolicy
|
|
}{
|
|
{"relay", ICETransportPolicyRelay},
|
|
{"all", ICETransportPolicyAll},
|
|
}
|
|
|
|
for i, testCase := range testCases {
|
|
assert.Equal(t,
|
|
testCase.expectedPolicy,
|
|
NewICETransportPolicy(testCase.policyString),
|
|
"testCase: %d %v", i, testCase,
|
|
)
|
|
}
|
|
}
|
|
|
|
func TestICETransportPolicy_String(t *testing.T) {
|
|
testCases := []struct {
|
|
policy ICETransportPolicy
|
|
expectedString string
|
|
}{
|
|
{ICETransportPolicyRelay, "relay"},
|
|
{ICETransportPolicyAll, "all"},
|
|
}
|
|
|
|
for i, testCase := range testCases {
|
|
assert.Equal(t,
|
|
testCase.expectedString,
|
|
testCase.policy.String(),
|
|
"testCase: %d %v", i, testCase,
|
|
)
|
|
}
|
|
}
|