DoSomething/ds-mdata-responder — pull request #286 by jonuy (2014-11-06 19:01:05+00:00)
Title: mobilecommons tests

#### What's this PR do?
Adds tests for our app-specific mobilecommons library. Added an `events` property to `eventEmitter` so that there's a single place where custom emitted events get named. And put in some additional logging when mobilecommons responds with an error.

#### Where should the reviewer start?
* `app/eventEmitter.js`
An `events` property is added where our custom events can live. This can help protect us from copy & paste bugs and if event names ever need to change, a single place to do it.

* `mobilecommons/mobilecommons.js`
When `NODE_ENV=test`, in addition to logging, we'll be emitting corresponding events. I've also moved that `if` block further into each function just before the actual http requests. This'll allow our tests to check against the data that's suppose to be sent.

* `test/mobilecommons.js`
This does basic coverage of optin with just an Alpha, optin with one Beta, optin with two Betas, optout of a single campaign, profile_update with no custom fields, and profile_update with two custom fields.

#### How should this be manually tested?
Run `npm test` and verify it all succeeds. Or just wait for wercker to build, because there's test step in the build process.

#### What are the relevant tickets?
#31