add more tests

This commit is contained in:
41666 2024-10-28 19:53:57 -07:00
parent 74add408e6
commit 4a528fe85a
9 changed files with 266 additions and 55 deletions

View file

@ -9,8 +9,13 @@ import (
"github.com/genudine/saerro-go/types"
)
type IIngest interface {
TrackPop(context.Context, types.PopEvent)
}
type Ingest struct {
PlayerStore store.IPlayerStore
PlayerStore store.IPlayerStore
VehicleStore store.IVehicleStore
}
func (i *Ingest) TrackPop(ctx context.Context, event types.PopEvent) {

View file

@ -12,23 +12,25 @@ import (
"github.com/genudine/saerro-go/types"
)
func mkIngest(t *testing.T) (context.Context, *ingest.Ingest, *storemock.MockPlayerStore) {
func mkIngest(t *testing.T) (context.Context, *ingest.Ingest, *storemock.MockPlayerStore, *storemock.MockVehicleStore) {
t.Helper()
ps := new(storemock.MockPlayerStore)
vs := new(storemock.MockVehicleStore)
ctx, cancel := context.WithTimeout(context.Background(), time.Second*15)
t.Cleanup(cancel)
i := &ingest.Ingest{
PlayerStore: ps,
PlayerStore: ps,
VehicleStore: vs,
}
return ctx, i, ps
return ctx, i, ps, vs
}
func TestTrackPopHappyPath(t *testing.T) {
ctx, i, ps := mkIngest(t)
ctx, i, ps, _ := mkIngest(t)
// Combat Medic on Emerald
event := types.PopEvent{
@ -48,7 +50,7 @@ func TestTrackPopHappyPath(t *testing.T) {
}
func TestTrackPopFixup(t *testing.T) {
ctx, i, ps := mkIngest(t)
ctx, i, ps, _ := mkIngest(t)
event := types.PopEvent{
WorldID: 17,
@ -68,7 +70,7 @@ func TestTrackPopFixup(t *testing.T) {
}
func TestTrackPopFixupFailed(t *testing.T) {
ctx, i, ps := mkIngest(t)
ctx, i, ps, _ := mkIngest(t)
event := types.PopEvent{
WorldID: 17,