import {test, describe, expect, vi} from 'vitest'
import { shallowMount } from '@vue/test-utils'
import VChart from '@molecules/VChart/VChart.vue';
import { createStore } from 'vuex';
import { store as layoutMachines } from '@/store/modules/layoutMachines';

describe('VChart', () => {
  test('VChart mounted', () => {

    const store = createStore({
      modules: {
        layoutMachines
      }
    })

    vi.mock('@store/hooks/Echarts', () => {

      const html = vi.fn(() => {
        return {
          getHtml: () => {
            return '<div>test</div>'
          },
          onClickedBarCharts: vi.fn()
        }
      })

      return {
        __esModule: true,
        ECharts: html
      }
    })

    const wrapper = shallowMount(VChart, {
      props: {
        id: "",
        type: "bar",
      },
      global: {
        mocks: {
          $store: store
        }
      }
    })
    expect(wrapper.exists()).toBe(true)
  })
})