Files
webrtc/mediaengine_test.go
Hugo Arregui 6997cc792c Linter fixes
Disable funlen and some fixes

Co-authored-by: Sean DuBois <sean@siobud.com>
2019-09-10 21:48:25 -07:00

37 lines
714 B
Go

// +build !js
package webrtc
import (
"testing"
"github.com/pion/sdp/v2"
"github.com/stretchr/testify/assert"
)
func TestCodecRegistration(t *testing.T) {
api := NewAPI()
const invalidPT = 255
api.mediaEngine.RegisterDefaultCodecs()
testCases := []struct {
c uint8
e error
}{
{DefaultPayloadTypeG722, nil},
{DefaultPayloadTypeOpus, nil},
{DefaultPayloadTypeVP8, nil},
{DefaultPayloadTypeVP9, nil},
{DefaultPayloadTypeH264, nil},
{invalidPT, ErrCodecNotFound},
}
for _, f := range testCases {
_, err := api.mediaEngine.getCodec(f.c)
assert.Equal(t, f.e, err)
}
_, err := api.mediaEngine.getCodecSDP(sdp.Codec{PayloadType: invalidPT})
assert.Equal(t, err, ErrCodecNotFound)
}