mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-23 06:35:07 +01:00
29 lines
551 B
Go
29 lines
551 B
Go
|
package chainio
|
||
|
|
||
|
import (
|
||
|
"errors"
|
||
|
"testing"
|
||
|
|
||
|
"github.com/lightningnetwork/lnd/chainntnfs"
|
||
|
"github.com/stretchr/testify/require"
|
||
|
)
|
||
|
|
||
|
var errDummy = errors.New("dummy error")
|
||
|
|
||
|
// TestNewBeat tests the NewBeat and Height functions.
|
||
|
func TestNewBeat(t *testing.T) {
|
||
|
t.Parallel()
|
||
|
|
||
|
// Create a testing epoch.
|
||
|
epoch := chainntnfs.BlockEpoch{
|
||
|
Height: 1,
|
||
|
}
|
||
|
|
||
|
// Create the beat and check the internal state.
|
||
|
beat := NewBeat(epoch)
|
||
|
require.Equal(t, epoch, beat.epoch)
|
||
|
|
||
|
// Check the height function.
|
||
|
require.Equal(t, epoch.Height, beat.Height())
|
||
|
}
|