Skip to content

Commit

Permalink
Remove Lorem from integration test (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
AssassinRobot authored Aug 5, 2024
1 parent a0401a9 commit eedb3dc
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 24 deletions.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ go 1.22.4
require (
connectrpc.com/connect v1.16.2
connectrpc.com/cors v0.1.0
github.com/bozaro/golorem v0.0.0-20170501165920-50e5b610280b
github.com/go-playground/validator/v10 v10.22.0
github.com/knadh/koanf v1.5.0
github.com/minio/minio-go/v7 v7.0.69
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/bozaro/golorem v0.0.0-20170501165920-50e5b610280b h1:D3YtkBLwtjFPegR4lwiwoCiV+f7bOq/MDh6Xi+nEq3Q=
github.com/bozaro/golorem v0.0.0-20170501165920-50e5b610280b/go.mod h1:gqvWc1EBvN2S3BBwczsP6n4MFQzpHRffNXxK2pebPPA=
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
Expand Down
15 changes: 6 additions & 9 deletions tests/integration/repository/chat_repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"testing"

lorem "github.com/bozaro/golorem"
repository_mongo "github.com/kavkaco/Kavka-Core/database/repo_mongo"
"github.com/kavkaco/Kavka-Core/internal/model"
"github.com/kavkaco/Kavka-Core/internal/repository"
Expand All @@ -20,7 +19,6 @@ type ChatTestSuite struct {
suite.Suite
userRepo repository.UserRepository
repo repository.ChatRepository
lem *lorem.Lorem

userID model.UserID
createdChannelChatID model.ChatID
Expand All @@ -30,7 +28,6 @@ type ChatTestSuite struct {
}

func (s *ChatTestSuite) SetupSuite() {
s.lem = lorem.New()
s.repo = repository_mongo.NewChatMongoRepository(db)
s.userRepo = repository_mongo.NewUserMongoRepository(db)

Expand All @@ -42,12 +39,12 @@ func (s *ChatTestSuite) TestCreateChannel() {
ctx := context.TODO()

chatDetail := model.ChannelChatDetail{
Title: s.lem.Word(3, 6),
Username: s.lem.LastName(),
Title: "Test Channel",
Username: "TestChannelUsername",
Members: []model.UserID{s.userID},
Admins: []model.UserID{s.userID},
Owner: s.userID,
Description: s.lem.Paragraph(1, 4),
Description: "Test Channel Description",
}
chatModel := model.NewChat(model.TypeChannel, chatDetail)

Expand All @@ -72,12 +69,12 @@ func (s *ChatTestSuite) TestCreateGroup() {
ctx := context.TODO()

chatDetail := model.GroupChatDetail{
Title: s.lem.Word(3, 6),
Username: s.lem.LastName(),
Title: "Test Group",
Username: "TestGroupUsername",
Members: []model.UserID{s.userID},
Admins: []model.UserID{s.userID},
Owner: s.userID,
Description: s.lem.Paragraph(1, 4),
Description: "Test Group Description",
}
chatModel := model.NewChat(model.TypeGroup, chatDetail)

Expand Down
13 changes: 5 additions & 8 deletions tests/integration/repository/message_repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"testing"

lorem "github.com/bozaro/golorem"
repository_mongo "github.com/kavkaco/Kavka-Core/database/repo_mongo"
"github.com/kavkaco/Kavka-Core/internal/model"
"github.com/kavkaco/Kavka-Core/internal/repository"
Expand All @@ -18,7 +17,6 @@ import (
type MessageTestSuite struct {
suite.Suite
repo repository.MessageRepository
lem *lorem.Lorem

chatID model.ChatID
senderID model.UserID
Expand All @@ -29,14 +27,13 @@ func (s *MessageTestSuite) SetupSuite() {
ctx := context.TODO()
chatRepo := repository_mongo.NewChatMongoRepository(db)
s.repo = repository_mongo.NewMessageMongoRepository(db)
s.lem = lorem.New()
s.senderID = fmt.Sprintf("%d", random.GenerateUserID())

// Create a sample chat
chatModel := model.NewChat(model.TypeChannel, model.ChannelChatDetail{
Title: s.lem.Word(1, 10),
Username: s.lem.LastName(),
Description: s.lem.Paragraph(1, 2),
Title: "Chat 1",
Username: "Username_1",
Description: "Test Chat 1",
Owner: s.senderID,
Members: []model.UserID{s.senderID},
Admins: []model.UserID{s.senderID},
Expand All @@ -54,7 +51,7 @@ func (s *MessageTestSuite) SetupSuite() {
func (s *MessageTestSuite) TestA_InsertTextMessage() {
ctx := context.TODO()

messageContentModel := model.TextMessage{Data: s.lem.Sentence(1, 3)}
messageContentModel := model.TextMessage{Data: "Test message"}
messageModel := model.NewMessage(model.TypeTextMessage, messageContentModel, s.senderID)
saved, err := s.repo.Insert(ctx, s.chatID, messageModel)
require.NoError(s.T(), err)
Expand Down Expand Up @@ -89,7 +86,7 @@ func (s *MessageTestSuite) TestC_FindMessage() {
func (s *MessageTestSuite) TestD_UpdateTextMessage() {
ctx := context.TODO()

newMessageContent := s.lem.Sentence(1, 2)
newMessageContent := "Test message updated"
err := s.repo.UpdateMessageContent(ctx, s.chatID, s.savedMessageID, newMessageContent)
require.NoError(s.T(), err)

Expand Down
4 changes: 0 additions & 4 deletions tests/integration/service/auth_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"testing"

lorem "github.com/bozaro/golorem"
repository_mongo "github.com/kavkaco/Kavka-Core/database/repo_mongo"
"github.com/kavkaco/Kavka-Core/internal/model"
service "github.com/kavkaco/Kavka-Core/internal/service/auth"
Expand All @@ -18,7 +17,6 @@ import (
type AuthTestSuite struct {
suite.Suite
service service.AuthService
lem *lorem.Lorem

userID model.UserID
verifyEmailToken string
Expand All @@ -31,8 +29,6 @@ type AuthTestSuite struct {
}

func (s *AuthTestSuite) SetupSuite() {
s.lem = lorem.New()

authRepo := repository_mongo.NewAuthMongoRepository(db)
userRepo := repository_mongo.NewUserMongoRepository(db)
authManager := auth_manager.NewAuthManager(redisClient, auth_manager.AuthManagerOpts{
Expand Down

0 comments on commit eedb3dc

Please sign in to comment.