 _ = require 'underscore'
-_.mixin deepClone: (obj) -> JSON.parse(JSON.stringify(obj))
+_.mixin require('sphere-node-utils')._u
 Q = require 'q'
 OrderSync = require '../../lib/sync/order-sync'
 Config = require('../../config').config

         quantity: 1
      }]]

    @sync.buildActions(orderNew, @order).update (error, response, body) =>
      expect(response.statusCode).toBe 200
      console.error body unless response.statusCode is 200
      orderUpdated = body

      orderNew2 = JSON.parse(JSON.stringify(orderUpdated))


      # add a parcel item
      orderNew2.shippingInfo.deliveries[0].parcels = [{

        shipmentState: 'Advised'
      }]

    @sync.buildActions(orderNew, @order).update()
    .then (result) ->
      expect(result.statusCode).toBe 200
      orderUpdated = result.body
      expect(orderUpdated).toBeDefined()
      expect(orderUpdated.returnInfo[0].id).toBe orderNew.returnInfo[0].id
      done()
    .fail (error) -> done(error)

  it 'should sync returnInfo status', (done) ->
    orderNew = _.deepClone @order
