Skip to content

Commit

Permalink
Rename TestPairSearch and refactor it
Browse files Browse the repository at this point in the history
1. Extract test setup code so that it is visible what exactly is tested.
2. Removed check of checklist because that is tested by call to
    getBestAvailableCandidatePair.
3. Use require.* instead of assert.*
4. Removed check for leaked routines and timer. Because the test is
    super simple.
  • Loading branch information
ashellunts committed Feb 7, 2023
1 parent 0d1c333 commit c8cff3a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 39 deletions.
28 changes: 28 additions & 0 deletions agent_get_best_available_candidate_pair_test.go
Original file line number Diff line number Diff line change
@@ -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())
}
39 changes: 0 additions & 39 deletions agent_pair_search_test.go

This file was deleted.

0 comments on commit c8cff3a

Please sign in to comment.