github.com/pion/webrtc/v3@v3.2.24/icetransportpolicy_test.go (about)

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