mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 03:57:52 +00:00
Fix: Added the backend validation for name (#3878)
- Added the backend validation for name - Add message size constraint
This commit is contained in:
@@ -93,6 +93,18 @@ RSpec.describe 'Profile API', type: :request do
|
||||
expect(response).to have_http_status(:unprocessable_entity)
|
||||
end
|
||||
|
||||
it 'validate name' do
|
||||
user_name = 'test' * 999
|
||||
put '/api/v1/profile',
|
||||
params: { profile: { name: user_name } },
|
||||
headers: agent.create_new_auth_token,
|
||||
as: :json
|
||||
|
||||
expect(response).to have_http_status(:unprocessable_entity)
|
||||
json_response = JSON.parse(response.body)
|
||||
expect(json_response['message']).to eq('Name is too long (maximum is 255 characters)')
|
||||
end
|
||||
|
||||
it 'updates avatar' do
|
||||
# no avatar before upload
|
||||
expect(agent.avatar.attached?).to eq(false)
|
||||
|
||||
Reference in New Issue
Block a user