   ROUTER.transitionTo = sandbox.spy()
 
 afterEach ->
-  for comp in RENDERED
-    dom = React.findDOMNode(comp)
-    React.unmountComponentAtNode(dom) if dom
   sandbox.restore()
 
 # A wrapper component to setup the router context

ROUTER = null
RENDERED = []

# Mock a router for the context
beforeEach ->
  RENDERED = []


  renderComponent: (component, options) ->
    options.props ||= {}
    div = document.createElement('div')
    promise = new Promise( (resolve, reject) ->
      props = _.clone(options.props)
      props._wrapped_component = component
      wrapper = React.render( React.createElement(Wrapper, props), div )
      resolve(
        wrapper,
        element: wrapper.refs.element,
        dom: React.findDOMNode(wrapper.refs.element)
      )
    )
    # defer adding the then callback so it'll be called after whatever is attached after the return
    _.defer -> promise.then -> React.unmountComponentAtNode(div)
    promise

  actions: commonActions

