diff --git a/.github/workflows/auto_mockgen.yml b/.github/workflows/auto_mockgen.yml index fdbadc4..ec92f74 100644 --- a/.github/workflows/auto_mockgen.yml +++ b/.github/workflows/auto_mockgen.yml @@ -28,11 +28,20 @@ jobs: go install go.uber.org/mock/mockgen@latest go install github.com/sanposhiho/gomockhandler@latest + - name: Install gotests + run: | + go install github.com/cweill/gotests/gotests@latest - name: Generate mocks run: | cd app go generate ./... + - name: Go lint + run: | + cd app + go fmt ./... + go mod tidy + - name: Configure Git run: | git config user.name "GitHub Actions" diff --git a/app/application/middleware/auth.go b/app/application/middleware/auth.go index fe269f7..ffb0617 100644 --- a/app/application/middleware/auth.go +++ b/app/application/middleware/auth.go @@ -10,6 +10,7 @@ import ( "net/http" ) +//go:generate gotests -w -all $GOFILE type Middleware struct { UserService service.UserServiceInterface } diff --git a/app/application/middleware/auth_test.go b/app/application/middleware/auth_test.go new file mode 100644 index 0000000..d1267c6 --- /dev/null +++ b/app/application/middleware/auth_test.go @@ -0,0 +1,98 @@ +package middleware + +import ( + "reflect" + "testing" + + "example.com/application/service" + "github.com/uptrace/bunrouter" +) + +func TestNewMiddleware(t *testing.T) { + type args struct { + userService service.UserServiceInterface + } + tests := []struct { + name string + args args + want *Middleware + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := NewMiddleware(tt.args.userService); !reflect.DeepEqual(got, tt.want) { + t.Errorf("NewMiddleware() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestMiddleware_AuthenticateMiddleware(t *testing.T) { + type fields struct { + UserService service.UserServiceInterface + } + tests := []struct { + name string + fields fields + want func(bunrouter.HandlerFunc) bunrouter.HandlerFunc + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + m := &Middleware{ + UserService: tt.fields.UserService, + } + if got := m.AuthenticateMiddleware(); !reflect.DeepEqual(got, tt.want) { + t.Errorf("Middleware.AuthenticateMiddleware() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestMiddleware_CorsMiddleware(t *testing.T) { + type fields struct { + UserService service.UserServiceInterface + } + tests := []struct { + name string + fields fields + want func(bunrouter.HandlerFunc) bunrouter.HandlerFunc + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + m := &Middleware{ + UserService: tt.fields.UserService, + } + if got := m.CorsMiddleware(); !reflect.DeepEqual(got, tt.want) { + t.Errorf("Middleware.CorsMiddleware() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestMiddleware_RecoverMiddleware(t *testing.T) { + type fields struct { + UserService service.UserServiceInterface + } + tests := []struct { + name string + fields fields + want func(bunrouter.HandlerFunc) bunrouter.HandlerFunc + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + m := &Middleware{ + UserService: tt.fields.UserService, + } + if got := m.RecoverMiddleware(); !reflect.DeepEqual(got, tt.want) { + t.Errorf("Middleware.RecoverMiddleware() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/app/application/service/user_service.go b/app/application/service/user_service.go index 4e03811..d26dc20 100644 --- a/app/application/service/user_service.go +++ b/app/application/service/user_service.go @@ -8,6 +8,7 @@ import ( "log" ) +//go:generate gotests -w -all $GOFILE type UserService struct { UserRepository repository.UserRepository } diff --git a/app/application/service/user_service_test.go b/app/application/service/user_service_test.go new file mode 100644 index 0000000..565db41 --- /dev/null +++ b/app/application/service/user_service_test.go @@ -0,0 +1,227 @@ +package service + +import ( + "context" + "reflect" + "testing" + + "example.com/domain" + "example.com/domain/repository" +) + +func TestNewUserService(t *testing.T) { + type args struct { + UserRepository repository.UserRepository + } + tests := []struct { + name string + args args + want *UserService + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := NewUserService(tt.args.UserRepository); !reflect.DeepEqual(got, tt.want) { + t.Errorf("NewUserService() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestUserService_Add(t *testing.T) { + type fields struct { + UserRepository repository.UserRepository + } + type args struct { + ctx context.Context + name string + } + tests := []struct { + name string + fields fields + args args + want string + wantErr bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + u := &UserService{ + UserRepository: tt.fields.UserRepository, + } + got, err := u.Add(tt.args.ctx, tt.args.name) + if (err != nil) != tt.wantErr { + t.Errorf("UserService.Add() error = %v, wantErr %v", err, tt.wantErr) + return + } + if got != tt.want { + t.Errorf("UserService.Add() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestUserService_UpdateUser(t *testing.T) { + type fields struct { + UserRepository repository.UserRepository + } + type args struct { + ctx context.Context + user domain.User + } + tests := []struct { + name string + fields fields + args args + wantErr bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + u := &UserService{ + UserRepository: tt.fields.UserRepository, + } + if err := u.UpdateUser(tt.args.ctx, tt.args.user); (err != nil) != tt.wantErr { + t.Errorf("UserService.UpdateUser() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} + +func TestUserService_Delete(t *testing.T) { + type fields struct { + UserRepository repository.UserRepository + } + type args struct { + ctx context.Context + id string + } + tests := []struct { + name string + fields fields + args args + want string + wantErr bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + u := &UserService{ + UserRepository: tt.fields.UserRepository, + } + got, err := u.Delete(tt.args.ctx, tt.args.id) + if (err != nil) != tt.wantErr { + t.Errorf("UserService.Delete() error = %v, wantErr %v", err, tt.wantErr) + return + } + if got != tt.want { + t.Errorf("UserService.Delete() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestUserService_GetUserByUserId(t *testing.T) { + type fields struct { + UserRepository repository.UserRepository + } + type args struct { + ctx context.Context + id string + } + tests := []struct { + name string + fields fields + args args + want domain.User + wantErr bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + u := &UserService{ + UserRepository: tt.fields.UserRepository, + } + got, err := u.GetUserByUserId(tt.args.ctx, tt.args.id) + if (err != nil) != tt.wantErr { + t.Errorf("UserService.GetUserByUserId() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("UserService.GetUserByUserId() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestUserService_GetUserByAuthToken(t *testing.T) { + type fields struct { + UserRepository repository.UserRepository + } + type args struct { + ctx context.Context + authToken string + } + tests := []struct { + name string + fields fields + args args + want *domain.User + wantErr bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + u := &UserService{ + UserRepository: tt.fields.UserRepository, + } + got, err := u.GetUserByAuthToken(tt.args.ctx, tt.args.authToken) + if (err != nil) != tt.wantErr { + t.Errorf("UserService.GetUserByAuthToken() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("UserService.GetUserByAuthToken() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestUserService_GetUserRanking(t *testing.T) { + type fields struct { + UserRepository repository.UserRepository + } + type args struct { + ctx context.Context + } + tests := []struct { + name string + fields fields + args args + want []*domain.UserRanking + wantErr bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + u := &UserService{ + UserRepository: tt.fields.UserRepository, + } + got, err := u.GetUserRanking(tt.args.ctx) + if (err != nil) != tt.wantErr { + t.Errorf("UserService.GetUserRanking() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("UserService.GetUserRanking() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/app/go.mod b/app/go.mod index bb7feac..69912ef 100644 --- a/app/go.mod +++ b/app/go.mod @@ -4,11 +4,11 @@ go 1.21.1 require ( github.com/go-sql-driver/mysql v1.7.1 - github.com/golang/mock v1.6.0 github.com/google/uuid v1.3.1 github.com/uptrace/bun v1.1.16 github.com/uptrace/bun/dialect/mysqldialect v1.1.16 github.com/uptrace/bunrouter v1.0.20 + go.uber.org/mock v0.3.0 ) require ( diff --git a/app/go.sum b/app/go.sum index c45abc2..4a7017b 100644 --- a/app/go.sum +++ b/app/go.sum @@ -3,8 +3,6 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI= github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= @@ -27,33 +25,12 @@ github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9 github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +go.uber.org/mock v0.3.0 h1:3mUxI1No2/60yUYax92Pt8eNOEecx2D3lcXZh2NEZJo= +go.uber.org/mock v0.3.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/app/infrastructure/persistence/user_repository.go b/app/infrastructure/persistence/user_repository.go index 603ba14..7b1417b 100644 --- a/app/infrastructure/persistence/user_repository.go +++ b/app/infrastructure/persistence/user_repository.go @@ -7,6 +7,7 @@ import ( "log" ) +//go:generate gotests -w -all $GOFILE type UserRepository struct { Conn *bun.DB } diff --git a/app/infrastructure/persistence/user_repository_test.go b/app/infrastructure/persistence/user_repository_test.go new file mode 100644 index 0000000..62c6300 --- /dev/null +++ b/app/infrastructure/persistence/user_repository_test.go @@ -0,0 +1,217 @@ +package infrastructure + +import ( + "context" + "reflect" + "testing" + + "example.com/domain" + "github.com/uptrace/bun" +) + +func TestNewUserRepository(t *testing.T) { + type args struct { + Conn *bun.DB + } + tests := []struct { + name string + args args + want *UserRepository + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := NewUserRepository(tt.args.Conn); !reflect.DeepEqual(got, tt.want) { + t.Errorf("NewUserRepository() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestUserRepository_AddUser(t *testing.T) { + type fields struct { + Conn *bun.DB + } + type args struct { + ctx context.Context + id string + authToken string + name string + } + tests := []struct { + name string + fields fields + args args + wantErr bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + u := &UserRepository{ + Conn: tt.fields.Conn, + } + if err := u.AddUser(tt.args.ctx, tt.args.id, tt.args.authToken, tt.args.name); (err != nil) != tt.wantErr { + t.Errorf("UserRepository.AddUser() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} + +func TestUserRepository_UpdateUser(t *testing.T) { + type fields struct { + Conn *bun.DB + } + type args struct { + ctx context.Context + user domain.User + } + tests := []struct { + name string + fields fields + args args + wantErr bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + u := &UserRepository{ + Conn: tt.fields.Conn, + } + if err := u.UpdateUser(tt.args.ctx, tt.args.user); (err != nil) != tt.wantErr { + t.Errorf("UserRepository.UpdateUser() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} + +func TestUserRepository_DeleteUser(t *testing.T) { + type fields struct { + Conn *bun.DB + } + type args struct { + ctx context.Context + id string + } + tests := []struct { + name string + fields fields + args args + wantErr bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + u := &UserRepository{ + Conn: tt.fields.Conn, + } + if err := u.DeleteUser(tt.args.ctx, tt.args.id); (err != nil) != tt.wantErr { + t.Errorf("UserRepository.DeleteUser() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} + +func TestUserRepository_GetUserByUserId(t *testing.T) { + type fields struct { + Conn *bun.DB + } + type args struct { + ctx context.Context + id string + } + tests := []struct { + name string + fields fields + args args + want domain.User + wantErr bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + u := &UserRepository{ + Conn: tt.fields.Conn, + } + got, err := u.GetUserByUserId(tt.args.ctx, tt.args.id) + if (err != nil) != tt.wantErr { + t.Errorf("UserRepository.GetUserByUserId() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("UserRepository.GetUserByUserId() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestUserRepository_GetUserByAuthToken(t *testing.T) { + type fields struct { + Conn *bun.DB + } + type args struct { + ctx context.Context + authToken string + } + tests := []struct { + name string + fields fields + args args + want *domain.User + wantErr bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + u := &UserRepository{ + Conn: tt.fields.Conn, + } + got, err := u.GetUserByAuthToken(tt.args.ctx, tt.args.authToken) + if (err != nil) != tt.wantErr { + t.Errorf("UserRepository.GetUserByAuthToken() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("UserRepository.GetUserByAuthToken() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestUserRepository_GetUserRanking(t *testing.T) { + type fields struct { + Conn *bun.DB + } + type args struct { + ctx context.Context + } + tests := []struct { + name string + fields fields + args args + want []*domain.UserRanking + wantErr bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + u := &UserRepository{ + Conn: tt.fields.Conn, + } + got, err := u.GetUserRanking(tt.args.ctx) + if (err != nil) != tt.wantErr { + t.Errorf("UserRepository.GetUserRanking() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("UserRepository.GetUserRanking() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/app/interface/handler/handler.go b/app/interface/handler/handler.go index 2c64358..6ab9031 100644 --- a/app/interface/handler/handler.go +++ b/app/interface/handler/handler.go @@ -12,6 +12,7 @@ import ( "strconv" ) +//go:generate gotests -w -all $GOFILE type UserHandler struct { userService service.UserServiceInterface } diff --git a/app/interface/handler/handler_test.go b/app/interface/handler/handler_test.go new file mode 100644 index 0000000..ad30104 --- /dev/null +++ b/app/interface/handler/handler_test.go @@ -0,0 +1,144 @@ +package _interface + +import ( + "reflect" + "testing" + + "example.com/application/service" + "github.com/uptrace/bunrouter" +) + +func TestNewUserHandler(t *testing.T) { + type args struct { + userService service.UserServiceInterface + } + tests := []struct { + name string + args args + want *UserHandler + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := NewUserHandler(tt.args.userService); !reflect.DeepEqual(got, tt.want) { + t.Errorf("NewUserHandler() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestUserHandler_UserCreateHandle(t *testing.T) { + type fields struct { + userService service.UserServiceInterface + } + tests := []struct { + name string + fields fields + want bunrouter.HandlerFunc + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + u := &UserHandler{ + userService: tt.fields.userService, + } + if got := u.UserCreateHandle(); !reflect.DeepEqual(got, tt.want) { + t.Errorf("UserHandler.UserCreateHandle() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestUserHandler_UserGetHandle(t *testing.T) { + type fields struct { + userService service.UserServiceInterface + } + tests := []struct { + name string + fields fields + want bunrouter.HandlerFunc + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + u := &UserHandler{ + userService: tt.fields.userService, + } + if got := u.UserGetHandle(); !reflect.DeepEqual(got, tt.want) { + t.Errorf("UserHandler.UserGetHandle() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestUserHandler_ScoreUpdateHandle(t *testing.T) { + type fields struct { + userService service.UserServiceInterface + } + tests := []struct { + name string + fields fields + want bunrouter.HandlerFunc + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + u := &UserHandler{ + userService: tt.fields.userService, + } + if got := u.ScoreUpdateHandle(); !reflect.DeepEqual(got, tt.want) { + t.Errorf("UserHandler.ScoreUpdateHandle() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestUserHandler_UserRankingGetHandle(t *testing.T) { + type fields struct { + userService service.UserServiceInterface + } + tests := []struct { + name string + fields fields + want bunrouter.HandlerFunc + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + u := &UserHandler{ + userService: tt.fields.userService, + } + if got := u.UserRankingGetHandle(); !reflect.DeepEqual(got, tt.want) { + t.Errorf("UserHandler.UserRankingGetHandle() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestUserHandler_DestroyHandle(t *testing.T) { + type fields struct { + userService service.UserServiceInterface + } + tests := []struct { + name string + fields fields + want bunrouter.HandlerFunc + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + u := &UserHandler{ + userService: tt.fields.userService, + } + if got := u.DestroyHandle(); !reflect.DeepEqual(got, tt.want) { + t.Errorf("UserHandler.DestroyHandle() = %v, want %v", got, tt.want) + } + }) + } +}