 # No longer exists, needs further investigation if we're using it
 # ReactContext   = require('react/lib/ReactContext')
 
+{LocationBroadcast} = require 'react-router/locationBroadcast'
+{createRouterLocation} = require 'react-router/LocationUtils'
 {Promise}      = require 'es6-promise'
 {commonActions} = require './utilities'
 sandbox = null
+Sinon = {}
+
+
 ROUTER = null
 CURRENT_ROUTER_PARAMS = null
 CURRENT_ROUTER_PATH   = null

  get: -> ROUTER
})

module.exports = {Testing, expect, sinon, React, _, ReactTestUtils}

# Mock a router for the context
beforeEach ->
  sandbox = sinon.sandbox.create()
  ROUTER  = {
    transitionTo:     sandbox.spy()
    replaceWith:      sandbox.spy()
    blockTransitions: sandbox.spy()
    createHref: sandbox.spy( -> '/' )
  }
afterEach ->
  sandbox.restore()

# A wrapper component to setup the router context
Wrapper = React.createClass
  childContextTypes:
    router: React.PropTypes.object
  getChildContext: ->
    router: ROUTER
  render: ->
    location = createRouterLocation('/')
    React.createElement(LocationBroadcast, value: location,
      React.createElement(@props._wrapped_component,
        _.extend(_.omit(@props, '_wrapped_component'), ref: 'element')
      )
    )

Testing = {
