Files
webrtc/rtcsctptransportstate_test.go
2019-01-08 13:43:49 -08:00

48 lines
1.1 KiB
Go

package webrtc
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestNewRTCSctpTransportState(t *testing.T) {
testCases := []struct {
transportStateString string
expectedTransportState RTCSctpTransportState
}{
{unknownStr, RTCSctpTransportState(Unknown)},
{"connecting", RTCSctpTransportStateConnecting},
{"connected", RTCSctpTransportStateConnected},
{"closed", RTCSctpTransportStateClosed},
}
for i, testCase := range testCases {
assert.Equal(t,
testCase.expectedTransportState,
newRTCSctpTransportState(testCase.transportStateString),
"testCase: %d %v", i, testCase,
)
}
}
func TestRTCSctpTransportState_String(t *testing.T) {
testCases := []struct {
transportState RTCSctpTransportState
expectedString string
}{
{RTCSctpTransportState(Unknown), unknownStr},
{RTCSctpTransportStateConnecting, "connecting"},
{RTCSctpTransportStateConnected, "connected"},
{RTCSctpTransportStateClosed, "closed"},
}
for i, testCase := range testCases {
assert.Equal(t,
testCase.expectedString,
testCase.transportState.String(),
"testCase: %d %v", i, testCase,
)
}
}