jest.dontMock(appFile('components/ideas/idea_show.js.jsx'));
jest.dontMock(appFile('stores/related_ideas_store'));
jest.dontMock('moment');

describe('IdeaShow', function() {
  var noop = function() {};
  var _$;

  global.Dispatcher = require(appFile('dispatcher'));
  global.ReactUjs = {
    mountReactComponents: noop
  };

  beforeEach(function() {
    _$ = global.$;
    global.$ = function() {
      return {
        autosize: noop,
        find: noop,
        trigger: noop
      };
    };
  });

  afterEach(function() {
    global.$ = _$;
  });

  it('renders null if there is no idea', function() {
    var IdeaShow = require(appFile('components/ideas/idea_show.js.jsx'));
    var ideaShow = TestUtils.renderIntoDocument(
      <IdeaShow navigate={noop} params={{}} query={{}} />
    );

    var main = TestUtils.scryRenderedDOMComponentsWithTag(ideaShow, 'div');

    expect(main.length).toBe(0);
  });

  describe('with idea', function() {
    var idea = {
      body: 'idea',
      comments_count: 2,
      name: 'test-idea',
      news_feed_item: {
        id: 'nfi1'
      },
      temperature: 90,
      user: {
        avatar_url: 'http://imgur.com/avatar.jpg',
        username: 'hover_boots'
      }
    };

    it('renders a show page if it gets an idea', function() {
      var IdeaStore = require(appFile('stores/idea_store'));
      IdeaStore.getIdea.mockReturnValueOnce(idea);

      var IdeaShow = require(appFile('components/ideas/idea_show.js.jsx'));
      var ideaShow = TestUtils.renderIntoDocument(
        <IdeaShow navigate={noop} params={{}} query={{}} />
      );

      var main = TestUtils.scryRenderedDOMComponentsWithTag(ideaShow, 'main');

      expect(TestUtils.isCompositeComponent(ideaShow)).toBe(true);
      expect(main.length).toBe(1);
    });
  });
});

@@ -208,16 +208,19 @@
 r _$;%0A%0A 
+ //
  global.
@@ -493,16 +493,55 @@
 %0A    %7D;%0A
+    global.moment = require('moment');%0A
   %7D);%0A%0A 
@@ -925,27 +925,36 @@
 ect(
-main.length
+ideaShow.render()
 ).toBe
+Null
 (
-0
 );%0A 
@@ -1255,16 +1255,68 @@
 _boots'%0A
+      %7D,%0A      product: %7B%0A        url: '/test-idea'%0A
       %7D%0A
@@ -1705,78 +1705,453 @@
     
-var main = TestUtils.scryRenderedDOMComponentsWithTag(ideaShow, 'main'
+expect(ideaShow.render()).not.toBeNull();%0A    %7D);%0A%0A    it('renders a show page with composite components if it gets an idea', function() %7B%0A      var IdeaStore = require(appFile('stores/idea_store'));%0A      IdeaStore.getIdea.mockReturnValueOnce(idea);%0A%0A      var IdeaShow = require(appFile('components/ideas/idea_show.js.jsx'));%0A      var ideaShow = TestUtils.renderIntoDocument(%0A        %3CIdeaShow navigate=%7Bnoop%7D params=%7B%7B%7D%7D query=%7B%7B%7D%7D /%3E%0A      
 );%0A%0A
@@ -2221,43 +2221,8 @@
 e);%0A
-      expect(main.length).toBe(1);%0A
     

Fix IdeaShow tests.