<commit_before>import { expect } from 'chai'

import { APIRefState } from '../../src/lib/api'
import { getSummary } from '../../src/ui/branches/pull-request-status'

describe('pull request status', () => {
  it('uses the state when no statuses found', () => {
    const prStatus = {
      pullRequestNumber: 23,
      state: <APIRefState>'success',
      totalCount: 0,
      sha: '',
      statuses: [],
    }
    expect(getSummary(prStatus)).to.equal('success')
  })

  it('changes the failure message to something more friendly', () => {
    const prStatus = {
      pullRequestNumber: 23,
      state: <APIRefState>'failure',
      totalCount: 0,
      sha: '',
      statuses: [],
    }
    expect(getSummary(prStatus)).to.equal('failed')
  })

  it('reads the statuses when they are populated', () => {
    const prStatus = {
      pullRequestNumber: 23,
      state: <APIRefState>'success',
      totalCount: 0,
      sha: '',
      statuses: [
        { id: 1, state: <APIRefState>'success' },
        { id: 2, state: <APIRefState>'success' },
      ],
    }
    expect(getSummary(prStatus)).to.equal('2/2 checks OK')
  })

  it('only counts the successful statuses', () => {
    const prStatus = {
      pullRequestNumber: 23,
      state: <APIRefState>'success',
      totalCount: 0,
      sha: '',
      statuses: [
        { id: 1, state: <APIRefState>'success' },
        { id: 2, state: <APIRefState>'pending' },
        { id: 2, state: <APIRefState>'pending' },
      ],
    }
    expect(getSummary(prStatus)).to.equal('1/3 checks OK')
  })
})
<commit_msg>liiint<commit_after>import { expect } from 'chai'

import { APIRefState } from '../../src/lib/api'
import { getSummary } from '../../src/ui/branches/pull-request-status'

const failure: APIRefState = 'failure'
const pending: APIRefState = 'pending'
const success: APIRefState = 'success'

describe('pull request status', () => {
  it('uses the state when no statuses found', () => {
    const prStatus = {
      pullRequestNumber: 23,
      state: success,
      totalCount: 0,
      sha: '',
      statuses: [],
    }
    expect(getSummary(prStatus)).to.equal('success')
  })

  it('changes the failure message to something more friendly', () => {
    const prStatus = {
      pullRequestNumber: 23,
      state: failure,
      totalCount: 0,
      sha: '',
      statuses: [],
    }
    expect(getSummary(prStatus)).to.equal('failed')
  })

  it('reads the statuses when they are populated', () => {
    const prStatus = {
      pullRequestNumber: 23,
      state: success,
      totalCount: 0,
      sha: '',
      statuses: [{ id: 1, state: success }, { id: 2, state: success }],
    }
    expect(getSummary(prStatus)).to.equal('2/2 checks OK')
  })

  it('only counts the successful statuses', () => {
    const prStatus = {
      pullRequestNumber: 23,
      state: success,
      totalCount: 0,
      sha: '',
      statuses: [
        { id: 1, state: success },
        { id: 2, state: pending },
        { id: 2, state: pending },
      ],
    }
    expect(getSummary(prStatus)).to.equal('1/3 checks OK')
  })
})

{'fraction_non_alphanumeric': 0.16327190430003233, 'fraction_numerical': 0.013579049466537343, 'mean_word_length': 2.5604142692750287, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 22, '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': '3300433', 'n_tokens_mistral': 1012, 'n_tokens_neox': 983, 'n_words': 232}