Skip to content

Commit

Permalink
feat: added test for partially updating a channel member
Browse files Browse the repository at this point in the history
  • Loading branch information
totalimmersion committed Dec 9, 2024
1 parent 0c95342 commit 0ccc43e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions spec/channel_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -338,4 +338,17 @@ def loop_times(times)
expect(response['channels'].length).to eq 1
expect(response['channels'][0]['channel']['cid']).to eq @channel.cid
end

it 'can update channel member partially' do
@channel.add_members([@random_users[0][:id]])

# Test setting a field
response = @channel.update_member_partial(@random_users[0][:id], { 'hat' => 'blue' })
expect(response['channel_member']['hat']).to eq 'blue'

# Test setting and unsetting fields
response = @channel.update_member_partial(@random_users[0][:id], { 'color' => 'red' }, ['hat'])
expect(response['channel_member']['color']).to eq 'red'
expect(response['channel_member']).not_to have_key('hat')
end
end

0 comments on commit 0ccc43e

Please sign in to comment.