use IsReady instead of checking for multiple statuses
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package rtc
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/livekit/livekit-server/proto/livekit"
|
||||
)
|
||||
|
||||
func TestIsReady(t *testing.T) {
|
||||
tests := []struct {
|
||||
state livekit.ParticipantInfo_State
|
||||
ready bool
|
||||
}{
|
||||
{
|
||||
state: livekit.ParticipantInfo_JOINING,
|
||||
ready: false,
|
||||
},
|
||||
{
|
||||
state: livekit.ParticipantInfo_JOINED,
|
||||
ready: true,
|
||||
},
|
||||
{
|
||||
state: livekit.ParticipantInfo_ACTIVE,
|
||||
ready: true,
|
||||
},
|
||||
{
|
||||
state: livekit.ParticipantInfo_DISCONNECTED,
|
||||
ready: false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.state.String(), func(t *testing.T) {
|
||||
p := &ParticipantImpl{
|
||||
state: test.state,
|
||||
}
|
||||
assert.Equal(t, test.ready, p.IsReady())
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user