feat(conversations): align destroy job
This commit is contained in:
@@ -144,6 +144,7 @@ func (s *ConversationHandlerTestSuite) SetupSuite() {
|
||||
conversations.GET("/:conversation_id/reporting_events", handler.ReportingEvents)
|
||||
conversations.POST("/:conversation_id/toggle_typing", handler.ToggleTyping)
|
||||
conversations.POST("/:conversation_id/update_last_seen", handler.UpdateLastSeen)
|
||||
conversations.DELETE("/:conversation_id", handler.Delete)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -448,6 +449,26 @@ func (s *ConversationHandlerTestSuite) TestTranscript_ConversationNotFound() {
|
||||
assert.Equal(s.T(), http.StatusNotFound, w.Code)
|
||||
}
|
||||
|
||||
func (s *ConversationHandlerTestSuite) TestDelete_SuccessReturnsChatwootHeadOK() {
|
||||
w := httptest.NewRecorder()
|
||||
req, _ := http.NewRequest(http.MethodDelete, s.accountURL()+"/conversations/"+strconv.FormatUint(uint64(s.testConv.ID), 10), nil)
|
||||
s.router.ServeHTTP(w, req)
|
||||
|
||||
assert.Equal(s.T(), http.StatusOK, w.Code)
|
||||
assert.Empty(s.T(), w.Body.String())
|
||||
|
||||
var deleted model.Conversation
|
||||
assert.Error(s.T(), s.db.First(&deleted, s.testConv.ID).Error)
|
||||
}
|
||||
|
||||
func (s *ConversationHandlerTestSuite) TestDelete_ConversationNotFound() {
|
||||
w := httptest.NewRecorder()
|
||||
req, _ := http.NewRequest(http.MethodDelete, s.accountURL()+"/conversations/9999", nil)
|
||||
s.router.ServeHTTP(w, req)
|
||||
|
||||
assert.Equal(s.T(), http.StatusNotFound, w.Code)
|
||||
}
|
||||
|
||||
// ========== UpdateCustomAttributes Handler Tests ==========
|
||||
|
||||
func (s *ConversationHandlerTestSuite) TestUpdateCustomAttributes_Success() {
|
||||
|
||||
Reference in New Issue
Block a user