mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-03 16:37:39 +00:00
33 lines
610 B
Go
33 lines
610 B
Go
|
package db
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
|
||
|
"github.com/prysmaticlabs/prysm/shared/hashutil"
|
||
|
)
|
||
|
|
||
|
func TestBeaconDB_HasExit(t *testing.T) {
|
||
|
db := setupDB(t)
|
||
|
defer teardownDB(t, db)
|
||
|
|
||
|
d := &pb.Exit{
|
||
|
Slot: 100,
|
||
|
}
|
||
|
hash, err := hashutil.HashProto(d)
|
||
|
if err != nil {
|
||
|
t.Fatalf("could not hash exit request: %v", err)
|
||
|
}
|
||
|
|
||
|
if db.HasExit(hash) {
|
||
|
t.Fatal("Expected HasExit to return false")
|
||
|
}
|
||
|
|
||
|
if err := db.SaveExit(d); err != nil {
|
||
|
t.Fatalf("Failed to save exit request: %v", err)
|
||
|
}
|
||
|
if !db.HasExit(hash) {
|
||
|
t.Fatal("Expected HasExit to return true")
|
||
|
}
|
||
|
}
|