This repository has been archived on 2024-04-06. You can view files and clone it, but cannot push or open issues or pull requests.
core-old/internal/service/tribe_change_test.go
Dawid Wysokiński b05089b940
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
feat: tribe changes (#122)
Reviewed-on: twhelp/core#122
2022-11-11 09:29:32 +00:00

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())
})
}
}