rofrischmann/fela

View on GitHub
packages/fela-bindings/src/__tests__/extractUsedProps-test.js

Summary

Maintainability
A
0 mins
Test Coverage
import extractUsedProps from '../extractUsedProps'

describe('Extracting used props', () => {
  it('should return used props', () => {
    expect(
      extractUsedProps((props) => ({
        foo: props.foo,
        bar: props.bar,
      }))
    ).toEqual(['foo', 'bar'])
  })

  it('should return an empty array if the rule throws an exception', () => {
    expect(
      extractUsedProps(() => {
        throw new Error('test')
      })
    ).toEqual([])
  })
})