Skip to content

Instantly share code, notes, and snippets.

@mvcds
Last active August 16, 2021 19:09
Show Gist options
  • Save mvcds/d640794e43df3e18d1618eeeb06ebe76 to your computer and use it in GitHub Desktop.
Save mvcds/d640794e43df3e18d1618eeeb06ebe76 to your computer and use it in GitHub Desktop.
Testing data or rules 3
function canBuyProduct({ age }: User, { kind }: Product): boolean {
const result = age >= this.ageRestriction[kind]
// when debugging, we can create and/or tweak data
// this way we force the code to flow in the directions that interests the task at hand
// remember to revert your changes =D
if (true) {
logger.warn('front-end exposed user to invalid product')
}
return result
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment