Fix #1283 - Add conversations (slack connect) and admin.auth.policy API methods#1284
Conversation
srajiang
left a comment
There was a problem hiding this comment.
Thanks in advance for taking a look!
| } | ||
| cursorPaginationEnabledMethods.add('conversations.list'); | ||
| export interface ConversationsListConnectInvitesArguments extends WebAPICallOptions, TokenOverridable { | ||
| count?: number; |
There was a problem hiding this comment.
This method accepts a count and a cursor option, and so it doesn't to conform to CursorPaginationEnabled or TraditionalPagingEnabled interface.
There was a problem hiding this comment.
Oh... the 3rd pattern came here.
| @@ -0,0 +1,9 @@ | |||
| /* tslint:disable */ | |||
There was a problem hiding this comment.
Generated by generate-web-api-types.sh
| attachments?: MatchAttachment[]; | ||
| is_mpim?: boolean; | ||
| score?: number; | ||
| files?: File[]; |
There was a problem hiding this comment.
Changes here aren't relevant to PR, but auto-generated by generate-web-api-types.sh
See also, SearchMessagesResponse.ts
There was a problem hiding this comment.
Yes, this is fine. We've detected this pattern and updated the type def very recently.
seratch
left a comment
There was a problem hiding this comment.
I cannot leave comments on the Slack Connect APIs as I haven't verified how they work yet (I will do early next week!). The others already look good to me 👍
If you want to add integration tests with the prod Slack APIs, you can have some code here. https://github.com/slackapi/node-slack-sdk/tree/main/prod-server-integration-tests/test
For the admin.auth.policy.*, you can do the same with Python SDK: https://github.com/slackapi/python-slack-sdk/blob/main/integration_tests/web/test_admin_auth_policy.py
As for the Slack Connect APIs, running tests without human interactions may not be feasible (I'm not sure in detail yet, though).
| } | ||
| cursorPaginationEnabledMethods.add('conversations.list'); | ||
| export interface ConversationsListConnectInvitesArguments extends WebAPICallOptions, TokenOverridable { | ||
| count?: number; |
There was a problem hiding this comment.
Oh... the 3rd pattern came here.
| attachments?: MatchAttachment[]; | ||
| is_mpim?: boolean; | ||
| score?: number; | ||
| files?: File[]; |
There was a problem hiding this comment.
Yes, this is fine. We've detected this pattern and updated the type def very recently.
|
@srajiang There is a lint error. Can you fix it? https://github.com/slackapi/node-slack-sdk/pull/1284/checks?check_run_id=3044242462 |
seratch
left a comment
There was a problem hiding this comment.
Having the integration tests for admin.auth.policy endpoints is a great addition 👍
| entity_type: "USER", | ||
| policy_name: "email_password", | ||
| }); | ||
| assert.equal(res.ok, true); |
There was a problem hiding this comment.
Having the following assertion is a bit easier to check the result than just knowing false
assert.isUndefined(res.error);There was a problem hiding this comment.
I have added these assertions!
There was a problem hiding this comment.
@srajiang Thanks. Perhaps, you can remove assert.equal(res.ok, true); in L88 because the old assertion fails before the newly added one 😸
| }); | ||
| assert.equal(res.ok, true); | ||
| } catch (error) { | ||
| console.log(error); |
There was a problem hiding this comment.
I can imagine the reason why you went this way (accepting the possible errors due to the data state, right?). This is fine for now 👍 Ideally, we can make these to be more like a robust scenario test but we don't need to put so much efforts for the perfection here.
There was a problem hiding this comment.
Yes, the try catch was helpful here in inspecting the error state (more than just the error reason), but since tests that should fail due to error show as passing, I think it's probably best to avoid false positives in our tests, so I have removed the try catch.
Summary
This PR fixes #1283 with the addition of the following Slack Connect
conversations.*+ Adminadmin.auth.policy.*methods:Requirements (place an
xin each[ ])