57 lines
1.2 KiB
Go
57 lines
1.2 KiB
Go
package service_test
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"gitea.dwysokinski.me/twhelp/core/internal/domain"
|
|
"gitea.dwysokinski.me/twhelp/core/internal/service"
|
|
"gitea.dwysokinski.me/twhelp/core/internal/service/internal/mock"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestTribeChange_Create(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
tests := []struct {
|
|
name string
|
|
lenParams int
|
|
expectedCallCount int
|
|
}{
|
|
{
|
|
name: "len(params)=499",
|
|
lenParams: 499,
|
|
expectedCallCount: 1,
|
|
},
|
|
{
|
|
name: "len(params)=998",
|
|
lenParams: 998,
|
|
expectedCallCount: 2,
|
|
},
|
|
{
|
|
name: "len(params)=1500",
|
|
lenParams: 1500,
|
|
expectedCallCount: 3,
|
|
},
|
|
{
|
|
name: "len(params)=10000",
|
|
lenParams: 10000,
|
|
expectedCallCount: 20,
|
|
},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
tt := tt
|
|
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
repo := &mock.FakeTribeChangeRepository{}
|
|
svc := service.NewTribeChange(repo)
|
|
|
|
assert.NoError(t, svc.Create(context.Background(), make([]domain.CreateTribeChangeParams, tt.lenParams)...))
|
|
assert.Equal(t, tt.expectedCallCount, repo.CreateCallCount())
|
|
})
|
|
}
|
|
}
|