Skip to content

Commit

Permalink
updated(task_manager_api): fixing the task_contorller test
Browse files Browse the repository at this point in the history
  • Loading branch information
solo21-12 committed Aug 15, 2024
1 parent db90856 commit dedb712
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 0 additions & 1 deletion bootstrap/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ type Env struct {
}

func NewEnv() *Env {
// Initialize viper to read from environment variables
viper.AutomaticEnv()

env := Env{}
Expand Down
8 changes: 7 additions & 1 deletion tests/task_tests/controller_tests/task_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (suite *TaskControllerSuite) TestCreateTask_Success() {

suite.usecase.
EXPECT().
CreateTask(taskCreate, gomock.Any()).
CreateTask(gomock.Eq(taskCreate), gomock.Any()).
Return(taskDTO, nil).
Times(1)

Expand All @@ -81,6 +81,12 @@ func (suite *TaskControllerSuite) TestCreateTask_Success() {

// Check the response status
suite.Equal(http.StatusCreated, response.StatusCode)

// Optional: Check the response body if needed
var responseDTO domain.TaskDTO
err = json.NewDecoder(response.Body).Decode(&responseDTO)
suite.NoError(err)
suite.Equal(taskDTO, responseDTO)
}

func (suite *TaskControllerSuite) TestCreateTask_Failure() {
Expand Down

0 comments on commit dedb712

Please sign in to comment.