Skip to content

Conversation

@sprider
Copy link
Contributor

@sprider sprider commented Nov 5, 2020

Hi Team,

Could you please review this and let me know if you have any questions?

Thanks

@waldekmastykarz
Copy link
Member

Will do! Thank you for such a quick turnaround 👏

@waldekmastykarz waldekmastykarz self-assigned this Nov 11, 2020
Copy link
Member

@waldekmastykarz waldekmastykarz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done with a few things I've fixed when merging the PR 👍

: The name of the task list in which the task exists. Specify either `listId` or `listName`, not both

`--listId [listId]`
: The id of the task list in which the task exists. `listId` or `listName`, not both
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing piece of text: Specify either


public getTelemetryProperties(args: CommandArgs): any {
const telemetryProps: any = super.getTelemetryProperties(args);
telemetryProps.id = typeof args.options.id !== 'undefined';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since id is required, there is no need to track it in the telemetry because it would always show up as set.


public validate(args: CommandArgs): boolean | string {

if (!args.options.id) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the latest versions of the CLI, we no longer need to manually check for the presence of required options.


public commandAction(logger: Logger, args: CommandArgs, cb: (err?: any) => void): void {

const getToDoListId = () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's be explicit about the returned types to avoid runtime errors.

};
return request
.get(requestOptions)
.then((response: any) => response.value && response.value.length === 1 ? response.value[0].id : null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's avoid using any to avoid runtime errors

id: "AAMkAGI3NDhlZmQzLWQxYjAtNGJjNy04NmYwLWQ0M2IzZTNlMDUwNAAuAAAAAACQ1l2jfH6VSZraktP8Z7auAQCbV93BagWITZhL3J6BMqhjAAD9pHIhAAA=",
listName: "Tasks"
}
} as any, () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to cast args as any

listName: "Tasks",
confirm: true
}
} as any, () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to cast args as any

}
} as any, () => {
try {
//assert(log[log.length-1].indexOf('DONE') > -1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't include commented out code

}
} as any, () => {
try {
//assert(log[log.length-1].indexOf('DONE') > -1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is missing an assert so it will always show up as passing

let promptIssued = false;

if (promptOptions && promptOptions.type === 'confirm') {
promptIssued = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, you're checking the value of the promptIssued variable, that was set in previous tests. In this test, you're resetting prompt behavior on line 310, but you're not tracking promptOptions in here, so the value in this test is still from previous tests.

@waldekmastykarz
Copy link
Member

Merged manually. Thank you! 👍

@sprider
Copy link
Contributor Author

sprider commented Nov 12, 2020

@waldekmastykarz, Thnak you so much for your valuable feedbacks and time to review my code!

@sprider sprider deleted the new-command-todo-task-remove branch November 12, 2020 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New command: todo task remove

2 participants