Address.spec.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { mount } from '@vue/test-utils'
  2. import Vuetify from 'vuetify'
  3. import Address from '~/components/Ui/Search/Address'
  4. import response from '~/tests/unit/component/Ui/Search/fixtures/response'
  5. global.fetch = jest.fn(() =>
  6. Promise.resolve({
  7. json: () => Promise.resolve(
  8. response
  9. )
  10. })
  11. )
  12. let wrapper
  13. let vuetify
  14. beforeEach(() => {
  15. vuetify = new Vuetify()
  16. fetch.mockClear()
  17. })
  18. describe('components/ui/search/address', () => {
  19. it('an input of 1+ cars shall display results', async () => {
  20. wrapper = mount(Address, {
  21. vuetify
  22. })
  23. const addressSearchBar = wrapper.find('.v-autocomplete')
  24. // addressSearchBar.element.search = 'paris'
  25. // await addressSearchBar.trigger('click')
  26. addressSearchBar.find('input[type="text"]').setValue('paris')
  27. const resultsList = wrapper.find('v-autocomplete__content')
  28. expect(resultsList.exists()).toBeTruthy()
  29. expect(resultsList.find('div:contains("Paris")').exists()).toBeTruthy()
  30. })
  31. it('position shall be set when a result is clicked', async () => {})
  32. it('position shall be cleared when input is cleared', async () => {})
  33. it('first result shall be selected when enter key is pressed', async () => {})
  34. it('user position shall be set when localize icon is clicked', async () => {})
  35. it('error message shall be displayed if the browser does not support localization', async () => {})
  36. })