 JobManager     = require 'meshblu-core-job-manager'
 
 
-describe 'SendMessage2: broadcast+send', ->
-  beforeEach (done)->
-    @db = mongojs 'meshblu-core-test'
-    @collection = @db.collection 'devices'
-    @collection.drop => done()
+xdescribe 'SendMessage2: broadcast+send', ->
+  beforeEach (done) ->
+    @db            = mongojs 'meshblu-core-test'
+    @devices    = @db.collection 'devices'
+    @subscriptions = @db.collection 'subscriptions'
 
+    @subscriptions.drop =>
+      @devices.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) ->
+  beforeEach 'create sender device', (done) ->
     @auth =
       uuid: 'sender-uuid'
       token: 'leak'

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

    @collection.insert @senderDevice, done

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

    @collection.insert @receiverDevice, done

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

          jobType: 'SendMessage2'
        rawData: JSON.stringify devices:['receiver-uuid'], payload: 'boo'

      @dispatcher.generateJobs job, (error, @generatedJobs) => done()

    it 'should return a 204', ->
      console.log JSON.stringify @generatedJobs, null, 2
      expect(@generatedJobs).to.exist
