Some checks failed
REUSE Compliance Check / lint (push) Failing after 0s
Browser E2E / Test (push) Failing after 3s
Test / test (1.24) (push) Failing after 0s
Test / test-i386 (1.25) (push) Failing after 0s
Test / test-i386 (1.24) (push) Failing after 0s
Test / test-windows (1.25) (push) Failing after 0s
Test / test-windows (1.24) (push) Failing after 0s
Test / test (1.25) (push) Failing after 0s
Examples Tests / Test (push) Failing after 3s
Test / test-macos (1.25) (push) Failing after 0s
Test / test-macos (1.24) (push) Failing after 0s
Go mod tidy / tidy (push) Failing after 0s
Test / test-wasm (push) Failing after 0s
CodeQL / analyze (push) Failing after 1s
Fuzz / fuzz (push) Failing after 0s
44 lines
1.1 KiB
Go
44 lines
1.1 KiB
Go
// SPDX-FileCopyrightText: 2026 The Pion community <https://pion.ly>
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
//go: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)
|
|
}
|