add unit tests to action radius select

This commit is contained in:
mahula 2023-04-25 15:19:00 +02:00
parent 4e76f0c712
commit 28e92c25b7

View File

@ -0,0 +1,37 @@
import { shallowMount } from '@vue/test-utils'
import ActionRadiusSelect from './ActionRadiusSelect'
const localVue = global.localVue
const propsData = { value: 'regional' }
describe('ActionRadiusSelect.', () => {
let wrapper
let mocks
beforeEach(() => {
mocks = {
$t: jest.fn(),
}
})
describe('mount', () => {
const Wrapper = () => {
return shallowMount(ActionRadiusSelect, { propsData, mocks, localVue })
}
beforeEach(() => {
wrapper = Wrapper()
})
it('renders the select', () => {
expect(wrapper.findComponent(ActionRadiusSelect).exists()).toBe(true)
})
describe('when an option is selected', () => {
it('emits a change event with the new value', () => {
const select = wrapper.find('select')
select.trigger('change')
expect(wrapper.emitted().change[0]).toEqual(['regional'])
})
})
})
})