<commit_before>import '../support'
import { mount } from 'enzyme'
import React from 'react'
import CommunityInvite from '../../../src/containers/community/CommunityInvite'
import { configureStore } from '../../../src/store'
import { MemberRole } from '../../../src/models/community'

const community = {
  id: '1',
  slug: 'foomunity',
  name: 'Foom Unity',
  beta_access_code: 'foom',
  description: 'Social cohesion in the face of AI hard takeoff'
}

const currentUser = {
  id: '5',
  memberships: {
    [community.slug]: {
      community_id: community.id,
      role: MemberRole.MODERATOR
    }
  }
}

describe('CommunityInvite', () => {
  var store

  beforeEach(() => {
    store = configureStore({
      communities: {[community.slug]: community},
      people: {current: currentUser},
      invitations: {[community.slug]: [{id: 1, user: {id: 'required'}}]},
      joinRequests: {[community.slug]: [{id: 1, user: {id: 'required'}}]}
    }).store
    window.FEATURE_FLAGS = {REQUEST_TO_JOIN_COMMUNITY: 'on'}
  })

  it('renders without errors', () => {
    const props = {
      params: {id: community.slug}
    }

    const node = mount(<CommunityInvite {...props} />, {
      context: {store, currentUser},
      childContextTypes: {currentUser: React.PropTypes.object}
    })

    expect(node.find('.invitation-link a').first().text())
    .to.equal(`${process.env.UPSTREAM_HOST}/c/foomunity/join/foom`)

    expect(node.find('#community-invite-form label').map(n => n.text().trim()))
    .to.deep.equal(['Upload CSV', 'Import CSV File (optional)', ''])

    expect(node.find('.invitations').length).to.equal(1)

    expect(node.find('.join-requests').length).to.equal(1)
  })
})<commit_msg>fix test<commit_after>import '../support'
import { mount } from 'enzyme'
import React from 'react'
import CommunityInvite from '../../../src/containers/community/CommunityInvite'
import { configureStore } from '../../../src/store'
import { MemberRole } from '../../../src/models/community'

const community = {
  id: '1',
  slug: 'foomunity',
  name: '<NAME>',
  beta_access_code: 'foom',
  description: 'Social cohesion in the face of AI hard takeoff'
}

const currentUser = {
  id: '5',
  memberships: {
    [community.slug]: {
      community_id: community.id,
      role: MemberRole.MODERATOR
    }
  }
}

describe('CommunityInvite', () => {
  var store

  beforeEach(() => {
    store = configureStore({
      communities: {[community.slug]: community},
      people: {current: currentUser},
      invitations: {[community.slug]: [{id: 1, user: {id: 'required'}}]},
      joinRequests: {[community.slug]: [{id: 1, user: {id: 'required'}}]}
    }).store
    window.FEATURE_FLAGS = {REQUEST_TO_JOIN_COMMUNITY: 'on'}
  })

  it('renders without errors', () => {
    const props = {
      params: {id: community.slug}
    }

    const node = mount(<CommunityInvite {...props} />, {
      context: {store, currentUser},
      childContextTypes: {currentUser: React.PropTypes.object}
    })

    expect(node.find('.invitation-link a').first().text())
    .to.equal(`${process.env.UPSTREAM_HOST}/c/foomunity/join/foom`)

    expect(node.find('#community-invite-form label').map(n => n.text().trim()))
    .to.deep.equal(['Send Email Invitations', 'Upload CSV', 'Import CSV File (optional)', ''])

    expect(node.find('.invitations').length).to.equal(1)

    expect(node.find('.join-requests').length).to.equal(1)
  })
})
{'fraction_non_alphanumeric': 0.19029523531131248, 'fraction_numerical': 0.0035077462730195848, 'mean_word_length': 3.4097938144329896, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 14, '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': '4433003', 'n_tokens_mistral': 1147, 'n_tokens_neox': 1116, 'n_words': 233}