chore: Update deleteCustomAttribute method in SDK (#3334)

This commit is contained in:
Muhsin Keloth 2021-11-15 14:56:35 +05:30 committed by GitHub
parent c2db8a1fd7
commit a2764e5c1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 138 additions and 30 deletions

View file

@ -87,4 +87,25 @@ RSpec.describe '/api/v1/widget/contacts', type: :request do
end
end
end
describe 'POST /api/v1/widget/destroy_custom_attributes' do
let(:params) { { website_token: web_widget.website_token, identifier: 'test', custom_attributes: ['test'] } }
context 'with invalid website token' do
it 'returns unauthorized' do
post '/api/v1/widget/destroy_custom_attributes', params: { website_token: '' }
expect(response).to have_http_status(:not_found)
end
end
context 'with correct website token' do
it 'calls destroy custom attributes' do
post '/api/v1/widget/destroy_custom_attributes',
params: params,
headers: { 'X-Auth-Token' => token },
as: :json
expect(contact.reload.custom_attributes).to eq({})
end
end
end
end