<commit_before>import React from 'react';
import {shallow, mount} from 'enzyme';

import Remote from '../../lib/models/remote';
import Branch, {nullBranch} from '../../lib/models/branch';
import BranchSet from '../../lib/models/branch-set';
import Issueish from '../../lib/models/issueish';
import IssueishListView from '../../lib/views/issueish-list-view';

function makeCommit(...states) {
  return {
    nodes: [
      {
        commit: {
          status: {
            contexts: states.map(state => ({state})),
          },
        },
      },
    ],
  };
}

const allGreen = new Issueish({
  number: 1,
  title: 'One',
  url: 'https://github.com/atom/github/pulls/1',
  author: {
    login: 'me',
    avatarUrl: 'https://avatars.githubusercontent.com/u/100?v=24',
  },
  createdAt: '2018-06-12T14:50:08Z',
  headRefName: 'head-ref',
  headRepository: {
    nameWithOwner: 'me/github',
  },
  commits: makeCommit('SUCCESS', 'SUCCESS', 'SUCCESS'),
});

const mixed = new Issueish({
  number: 2,
  title: 'Two',
  url: 'https://github.com/atom/github/pulls/2',
  author: {
    login: 'me',
    avatarUrl: 'https://avatars.githubusercontent.com/u/100?v=24',
  },
  createdAt: '2018-06-12T14:50:08Z',
  headRefName: 'head-ref',
  headRepository: {
    nameWithOwner: 'me/github',
  },
  commits: makeCommit('SUCCESS', 'PENDING', 'FAILURE'),
});

const allRed = new Issueish({
  number: 3,
  title: 'Three',
  url: 'https://github.com/atom/github/pulls/3',
  author: {
    login: 'me',
    avatarUrl: 'https://avatars.githubusercontent.com/u/100?v=24',
  },
  createdAt: '2018-06-12T14:50:08Z',
  headRefName: 'head-ref',
  headRepository: {
    nameWithOwner: 'me/github',
  },
  commits: makeCommit('FAILURE', 'ERROR', 'FAILURE'),
});

const noStatus = new Issueish({
  number: 4,
  title: 'Four',
  url: 'https://github.com/atom/github/pulls/4',
  author: {
    login: 'me',
    avatarUrl: 'https://avatars.githubusercontent.com/u/100?v=24',
  },
  createdAt: '2018-06-12T14:50:08Z',
  headRefName: 'head-ref',
  headRepository: {
    nameWithOwner: 'me/github',
  },
  commits: {
    nodes: [
      {
        commit: {
          status: null,
        },
      },
    ],
  },
});

class CustomComponent extends React.Component {
  render() {
    return <div className="custom" />;
  }
}

describe('IssueishListView', function() {
  let origin, branch, branchSet;

  beforeEach(function() {
    origin = new Remote('origin', 'git@github.com:atom/github.git');
    branch = new Branch('master', nullBranch, nullBranch, true);
    branchSet = new BranchSet();
    branchSet.add(branch);
  });

  function buildApp(overrideProps = {}) {
    return (
      <IssueishListView
        title="aaa"
        isLoading={true}
        total={0}
        issueishes={[]}

        onCreatePr={() => {}}
        onIssueishClick={() => {}}
        onMoreClick={() => {}}

        {...overrideProps}
      />
    );
  }
<commit_msg>Use the createPullRequestResult factory in IssueishListView tests<commit_after>import React from 'react';
import {shallow, mount} from 'enzyme';

import {createPullRequestResult} from '../fixtures/factories/pull-request-result';
import Branch, {nullBranch} from '../../lib/models/branch';
import BranchSet from '../../lib/models/branch-set';
import Issueish from '../../lib/models/issueish';
import IssueishListView from '../../lib/views/issueish-list-view';

const allGreen = new Issueish(createPullRequestResult({number: 1, states: ['SUCCESS', 'SUCCESS', 'SUCCESS']}));
const mixed = new Issueish(createPullRequestResult({number: 2, states: ['SUCCESS', 'PENDING', 'FAILURE']}));
const allRed = new Issueish(createPullRequestResult({number: 3, states: ['FAILURE', 'ERROR', 'FAILURE']}));
const noStatus = new Issueish(createPullRequestResult({number: 4, states: null}));

class CustomComponent extends React.Component {
  render() {
    return <div className="custom" />;
  }
}

describe('IssueishListView', function() {
  let branch, branchSet;

  beforeEach(function() {
    branch = new Branch('master', nullBranch, nullBranch, true);
    branchSet = new BranchSet();
    branchSet.add(branch);
  });

  function buildApp(overrideProps = {}) {
    return (
      <IssueishListView
        title="aaa"
        isLoading={true}
        total={0}
        issueishes={[]}

        onCreatePr={() => {}}
        onIssueishClick={() => {}}
        onMoreClick={() => {}}

        {...overrideProps}
      />
    );
  }

{'fraction_non_alphanumeric': 0.18155164636896706, 'fraction_numerical': 0.02029769959404601, 'mean_word_length': 3.1760828625235407, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 14, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '806589', 'n_tokens_mistral': 1521, 'n_tokens_neox': 1465, 'n_words': 291}