Test improvements (#136)

* Fix "ineffectual assignment" linter warning

* Simplify TestClientCouldConnect

* Simplify range expression
This commit is contained in:
Artur Shellunts
2021-10-11 07:37:31 +02:00
committed by GitHub
parent 575b99840a
commit 03342efe4f
2 changed files with 3 additions and 7 deletions

View File

@@ -154,7 +154,7 @@ func scenarioWSReconnect(t *testing.T) {
func publishTracksForClients(t *testing.T, clients ...*testclient.RTCClient) []*testclient.TrackWriter {
logger.Infow("publishing tracks for clients")
var writers []*testclient.TrackWriter
for i, _ := range clients {
for i := range clients {
c := clients[i]
tw, err := c.AddStaticTrack("audio/opus", "audio", "webcam")
require.NoError(t, err)

View File

@@ -28,11 +28,7 @@ func TestClientCouldConnect(t *testing.T) {
// ensure they both see each other
testutils.WithTimeout(t, "c1 and c2 could connect", func() bool {
if len(c1.RemoteParticipants()) == 0 || len(c2.RemoteParticipants()) == 0 {
return false
}
//require.Equal()
return true
return len(c1.RemoteParticipants()) != 0 && len(c2.RemoteParticipants()) != 0
})
}
@@ -103,7 +99,7 @@ func TestSinglePublisher(t *testing.T) {
// when c3 disconnects.. ensure subscriber is cleaned up correctly
c3.Stop()
success = testutils.WithTimeout(t, "c3 is cleaned up as a subscriber", func() bool {
testutils.WithTimeout(t, "c3 is cleaned up as a subscriber", func() bool {
room := s.RoomManager().GetRoom(context.Background(), testRoom)
require.NotNil(t, room)