<commit_before>var sd = require('skin-deep'),
    expect = require('chai').expect,
    Details = require('../../../ui/components/details.jsx'),
    passDetails = require('../../fixtures/components/pass-details.js'),
    failDetails = require('../../fixtures/components/fail-details.js');

describe('Details', function() {
  var tree;

  describe('Passing', function() {
    beforeEach(function() {
      tree = sd.shallowRender(<Details details={passDetails}/>);
    });

    it('should render the PassedTest component', function() {
      expect(tree.findNode('PassedTest')).to.not.be.false;
    });

    it('should pass the baseline to the PassedTest component', function() {
      expect(tree.findNode('PassedTest').props.paths.baseline).to.be.equal(
        passDetails.paths.baseline);
    });

    it('should not pass a screenshot to the PassedTest component',
        function() {
          expect(tree.findNode('PassedTest').props.paths.screenshot)
              .to.be.undefined;
        });

    it('should not pass a diff to the PassedTest component', function() {
      expect(tree.findNode('PassedTest').props.paths.diff).to.be.undefined;
    });

    it('should pass the correct baseline path', function() {
      expect(tree.findNode('PassedTest').props.paths.baseline).to.be.
        equal(failDetails.paths.baseline);
    });
  });

  describe('Fail details', function() {
    beforeEach(function() {
      tree = sd.shallowRender(<Details details={failDetails}/>);
    });

    it('should render the FailedTest component', function() {
      expect(tree.findNode('FailedTest')).to.not.be.false;
    });

    it('should pass the baseline to the FailedTest component', function() {
      expect(tree.findNode('FailedTest').props.paths.baseline).to.be.equal(
        failDetails.paths.baseline);
    });

    it('should pass the screenshot to the FailedTest component', function() {
      expect(tree.findNode('FailedTest').props.paths.screenshot).to.be.equal(
        failDetails.paths.screenshot);
    });

    it('should pass the diff to the FailedTest component', function() {
      expect(tree.findNode('FailedTest').props.paths.diff).to.be.equal(
        failDetails.paths.diff);
    });

    it('should pass the correct screenshot path', function() {
      expect(tree.findNode('FailedTest').props.paths.screenshot).to.be.
        equal(failDetails.paths.screenshot);
    });

    it('should pass the correct diff path', function() {
      expect(tree.findNode('FailedTest').props.paths.diff)
          .to.be.equal(failDetails.paths.diff);
    });
  });
});
<commit_msg>Reuse component node when testing #21<commit_after>var sd = require('skin-deep'),
    expect = require('chai').expect,
    Details = require('../../../ui/components/details.jsx'),
    passDetails = require('../../fixtures/components/pass-details.js'),
    failDetails = require('../../fixtures/components/fail-details.js');

describe('Details', function() {
  var tree, node, passedTestPaths, failedTestPaths;

  describe('Passing', function() {
    beforeEach(function() {
      tree = sd.shallowRender(<Details details={passDetails}/>);
      node = tree.findNode('PassedTest');
    });

    it('should render the PassedTest component', function() {
      expect(node).to.not.be.false;
      passedTestPaths = node.props.paths;
    });

    it('should pass the baseline to the PassedTest component', function() {
      expect(passedTestPaths.baseline).to.be.equal(passDetails.paths.baseline);
    });

    it('should not pass a screenshot to the PassedTest component', function() {
      expect(passedTestPaths.screenshot).to.be.undefined;
    });

    it('should not pass a diff to the PassedTest component', function() {
      expect(passedTestPaths.diff).to.be.undefined;
    });

    it('should pass the correct baseline path', function() {
      expect(passedTestPaths.baseline).to.be.equal(failDetails.paths.baseline);
    });
  });

  describe('Fail details', function() {
    beforeEach(function() {
      tree = sd.shallowRender(<Details details={failDetails}/>);
      node = tree.findNode('FailedTest');
    });

    it('should render the FailedTest component', function() {
      expect(node).to.not.be.false;
      failedTestPaths = node.props.paths;
    });

    it('should pass the baseline to the FailedTest component', function() {
      expect(failedTestPaths.baseline).to.be.equal(failDetails.paths.baseline);
    });

    it('should pass the screenshot to the FailedTest component', function() {
      expect(failedTestPaths.screenshot)
          .to.be.equal(failDetails.paths.screenshot);
    });

    it('should pass the diff to the FailedTest component', function() {
      expect(failedTestPaths.diff).to.be.equal(failDetails.paths.diff);
    });

    it('should pass the correct screenshot path', function() {
      expect(failedTestPaths.screenshot)
          .to.be.equal(failDetails.paths.screenshot);
    });

    it('should pass the correct diff path', function() {
      expect(failedTestPaths.diff).to.be.equal(failDetails.paths.diff);
    });
  });
});

{'fraction_non_alphanumeric': 0.1568280204643841, 'fraction_numerical': 0.0003935458480913026, 'mean_word_length': 3.351883561643836, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2741963', 'n_tokens_mistral': 1497, 'n_tokens_neox': 1435, 'n_words': 282}