April 2020
Intermediate to advanced
292 pages
6h 50m
English
Next up is loadExistingIdentity, and this function is defined at:
| | function loadExistingIdentity (context) { |
| | return context.queries |
| | .byEmail(context.attributes.email) |
| | .then(existingIdentity => { |
| | context.existingIdentity = existingIdentity |
| | |
| | return context |
| | }) |
| | } |
| | |
| | module.exports = loadExistingIdentity |
Following Eric Elliot’s advice in his article “Mocking Is a Code Smell,”[48] this function does the single job of querying View Data for a record with the given email address. It doesn’t check to see if it actually found one because that would be mixing I/O (the query) and branching business logic. This function’s job is to ...
Read now
Unlock full access