diff --git a/agent_get_best_available_candidate_pair_test.go b/agent_get_best_available_candidate_pair_test.go new file mode 100644 index 0000000..5077ba3 --- /dev/null +++ b/agent_get_best_available_candidate_pair_test.go @@ -0,0 +1,28 @@ +//go:build !js +// +build !js + +package ice + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestNoBestAvailableCandidatePairAfterAgentConstruction(t *testing.T) { + agent := setupTest(t) + + require.Nil(t, agent.getBestAvailableCandidatePair()) + + tearDownTest(t, agent) +} + +func setupTest(t *testing.T) *Agent { + agent, err := NewAgent(&AgentConfig{}) + require.NoError(t, err) + return agent +} + +func tearDownTest(t *testing.T, agent *Agent) { + require.NoError(t, agent.Close()) +} diff --git a/agent_pair_search_test.go b/agent_pair_search_test.go deleted file mode 100644 index 30b53b7..0000000 --- a/agent_pair_search_test.go +++ /dev/null @@ -1,39 +0,0 @@ -//go:build !js -// +build !js - -package ice - -import ( - "testing" - "time" - - "github.com/pion/transport/test" - "github.com/stretchr/testify/assert" -) - -func TestPairSearch(t *testing.T) { - report := test.CheckRoutines(t) - defer report() - - // Limit runtime in case of deadlocks - lim := test.TimeOut(time.Second * 10) - defer lim.Stop() - - var config AgentConfig - a, err := NewAgent(&config) - if err != nil { - t.Fatalf("Error constructing ice.Agent") - } - - if len(a.checklist) != 0 { - t.Fatalf("TestPairSearch is only a valid test if a.validPairs is empty on construction") - } - - cp := a.getBestAvailableCandidatePair() - - if cp != nil { - t.Fatalf("No Candidate pairs should exist") - } - - assert.NoError(t, a.Close()) -}