core/internal/domain/domaintest/ennoblement.go
Dawid Wysokiński 32859aae9f
All checks were successful
ci/woodpecker/push/govulncheck Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
chore: bump deps (#12)
Reviewed-on: twhelp/corev3#12
2024-03-01 07:15:06 +00:00

45 lines
741 B
Go

package domaintest
import (
"time"
"gitea.dwysokinski.me/twhelp/corev3/internal/domain"
"github.com/brianvoe/gofakeit/v7"
"github.com/stretchr/testify/require"
)
type EnnoblementConfig struct {
ID int
ServerKey string
VillageID int
}
func NewEnnoblement(tb TestingTB, opts ...func(cfg *EnnoblementConfig)) domain.Ennoblement {
tb.Helper()
cfg := &EnnoblementConfig{
ID: RandID(),
ServerKey: RandServerKey(),
VillageID: RandID(),
}
for _, opt := range opts {
opt(cfg)
}
e, err := domain.UnmarshalEnnoblementFromDatabase(
cfg.ID,
cfg.ServerKey,
cfg.VillageID,
RandID(),
RandID(),
RandID(),
RandID(),
gofakeit.IntRange(1, 10000),
time.Now(),
)
require.NoError(tb, err)
return e
}