 elasticio = require '../lib/elasticio'
 Config = require '../config'
 StockImport = require '../lib/stockimport'
+{ElasticIo} = require 'sphere-node-utils'
 
 describe 'elasticio integration', ->
   it 'should work with no attachments nor body', (done) ->

      expect(error).toBe 'No data found in elastic.io msg.'
      done()

  xdescribe 'XML file', ->
    it 'should import from one file with 2 entries', (done) ->
      cfg =
        sphereClientId: Config.config.client_id

          'stock.xml':
            content: enc

      spyOn(ElasticIo, 'returnSuccess').andCallThrough()
      elasticio.process msg, cfg, (error, message) ->
        expect(error).toBe null
        if message is 'elastic.io messages sent.'
          expect(ElasticIo.returnSuccess.callCount).toBe 3
          expectedMessage =
            body:
              QUANTITY: -2
              SKU: 'e-123'
          expect(ElasticIo.returnSuccess).toHaveBeenCalledWith(expectedMessage, jasmine.any(Function))
          expectedMessage =
            body:
              QUANTITY: 0
              SKU: 'e-xyz'
          expect(ElasticIo.returnSuccess).toHaveBeenCalledWith(expectedMessage, jasmine.any(Function))
          done()

  describe 'CSV file', ->
    it 'should import from one file with 3 entries', (done) ->
      cfg =
        sphereClientId: Config.config.client_id
