icetransportpolicy_test.go 943 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
  2. // SPDX-License-Identifier: MIT
  3. package webrtc
  4. import (
  5. "testing"
  6. "github.com/stretchr/testify/assert"
  7. )
  8. func TestNewICETransportPolicy(t *testing.T) {
  9. testCases := []struct {
  10. policyString string
  11. expectedPolicy ICETransportPolicy
  12. }{
  13. {"relay", ICETransportPolicyRelay},
  14. {"all", ICETransportPolicyAll},
  15. }
  16. for i, testCase := range testCases {
  17. assert.Equal(t,
  18. testCase.expectedPolicy,
  19. NewICETransportPolicy(testCase.policyString),
  20. "testCase: %d %v", i, testCase,
  21. )
  22. }
  23. }
  24. func TestICETransportPolicy_String(t *testing.T) {
  25. testCases := []struct {
  26. policy ICETransportPolicy
  27. expectedString string
  28. }{
  29. {ICETransportPolicyRelay, "relay"},
  30. {ICETransportPolicyAll, "all"},
  31. }
  32. for i, testCase := range testCases {
  33. assert.Equal(t,
  34. testCase.expectedString,
  35. testCase.policy.String(),
  36. "testCase: %d %v", i, testCase,
  37. )
  38. }
  39. }