Skip to content
Snippets Groups Projects
Connection.spec.tsx 977 B
Newer Older
  • Learn to ignore specific revisions
  • 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', () => {
    
    Bastien DUMONT's avatar
    Bastien DUMONT committed
      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()
      })
    })