Files
webrtc/api_test.go
Sean DuBois 7edfb701e0 New Track API
The Pion WebRTC API has been dramatically redesigned. The design docs
are located here [0]

You can also read the release notes [1] on how to migrate your
application.

[0] https://github.com/pion/webrtc-v3-design
[1] https://github.com/pion/webrtc/wiki/Release-WebRTC@v3.0.0
2020-11-15 09:20:47 -08:00

42 lines
739 B
Go

// +build !js
package webrtc
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestNewAPI(t *testing.T) {
api := NewAPI()
if api.settingEngine == nil {
t.Error("Failed to init settings engine")
}
if api.mediaEngine == nil {
t.Error("Failed to init media engine")
}
}
func TestNewAPI_Options(t *testing.T) {
s := SettingEngine{}
s.DetachDataChannels()
m := MediaEngine{}
assert.NoError(t, m.RegisterDefaultCodecs())
api := NewAPI(
WithSettingEngine(s),
WithMediaEngine(m),
)
if !api.settingEngine.detach.DataChannels {
t.Error("Failed to set settings engine")
}
if len(api.mediaEngine.audioCodecs) == 0 || len(api.mediaEngine.videoCodecs) == 0 {
t.Error("Failed to set media engine")
}
}