<commit_before>import React from 'react'
import { expect } from 'chai'
import { shallow } from 'enzyme'
import { DefaultProfilePage } from '../../app/js/profiles/DefaultProfilePage'

function setup(accounts = []) {
  const props = {
    localIdentities: [{
      profile: {
        '@context': 'http://schema.org',
        '@type': 'Person',
        account: accounts
      },
      ownerAddress: 'onwards and upwards',
      verifications: [],
      trustlevel: 0
    }],
    defaultIdentity: 0,
    createNewProfile: () => {},
    updateProfile: () => {},
    refreshIdentities: () => {},
    refreshSocialProofVerifications: () => {},
    api: {},
    identityAddresses: [],
    nextUnusedAddressIndex: 1,
    encryptedBackupPhrase: 'onwards and upwards',
    setDefaultIdentity: () => {},
    identityKeypairs: [],
    storageConnected: false
  }

  const wrapper = shallow(<DefaultProfilePage {...props} />)

  return {
    props,
    wrapper
  }
}

function alphabeticalOrdered(accounts) {
  return accounts.first().props().service <=
    accounts.last().props().service
}

describe('<DefaultProfilePage />', () => {
  describe('with no filled accounts', () => {
    const { wrapper } = setup()
    const accounts = wrapper.find( 'div.profile-accounts ul').children()
    it('should order placeholder proofs alphabetically', () => {
      expect(alphabeticalOrdered(accounts)).to.eq(true)
    })
  })

  describe('with filled accounts', () => {
    const filledAccounts = [{ service: 'twitter'}, 
                            { service: 'facebook'}]
    const { wrapper } = setup(filledAccounts)
    const list = wrapper.find('div.profile-accounts ul')
    it('should order verified proofs alphabetically', () => {
      const accounts = list.children('[placeholder=false]')
      expect(alphabeticalOrdered(accounts)).to.eq(true)
    })

    it('should order placeholder proofs alphabetically', () => {
      const accounts = list.children('[placeholder=true]')
      expect(alphabeticalOrdered(accounts)).to.eq(true)
    })

    it('should present filled proofs before placeholders',() => {
      const accounts = list.children()
      accounts.forEach((account, index) => {
        expect(account.prop('placeholder')).to.equal(index >= filledAccounts.length)
      })
    })
  })
})

<commit_msg>removes test to check for unfilled proofs when there are none<commit_after>import React from 'react'
import { expect } from 'chai'
import { shallow } from 'enzyme'
import { DefaultProfilePage } from '../../app/js/profiles/DefaultProfilePage'

function setup(accounts = []) {
  const props = {
    localIdentities: [{
      profile: {
        '@context': 'http://schema.org',
        '@type': 'Person',
        account: accounts
      },
      ownerAddress: 'onwards and upwards',
      verifications: [],
      trustlevel: 0
    }],
    defaultIdentity: 0,
    createNewProfile: () => {},
    updateProfile: () => {},
    refreshIdentities: () => {},
    refreshSocialProofVerifications: () => {},
    api: {},
    identityAddresses: [],
    nextUnusedAddressIndex: 1,
    encryptedBackupPhrase: 'onwards and upwards',
    setDefaultIdentity: () => {},
    identityKeypairs: [],
    storageConnected: false
  }

  const wrapper = shallow(<DefaultProfilePage {...props} />)

  return {
    props,
    wrapper
  }
}

function alphabeticalOrdered(accounts) {
  return accounts.first().props().service <=
    accounts.last().props().service
}

describe('<DefaultProfilePage />', () => {
  describe('with no filled accounts', () => {
    const { wrapper } = setup()
    const accounts = wrapper.find( 'div.profile-accounts ul').children()
    it('should order placeholder proofs alphabetically', () => {
      expect(alphabeticalOrdered(accounts)).to.eq(true)
    })
  })

  describe('with filled accounts', () => {
    const filledAccounts = [{ service: 'twitter'}, 
                            { service: 'facebook'}]
    const { wrapper } = setup(filledAccounts)
    const list = wrapper.find('div.profile-accounts ul')
    it('should order verified proofs alphabetically', () => {
      const accounts = list.children('[placeholder=false]')
      expect(alphabeticalOrdered(accounts)).to.eq(true)
    })

    it('should present filled proofs before placeholders',() => {
      const accounts = list.children()
      accounts.forEach((account, index) => {
        expect(account.prop('placeholder')).to.equal(index >= filledAccounts.length)
      })
    })
  })
})


{'fraction_non_alphanumeric': 0.1557743957027753, 'fraction_numerical': 0.0013428827215756492, 'mean_word_length': 3.149489322191272, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 34, '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': '2126566', 'n_tokens_mistral': 1286, 'n_tokens_neox': 1257, 'n_words': 263}