   withEmptyOptions = (context = {}) ->
     context['with empty options'] = ({ request }) ->
       arg0 = request.getCall(0).args[0]
-      assert.isEmpty arg0 if typeof arg0 isnt 'undefined'
+      assert.isEmpty arg0 if arg0
     context
 
   returningRequestObject = (context = {}) ->


      'with no options':
        topic: -> factory()
        'should call connector.request':
          calledOnce withEmptyOptions returningRequestObject()

      'with data':
        topic: ->
          factory data: {
            message: 'Hello World!'
            fn: -> 'Goodbye World!'
          }

        'should call connector.request': ->
          calledOnce returningRequestObject

            'with headers': ({ request }) ->
              assert.notEmpty headers = request.getCall(0).args[0].headers
              assert.strictEqual headers['Content-Type'], 'application/json'
              assert.isTrue headers['Content-Length'] > 0

            'with json parsable data': ({ request, data }) ->
              js = null
              json = request.getCall(0).args[0].data
              assert.notEmpty json
              assert.doesNotThrow (-> js = JSON.parse(json) ), SyntaxError
              assert.strictEqual js.message, data.message
              assert.match js.fn /\bfunction(\s|\\n)*\(\)(\s|\\n)*{(\s|\\n)*\breturn\b(\s|\\n)*'Goodbye World!'(\s|\\n)*;(\s|\\n)*}/

      'with data emitter':
        topic: -> factory data: on: sinon.stub()

          'with response callback': ({ requestObject }) ->
            assert.isTrue requestObject.on.calledWith 'response'

          'with response handler to':
            topic: ({ callback, requestObject }) ->
              responseObject =
                on: sinon.stub()
