MM-47287 Refactor/migrate bot accounts to typescript (#28347)

* refactor: convert bot_api_1_spec.js to typescript

- convert file bot_accounts/bot_api_1_spec.js to typescript
- update related data types in order to fix argument issues

* refactor: convert bot_api_not_cloud_spec.js to ts

- convert file bot_accounts/bot_api_not_cloud_spec.js to typescript
- update related data types in order to fix argument issues

* refactor: convert bot_channel_intro_spec.js to ts

- convert file bot_accounts/bot_channel_intro_spec.js to typescript
- convert support/api/bots.js to typescript
- remove data type bot.d.ts and include docs and definitions in
 support/api/bots.ts

* refactor: convert bot_accounts files to ts

- convert files from js to typescript
- move declaration files to ts
- update js docs
- fix lint and type errors

Related to #21303

* fix: replace params undefined on client.createUser

- replace undefined params with empty strings as suggested in review

* fix: add types to variables on spec tags_spec.ts

- add types to variables

* fix: update args for apiCreateBot on api/bots.ts

- update args so that lint issue is fixed

* Apply suggestions from code review

update assertion to 401

---------

Co-authored-by: Saturnino Abril <5334504+saturninoabril@users.noreply.github.com>
Этот коммит содержится в:
Angel Mendez
2024-10-28 03:03:21 -06:00
коммит произвёл GitHub
родитель f4c85a875d
Коммит a358bef3cd
41 изменённых файлов: 2197 добавлений и 2110 удалений

Просмотреть файл

@@ -30,6 +30,16 @@ interface PostMessageArg {
createAt?: number;
}
interface PostMessageRequest {
token: string;
message: string;
props?;
channelId: string;
rootId?;
createAt?;
failOnStatus?: boolean;
}
function postMessageAs(arg: PostMessageArg): ChainableT<PostMessageResp> {
const {sender, message, channelId, rootId, createAt} = arg;
const baseUrl = Cypress.config('baseUrl');
@@ -149,7 +159,7 @@ Cypress.Commands.add('externalRequest', externalRequest);
* @param {Object} channelId - where a post will be posted
*/
function postBotMessage({token, message, props, channelId, rootId, createAt, failOnStatus = true}): ChainableT<PostMessageResp> {
function postBotMessage({token, message, props, channelId, rootId, createAt, failOnStatus = true}: PostMessageRequest): ChainableT<PostMessageResp> {
const baseUrl = Cypress.config('baseUrl');
return cy.task('postBotMessage', {token, message, props, channelId, rootId, createAt, baseUrl}).then(({status, data}) => {