           jobType: 'SendMessage2'
         rawData: JSON.stringify devices:['receiver-uuid'], payload: 'boo'
 
-      @dispatcher.generateJobs job, (error, @generatedJobs) =>
-        done()
+      @dispatcher.generateJobs job, (error, @generatedJobs) => done()
 
-    it.only 'should return a 204', ->
-      expectedResponse =
-        metadata:
-          code: 204
-          status: 'No Content'
-
+    it 'should return a 204', ->
+      console.log JSON.stringify @generatedJobs, null, 2
       expect(@generatedJobs).to.exist

JobManager     = require 'meshblu-core-job-manager'


describe 'SendMessage2: broadcast+send', ->
  beforeEach (done)->
    @db = mongojs 'meshblu-core-test'
    @collection = @db.collection 'devices'
    @collection.drop => done()

  beforeEach ->
    redisUri = process.env.REDIS_URI
    @dispatcher = new TestDispatcher
    client = new RedisNS 'meshblu-test', redis.createClient(redisUri)
    client.del 'request:queue'

  beforeEach (done) ->
    @auth =
      uuid: 'sender-uuid'
      token: 'leak'

      token: bcrypt.hashSync @auth.token, 8
      receiveWhitelist: [ 'receiver-uuid' ]

    @devices.insert @senderDevice, done

  beforeEach 'create receiver device', (done) ->
    @receiverDevice =
      uuid: 'receiver-uuid'
      type: 'device:receiver'

    @devices.insert @receiverDevice, done

  beforeEach 'create subscription', (done) ->
    subscription =
      type: 'message.sent'
      emitterUuid: 'sender-uuid'
      subscriberUuid: 'sender-uuid'

    @subscriptions.insert subscription

  context "sending to a device with sendWhitelist", ->
    beforeEach (done) ->
