import React from 'react'
import { shallow } from 'enzyme'

import moment from 'moment'

import RecentlyAddedUsersTable from '.'
import styles from './styles.scss'

describe('<RecentlyAddedUsersTable />', () => {
  it('renders', () => {
    const wrapper = shallow(<RecentlyAddedUsersTable />)
    expect(wrapper).toBeTruthy()
  })

  it('shows a user added within the current week', () => {
    const user = {
      name: 'Testy McTesterson',
      email: 'test@test.com',
      location: 'Testerton',
      team: 'Testing',
      active: true,
      dateAdded: moment(),
    }
    const wrapper = shallow(<RecentlyAddedUsersTable users={[user, { ...user, dateAdded: moment().subtract(2, 'weeks')}]} />)
    expect(wrapper.find('tr').length).toBe(1)
  })

  it('shows a non-active user added within the current week as "Pending"', () => {
    const user = {
      name: 'Testy McTesterson',
      email: 'test@test.com',
      location: 'Testerton',
      team: 'Testing',
      active: false,
      dateAdded: moment(),
    }
    const wrapper = shallow(<RecentlyAddedUsersTable users={[user]} />)
    expect(wrapper.find(`.${styles.pending}`).text()).toEqual('(Pending)')
  })

  it('does not show a user that is missing the `dateAdded` "hidden" property', () => {
    const user = {
      name: 'Testy McTesterson',
      email: 'test@test.com',
      location: 'Testerton',
      team: 'Testing',
      active: true,
    }
    const wrapper = shallow(<RecentlyAddedUsersTable users={[user]} />)
    expect(wrapper.find('tr').length).toBe(0)
  })
})

@@ -754,432 +754,8 @@
 %7D)%0A%0A
-  it('shows a non-active user added within the current week as %22Pending%22', () =%3E %7B%0A    const user = %7B%0A      name: 'Testy McTesterson',%0A      email: 'test@test.com',%0A      location: 'Testerton',%0A      team: 'Testing',%0A      active: false,%0A      dateAdded: moment(),%0A    %7D%0A    const wrapper = shallow(%3CRecentlyAddedUsersTable users=%7B%5Buser%5D%7D /%3E)%0A    expect(wrapper.find(%60.$%7Bstyles.pending%7D%60).text()).toEqual('(Pending)')%0A  %7D)%0A%0A
   it

Remove test for pending status - pending status no longer exists