-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathapi_test.go
44 lines (34 loc) · 1.08 KB
/
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
40
41
42
43
44
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
// SPDX-License-Identifier: MIT
//go:build !js
// +build !js
package webrtc
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestNewAPI(t *testing.T) {
api := NewAPI()
assert.NotNil(t, api.settingEngine, "failed to init settings engine")
assert.NotNil(t, api.mediaEngine, "failed to init media engine")
assert.NotNil(t, api.interceptorRegistry, "failed to init interceptor registry")
}
func TestNewAPI_Options(t *testing.T) {
s := SettingEngine{}
s.DetachDataChannels()
api := NewAPI(
WithSettingEngine(s),
)
assert.True(t, api.settingEngine.detach.DataChannels, "failed to set settings engine")
assert.NotEmpty(t, api.mediaEngine.audioCodecs, "failed to set audio codecs")
assert.NotEmpty(t, api.mediaEngine.videoCodecs, "failed to set video codecs")
}
func TestNewAPI_OptionsDefaultize(t *testing.T) {
api := NewAPI(
WithMediaEngine(nil),
WithInterceptorRegistry(nil),
)
assert.NotNil(t, api.settingEngine)
assert.NotNil(t, api.mediaEngine)
assert.NotNil(t, api.interceptorRegistry)
}