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 layout_machines } from '@/store/modules/layout_machines';

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

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

    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)
  })
})