text: // Copyright 2020 [LIPM]
  // Licensed under the Apache License, Version 2.0 (the "License");
  // you may not use this file except in compliance with the License.
  // You may obtain a copy of the License at
  
  // http://www.apache.org/licenses/LICENSE-2.0
  
  // Unless required by applicable law or agreed to in writing, software
  // distributed under the License is distributed on an "AS IS" BASIS,
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  // See the License for the specific language governing permissions and
  //    limitations under the License.
  import { shallowMount } from '@vue/test-utils'
  import PieNode from '@/components/pieNode'
  
  const validator = PieNode.props.data.validator
  
  describe('PieNode component', () => {
    it('does not render if no data', () => {
      const comp = shallowMount(PieNode, {
        propsData: {
        }
      })
  
      expect(comp.element).toMatchSnapshot()
    })
    it('data set correctly', () => {
      const comp = shallowMount(PieNode, {
        propsData: {
          data: [{ value: 10, color: 'green', label: 'value 1' }]
        }
      })
  
      expect(comp.element).toMatchSnapshot()
    })
    it('error when value key not set', () => {
      expect(validator([{ color: 'green', label: 'value 1' }])).toBe(false)
    })
    it('error when color key not set', () => {
      expect(validator([{ value: 10, label: 'value 1' }])).toBe(false)
    })
    it('error when label key not set', () => {
      expect(validator([{ color: 'green', value: 10 }])).toBe(false)
    })
    it('error when value key is not a number', () => {
      expect(validator([{ value: 'tuc', color: 'green', label: 'value 1' }])).toBe(false)
    })
    it('size set correctly', () => {
      const comp = shallowMount(PieNode, {
        propsData: {
          data: [{ value: 10, color: 'green', label: 'value 1' }],
          size: 1
        }
      })
  
      expect(comp.element).toMatchSnapshot()
    })
    it('x set correctly', () => {
      const comp = shallowMount(PieNode, {
        propsData: {
          data: [{ value: 10, color: 'green', label: 'value 1' }],
          x: 1
        }
      })
  
      expect(comp.element).toMatchSnapshot()
    })
    it('y set correctly', () => {
      const comp = shallowMount(PieNode, {
        propsData: {
          data: [{ value: 10, color: 'green', label: 'value 1' }],
          y: 1
        }
      })
  
      expect(comp.element).toMatchSnapshot()
    })
    it('circular mode set correctly', () => {
      const comp = shallowMount(PieNode, {
        propsData: {
          data: [{ value: 10, color: 'green', label: 'value 1' }],
          circular: true
        }
      })
  
      expect(comp.element).toMatchSnapshot()
    })
  })
  