Skip to content
This repository has been archived by the owner on Feb 19, 2024. It is now read-only.

From Callback to Promise - TabCorp - 26/04/2017 #9

Merged
merged 1 commit into from
May 1, 2017

Conversation

rodolfoprr
Copy link
Contributor

Pushing some lessons learned in the last two sessions since we can share the code in this repository. Am I missing anything important? 😛

@gtramontina @ronaldotijucas @yeahyangliu @ReenaRajani @gaurav-narra


```coffeescript
it 'does something', ->
myObject.myPromise(parameter).then ->
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it is worth mentioning that you have to return a promise on a mocha test so it waits for the promise's resolution… and because of coffee-script, we don't need an explicit return on the last statement…


again, we don't need to use `done` and we don't need to write an expectation for `err` object since inside `.then` we don't have an error.

3. In the implementation side, we can try always to write our promises in a way that it tells us an story:
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps add something along these lines: "aiming to have one-liners; extract functions and give them descriptive names"… 💭?

@rodolfoprr rodolfoprr merged commit 63aeb90 into master May 1, 2017
@rodolfoprr rodolfoprr deleted the from-callback-to-promise branch May 1, 2017 04:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants