import { shallowMount } from '@vue/test-utils'
import Vuetify from 'vuetify'
import SubHeader from '~/components/Layout/Subheader'

let wrapper
let vuetify
beforeEach(() => {
  vuetify = new Vuetify()
  wrapper = shallowMount(SubHeader, {
    stubs: [
      'LayoutSubHeaderBreadcrumbs',
      'LayoutSubHeaderActivityYear',
      'LayoutSubHeaderDataTiming',
      'LayoutSubHeaderDataTimingRange',
      'LayoutSubHeaderPersonnalizedList'
    ],
    vuetify
  })
})

describe('LayoutSubHeaderActivityYear', () => {
  it('should display by default', async () => {
    expect(wrapper.find('.activity-year').exists()).toBeTruthy()
  })

  it('should hide if showDateTimeRange is truthy', async () => {
    await wrapper.setData({ showDateTimeRange: true })
    expect(wrapper.find('.activity-year').exists()).toBeFalsy()
  })
})

describe('LayoutSubHeaderDataTiming', () => {
  it('should display by default', async () => {
    expect(wrapper.find('.data-timing').exists()).toBeTruthy()
  })

  it('should hide if showDateTimeRange is truthy', async () => {
    await wrapper.setData({ showDateTimeRange: true })
    expect(wrapper.find('.data-timing').exists()).toBeFalsy()
  })
})
