streetmix/streetmix

View on GitHub
client/src/info_bubble/DebugHoverPolygon.test.tsx

Summary

Maintainability
A
0 mins
Test Coverage
import React from 'react'

import { render } from '~/test/helpers/render'
import DebugHoverPolygon from './DebugHoverPolygon'

describe('DebugHoverPolygon', () => {
  it('renders if enabled', () => {
    const { asFragment } = render(<DebugHoverPolygon />, {
      initialState: {
        flags: {
          INFO_BUBBLE_HOVER_POLYGON: {
            value: true
          }
        },
        infoBubble: {
          hoverPolygon: [
            [1, 1],
            [2, 2],
            [3, 3]
          ]
        }
      }
    })

    expect(asFragment()).toMatchSnapshot()
  })

  it('renders nothing if disabled', () => {
    const { container } = render(<DebugHoverPolygon />, {
      initialState: {
        flags: {
          INFO_BUBBLE_HOVER_POLYGON: {
            value: false
          }
        }
      }
    })

    expect(container.firstChild).toBe(null)
  })
})