-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Bastien Rigaud
committed
Feb 18, 2024
1 parent
3016352
commit a9dcb09
Showing
15 changed files
with
204 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...nal/service/datastore/planetscale/init.go → src/internal/datastore/planetscale/init.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,60 @@ | ||
package handlers_grpc_user_v1 | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
"time" | ||
|
||
user_store_svc_v1_entities "github.com/Golerplate/contracts/clients/user-store-svc/v1/entities" | ||
user_store_svc_v1_mocks "github.com/Golerplate/contracts/clients/user-store-svc/v1/mocks" | ||
"github.com/Golerplate/pkg/constants" | ||
"github.com/stretchr/testify/assert" | ||
"go.uber.org/mock/gomock" | ||
|
||
entities_user_v1 "github.com/Golerplate/user-store-svc/internal/entities/user/v1" | ||
service_v1 "github.com/Golerplate/user-store-svc/internal/service/v1" | ||
) | ||
|
||
func Test_CreateUser(t *testing.T) { | ||
t.Run("ok - username", func(t *testing.T) { | ||
ctrl := gomock.NewController(t) | ||
m := user_store_svc_v1_mocks.NewMockUserStoreSvc(ctrl) | ||
|
||
userid := constants.GenerateDataPrefixWithULID(constants.User) | ||
created := time.Now() | ||
|
||
m.EXPECT().CreateUser(gomock.Any(), &entities_user_v1.CreateUserRequest{ | ||
Username: "testuser", | ||
Email: "[email protected]", | ||
Password: "123", | ||
}).Return(&user_store_svc_v1_entities.User{ | ||
ID: userid, | ||
Username: "testuser", | ||
Email: "[email protected]", | ||
IsAdmin: false, | ||
IsBanned: false, | ||
CreatedAt: created, | ||
UpdatedAt: created, | ||
}, nil) | ||
|
||
s, err := service_v1.NewUserStoreService(context.Background(), m) | ||
assert.NotNil(t, s) | ||
assert.NoError(t, err) | ||
|
||
user, err := s.CreateUser(context.Background(), &entities_user_v1.CreateUserRequest{ | ||
Username: "testuser", | ||
Email: "[email protected]", | ||
Password: "123", | ||
}) | ||
assert.NotNil(t, user) | ||
assert.NoError(t, err) | ||
|
||
assert.EqualValues(t, &entities_user_v1.User{ | ||
ID: userid, | ||
Username: "testuser", | ||
Email: "[email protected]", | ||
CreatedAt: created, | ||
UpdatedAt: created, | ||
}, user) | ||
}) | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package service_v1 | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/Golerplate/user-store-svc/internal/datastore" | ||
) | ||
|
||
type service struct { | ||
store datastore.UserStoreServiceDatastore | ||
} | ||
|
||
func NewUserStoreService(ctx context.Context, store datastore.UserStoreServiceDatastore) (*service, error) { | ||
return &service{ | ||
store: store, | ||
}, nil | ||
} |
2 changes: 1 addition & 1 deletion
2
src/internal/service/interface.go → src/internal/service/v1/interface.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package service | ||
package service_v1 | ||
|
||
import ( | ||
"context" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package service | ||
package service_v1 | ||
|
||
import ( | ||
"context" | ||
|