-
- Downloads
[91] refactor: use notifications type when dispatching REMOVE
context:
* long-term goal: all command responses return notifications,
messenger is dumb: it just sees notificatoins in the CR, and
gets 'em out the door!
* but we want to move incrementally and move to that signature one
command at a time!
* this commit uses the refactor pattern that we want for *all*
commands but only for the REMOVE comand
implementation:
* `execute.processCommand` (-> `removeAdmin`):
* generates a notification for each person who is affected by the command
* returns an array of notifications in the commandResult
* `messenger.handleNotifications` sees the notifications and sends
them (doing a bit of datamunging that is necessary to keep the
contract with `notify` but which we will eventually get rid of)
* TESTS!!! (both for `execute.removeAdmin` and for `messenger.handleNotification`)
co-authored-by:
Mari <m@marrri.com>
Showing
- app/services/dispatcher/commands/execute.js 36 additions, 12 deletionsapp/services/dispatcher/commands/execute.js
- app/services/dispatcher/messenger.js 16 additions, 17 deletionsapp/services/dispatcher/messenger.js
- test/support/factories/phoneNumber.js 3 additions, 0 deletionstest/support/factories/phoneNumber.js
- test/unit/services/dispatcher/commands/execute.spec.js 43 additions, 23 deletionstest/unit/services/dispatcher/commands/execute.spec.js
- test/unit/services/dispatcher/messenger.spec.js 44 additions, 21 deletionstest/unit/services/dispatcher/messenger.spec.js
Loading
Please register or sign in to comment