about summary refs log tree commit diff
path: root/__tests__/view/lib/useAnimatedValue.test.tsx
blob: 762dcc8f26e218e0b21d9cb70eda19471815cf2d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import {renderHook} from '../../../jest/test-utils'
import {useAnimatedValue} from '../../../src/view/lib/hooks/useAnimatedValue'

describe('useAnimatedValue', () => {
  it('creates an Animated.Value with the initial value passed to the hook', () => {
    const {result} = renderHook(() => useAnimatedValue(10))
    // @ts-expect-error
    expect(result.current.__getValue()).toEqual(10)
  })

  it('returns the same Animated.Value instance on subsequent renders', () => {
    const {result, rerender} = renderHook(() => useAnimatedValue(10))
    const firstValue = result.current
    rerender({})
    expect(result.current).toBe(firstValue)
  })
})