import Connection from 'components/Connection/Connection'
import { FluidType } from 'enums'
import { mount } from 'enzyme'
import toJson from 'enzyme-to-json'
import React from 'react'
import { Provider } from 'react-redux'
import { createMockEcolyoStore } from 'tests/__mocks__/store'

jest.mock('components/Connection/EPGLConnect/EpglInit', () => 'mock-EpglInit')

jest.mock('components/Connection/GRDFConnect/GrdfInit', () => 'mock-GrdfInit')

describe('Connection component test', () => {
  const store = createMockEcolyoStore()
  it('should call GrdfInit', () => {
    const wrapper = mount(
      <Provider store={store}>
        <Connection fluidType={FluidType.GAS} />
      </Provider>
    )
    expect(toJson(wrapper)).toMatchSnapshot()
  })

  it('should call EpglInit', () => {
    const wrapper = mount(
      <Provider store={store}>
        <Connection fluidType={FluidType.WATER} />
      </Provider>
    )
    expect(toJson(wrapper)).toMatchSnapshot()
  })
})