Skip to content

Commit

Permalink
fix: sorbet type for mark_read function signature (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalnarkhede authored Jul 19, 2023
1 parent 09eabb3 commit 7ea0f51
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
18 changes: 17 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,23 @@ $ bundle install --path vendor/bundle
### Run tests

```shell
$ STREAM_KEY=my_api_key STREAM_SECRET=my_api_secret bundle exec rake spec
$ STREAM_KEY=my_api_key STREAM_SECRET=my_api_secret bundle exec rspec spec
```

### Run specific test

Add :focus tag on target test:

```rb
it 'can mark messages as read', :focus do
# test something
end
```

And then run as following:

```shell
$ STREAM_KEY=myapi_key STREAM_SECRET=my_secret STREAM_CHAT_URL=http://127.0.0.1:3030 bundle exec rspec spec --tag focus
```

### Linters and type check
Expand Down
2 changes: 1 addition & 1 deletion lib/stream-chat/channel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def demote_moderators(user_ids)
end

# Sends the mark read event for this user, only works if the `read_events` setting is enabled.
sig { params(user_id: String, options: StringKeyHash).returns(StreamChat::StreamResponse) }
sig { params(user_id: String, options: T.untyped).returns(StreamChat::StreamResponse) }
def mark_read(user_id, **options)
payload = add_user_id(options, user_id)
@client.post("#{url}/read", data: payload)
Expand Down
2 changes: 1 addition & 1 deletion spec/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ def loop_times(times)

it 'offset with next should fail' do
expect do
@client.search({ members: { '$in' => ['legolas'] } }, SecureRandom.uuid, offset: 2, next: SecureRandom.uuid)
@client.search({ members: { '$in' => ['legolas'] } }, SecureRandom.uuid, offset: 2, next: SecureRandom.uuid)
end.to raise_error(/cannot use offset with next or sort parameters/)
end

Expand Down

0 comments on commit 7ea0f51

Please sign in to comment.