<commit_before>import { shallow, createLocalVue } from '@vue/test-utils'
import Vuex from 'vuex'
import VueRouter from 'vue-router'
import RegisterTable from '@/registry/components/RegisterTable'
import { FETCH_DRILLER_LIST } from '@/registry/store/actions.types'

const localVue = createLocalVue()
localVue.use(Vuex)
localVue.use(VueRouter)

describe('RegisterTable.vue', () => {
  let store
  let getters
  let actions

  beforeEach(() => {
    getters = {
      user: () => {},
      loading: () => false,
      listError: () => null,
      drillers: () => {
        return {
          next: 'http://www.example.com/api/?limit=30&offset=60',
          previous: 'http://www.example.com/api/?limit=30&offset=0',
          results: [
            {
              person_guid: '1',
              first_name: 'Bob',
              surname: 'Driller'
            },
            {
              person_guid: '2',
              first_name: 'Rob',
              surname: 'Well'
            }
          ]
        }
      }
    }
    actions = {
      [FETCH_DRILLER_LIST]: jest.fn()
    }
    store = new Vuex.Store({ getters, actions })
  })

  it('has a row for every person', () => {
    const wrapper = shallow(RegisterTable, {
      store,
      localVue,
      stubs: ['router-link', 'router-view']
    })
    expect(wrapper.findAll('#registry-table-row').length)
      .toEqual(2)
  })

  it('has the right people in each row', () => {
    const wrapper = shallow(RegisterTable, {
      store,
      localVue,
      stubs: ['router-link', 'router-view']
    })
    // first row
    expect(wrapper.findAll('#registry-table-row').at(0).text())
      .toContain('Driller')
    expect(wrapper.findAll('#registry-table-row').at(0).text())
      .not.toContain('Well')
    expect(wrapper.findAll('#registry-table-row').at(1).text())
      .toContain('Well')<commit_msg>add better fake data (driller list)<commit_after>import { shallow, createLocalVue } from '@vue/test-utils'
import Vuex from 'vuex'
import VueRouter from 'vue-router'
import RegisterTable from '@/registry/components/RegisterTable'
import { FETCH_DRILLER_LIST } from '@/registry/store/actions.types'

const localVue = createLocalVue()
localVue.use(Vuex)
localVue.use(VueRouter)

describe('RegisterTable.vue', () => {
  let store
  let getters
  let actions

  beforeEach(() => {
    getters = {
      user: () => {},
      loading: () => false,
      listError: () => null,
      drillers: () => {
        return {
          next: 'http://www.example.com/api/?limit=30&offset=60',
          previous: 'http://www.example.com/api/?limit=30&offset=0',
          results: [
            {
              person_guid: '1e252dca-ccb9-439a-a6ec-aeec0f7e4a03',
              first_name: 'Bob',
              surname: 'Driller',
              organization_name: null,
              street_address: null,
              city: null,
              province_state: null,
              contact_tel: null,
              contact_email: null,
              activity: 'Well Driller',
              status: 'Active',
              registration_no: 'WD 08315530'
            },
            {
              person_guid: '1e252dca-ccb9-439a-a6ec-aeec0f7e4a02',
              first_name: 'Rob',
              surname: 'Well',
              organization_name: null,
              street_address: null,
              city: null,
              province_state: null,
              contact_tel: null,
              contact_email: null,
              activity: 'Well Driller',
              status: 'Active',
              registration_no: 'WD 08315531'
            }
          ]
        }
      }
    }
    actions = {
      [FETCH_DRILLER_LIST]: jest.fn()
    }
    store = new Vuex.Store({ getters, actions })
  })

  it('has a row for every person', () => {
    const wrapper = shallow(RegisterTable, {
      store,
      localVue,
      stubs: ['router-link', 'router-view']
    })
    expect(wrapper.findAll('#registry-table-row').length)
      .toEqual(2)
  })

  it('has the right people in each row', () => {
    const wrapper = shallow(RegisterTable, {
      store,
      localVue,
      stubs: ['router-link', 'router-view']
    })
    wrapper.setData({activity: 'Well Driller'})
    // first row
    expect(wrapper.findAll('#registry-table-row').at(0).text())
      .toContain('Driller')
    expect(wrapper.findAll('#registry-table-row').at(0).text())
      .not.toContain('Well')
    expect(wrapper.findAll('#registry-table-row').at(1).text())
      .toContain('Well')
{'fraction_non_alphanumeric': 0.14855875831485588, 'fraction_numerical': 0.01507760532150776, 'mean_word_length': 2.0812841530054644, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '1207134', 'n_tokens_mistral': 1460, 'n_tokens_neox': 1422, 'n_words': 259}