mirror of
https://github.com/luxfi/threshold.git
synced 2026-10-30 15:15:53 +00:00
simple_test.go → start_test.go TestSimpleKeygen → TestStartFuncBuildsSession TestDebugHandler → deleted TestSimpleKeygen verifies that keygen.Start returns a StartFunc that materializes a round.Session whose self-ID and party set round-trip. The new name says what it tests; the new filename pairs with what exists in the package (Start is the entry point). TestDebugHandler had zero assertions — it Printf'd round metadata to stdout. Per Zen of Hanzo: "If you write TODO, you've already failed. Either do the work or delete it." Same applies to assertionless "debug" tests masquerading as coverage.
35 lines
1.1 KiB
Go
35 lines
1.1 KiB
Go
package keygen_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/luxfi/threshold/pkg/math/curve"
|
|
"github.com/luxfi/threshold/pkg/party"
|
|
"github.com/luxfi/threshold/pkg/pool"
|
|
"github.com/luxfi/threshold/protocols/lss/keygen"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
// TestStartFuncBuildsSession verifies that keygen.Start returns a StartFunc
|
|
// that, when invoked with a session ID, materializes a round.Session whose
|
|
// self-ID and party set match the inputs. The full keygen round-trip is
|
|
// exercised by the protocol-level integration tests; this is the init
|
|
// smoke test.
|
|
func TestStartFuncBuildsSession(t *testing.T) {
|
|
group := curve.Secp256k1{}
|
|
selfID := party.ID("alice")
|
|
participants := []party.ID{"alice", "bob", "charlie"}
|
|
threshold := 2
|
|
pl := pool.NewPool(0)
|
|
defer pl.TearDown()
|
|
|
|
startFunc := keygen.Start(selfID, participants, threshold, group, pl)
|
|
|
|
session, err := startFunc([]byte("test-session"))
|
|
require.NoError(t, err)
|
|
require.NotNil(t, session)
|
|
|
|
require.Equal(t, selfID, session.SelfID())
|
|
require.Equal(t, party.IDSlice(participants), session.PartyIDs())
|
|
}
|