<commit_before>/* global describe, it */
import { expect } from 'chai'
import Vue from 'vue'
import Vuex from 'vuex'
// import sinon from 'sinon'
import CalibratePlaceable from 'renderer/components/CalibratePlaceable.vue'

Vue.use(Vuex)

// function getMockStore () {
//   return {
//     actions: {
//       pickUpTip: sinon.spy(),
//       dropTip: sinon.spy(),
//       moveToPosition: sinon.spy(),
//       calibrate: sinon.spy()
//     }
//   }
// }

function getRenderedVm (Component, propsData) {
  const Ctor = Vue.extend(Component)
  const vm = new Ctor({ propsData }).$mount()
  return vm
}

describe('CalibratePlaceable.vue', (done) => {
  it('renders with tiprack based on prop', () => {
    let placeable = {
      'slot': 'A1',
      'label': 'tiprack-12ml',
      'sanitizedType': 'tiprack',
      'calibrated': false
    }
    let instrument = {'axis': 'a'}

    expect(getRenderedVm(CalibratePlaceable, {
      placeable,
      instrument
    }).$el.querySelectorAll('button').length).to.equal(4)

    let plate = placeable
    plate['sanitizedType'] = 'default'

    console.log(getRenderedVm(CalibratePlaceable, {
      placeable: plate,
      instrument
    }).placeable)

    expect(getRenderedVm(CalibratePlaceable, {
      placeable: plate,
      instrument
    }).$el.querySelectorAll('button').length).to.equal(2)
  })
})
<commit_msg>split up tip conditional into two tests<commit_after>/* global describe, it */
import { expect } from 'chai'
import Vue from 'vue'
import Vuex from 'vuex'
// import sinon from 'sinon'
import CalibratePlaceable from 'renderer/components/CalibratePlaceable.vue'

Vue.use(Vuex)

// function getMockStore () {
//   return {
//     actions: {
//       pickUpTip: sinon.spy(),
//       dropTip: sinon.spy(),
//       moveToPosition: sinon.spy(),
//       calibrate: sinon.spy()
//     }
//   }
// }

function getRenderedVm (Component, propsData) {
  const Ctor = Vue.extend(Component)
  const vm = new Ctor({ propsData }).$mount()
  return vm
}

let placeable = {
  'slot': 'A1',
  'label': 'tiprack-12ml',
  'sanitizedType': 'tiprack',
  'calibrated': false
}
let instrument = {'axis': 'a'}

describe('CalibratePlaceable.vue', (done) => {
  it('renders pick_up/drop tip if placeable is tiprack', () => {
    expect(getRenderedVm(CalibratePlaceable, {
      placeable,
      instrument
    }).$el.querySelectorAll('button').length).to.equal(4)
  })

  it('does not render tip buttons if placeable is not tiprack', () => {
    let plate = placeable
    plate['sanitizedType'] = 'default'

    expect(getRenderedVm(CalibratePlaceable, {
      placeable: plate,
      instrument
    }).$el.querySelectorAll('button').length).to.equal(2)
  })
})

{'fraction_non_alphanumeric': 0.1562152133580705, 'fraction_numerical': 0.0037105751391465678, 'mean_word_length': 3.147692307692308, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '526414', 'n_tokens_mistral': 939, 'n_tokens_neox': 929, 'n_words': 198}