Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using same hook for nested calls instead of splitted ones #381

Open
marcelomorgado opened this issue May 7, 2019 · 0 comments
Open

Using same hook for nested calls instead of splitted ones #381

marcelomorgado opened this issue May 7, 2019 · 0 comments
Labels
tech debt Technical debt not involving bugs or features
Milestone

Comments

@marcelomorgado
Copy link
Contributor

The Decentraland.test.js test suite has splitted beforeEach hooks for nested call (to avoid callback hell). Isntead of that, we should write those on the same hook using style proposed by @pcowgill:

// buildManaAction here
// buildEthAction here
// buildMarketplaceAction here

functionThatSetsManaDone {
  if (marketplaceDone) {
    functionThatHandlesMarketplaceAndManaDone()
  }
}

functionThatShipsManaAndMarketplaceApproval {
  manaAction.send()
  marketplaceAction.send()
}

ethAction.on('confirmation', functionThatShipsManaAndMarketplaceApproval)
manaAction.on('confirmation', functionThatSetsManaDone)
marketplaceAction.on('confirmation', functionThatSetsMarketplaceDone)

ethAction.send()

Refs: #369 (comment)

@marcelomorgado marcelomorgado added the tech debt Technical debt not involving bugs or features label May 7, 2019
@marcelomorgado marcelomorgado added this to the 0.1.0 release milestone May 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tech debt Technical debt not involving bugs or features
Projects
None yet
Development

No branches or pull requests

1 participant