forked from pion/webrtc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
api_test.go
39 lines (30 loc) · 635 Bytes
/
api_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// +build !js
package webrtc
import (
"testing"
)
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{}
m.RegisterDefaultCodecs()
api := NewAPI(
WithSettingEngine(s),
WithMediaEngine(m),
)
if !api.settingEngine.detach.DataChannels {
t.Error("Failed to set settings engine")
}
if len(api.mediaEngine.codecs) == 0 {
t.Error("Failed to set media engine")
}
}