Skip to content

Commit

Permalink
Refactor database test functions for adding and deleting images from …
Browse files Browse the repository at this point in the history
…rooms
  • Loading branch information
waveyboym committed Sep 25, 2024
1 parent 0decbc5 commit ae87bbd
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions occupi-backend/tests/database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6843,7 +6843,7 @@ func TestUpdateNotificationSettings(t *testing.T) {
})
}

func TestAddImageIDToRoom(t *testing.T) {
func TestAddImageToRoom(t *testing.T) {
// Set Gin mode to match your configuration
gin.SetMode(configs.GetGinRunMode())

Expand All @@ -6856,7 +6856,7 @@ func TestAddImageIDToRoom(t *testing.T) {
DB: nil,
}

err := database.AddImageIDToRoom(ctx, appsession, "room1", "image1")
err := database.AddImageToRoom(ctx, appsession, "room1", "image1")
assert.EqualError(t, err, "database is nil")
})

Expand All @@ -6868,7 +6868,7 @@ func TestAddImageIDToRoom(t *testing.T) {
// Mock the UpdateOne operation as successful
mt.AddMockResponses(mtest.CreateSuccessResponse())

err := database.AddImageIDToRoom(ctx, appsession, "room1", "image1")
err := database.AddImageToRoom(ctx, appsession, "room1", "image1")
assert.NoError(t, err)
})

Expand All @@ -6883,12 +6883,12 @@ func TestAddImageIDToRoom(t *testing.T) {
Message: "update error",
}))

err := database.AddImageIDToRoom(ctx, appsession, "room1", "image1")
err := database.AddImageToRoom(ctx, appsession, "room1", "image1")
assert.EqualError(t, err, "update error")
})
}

func TestDeleteImageIDFromRoom(t *testing.T) {
func TestDeleteImageFromRoom(t *testing.T) {
// Set Gin mode to match your configuration
gin.SetMode(configs.GetGinRunMode())

Expand All @@ -6901,7 +6901,7 @@ func TestDeleteImageIDFromRoom(t *testing.T) {
DB: nil,
}

err := database.DeleteImageIDFromRoom(ctx, appsession, "room1", "image1")
err := database.DeleteImageFromRoom(ctx, appsession, "room1", "image1")
assert.EqualError(t, err, "database is nil")
})

Expand All @@ -6913,7 +6913,7 @@ func TestDeleteImageIDFromRoom(t *testing.T) {
// Mock the UpdateOne operation as successful
mt.AddMockResponses(mtest.CreateSuccessResponse())

err := database.DeleteImageIDFromRoom(ctx, appsession, "room1", "image1")
err := database.DeleteImageFromRoom(ctx, appsession, "room1", "image1")
assert.NoError(t, err)
})

Expand All @@ -6928,7 +6928,7 @@ func TestDeleteImageIDFromRoom(t *testing.T) {
Message: "delete error",
}))

err := database.DeleteImageIDFromRoom(ctx, appsession, "room1", "image1")
err := database.DeleteImageFromRoom(ctx, appsession, "room1", "image1")
assert.EqualError(t, err, "delete error")
})
}
Expand Down

0 comments on commit ae87bbd

Please sign in to comment.