69 lines
1.9 KiB
TypeScript
69 lines
1.9 KiB
TypeScript
import { TabNavigation } from './TabNavigation'
|
|
|
|
describe('TabNavigation Component', () => {
|
|
describe('Component Export', () => {
|
|
it('should be defined', () => {
|
|
expect(TabNavigation).toBeDefined()
|
|
})
|
|
|
|
it('should be a function component', () => {
|
|
expect(typeof TabNavigation).toBe('function')
|
|
})
|
|
})
|
|
|
|
describe('Props Interface', () => {
|
|
it('should accept tabs prop as string array', () => {
|
|
const props = { tabs: ['Tab1', 'Tab2', 'Tab3'] }
|
|
expect(Array.isArray(props.tabs)).toBe(true)
|
|
expect(props.tabs.length).toBe(3)
|
|
})
|
|
|
|
it('should accept activeIndex prop', () => {
|
|
const props = { activeIndex: 1 }
|
|
expect(props.activeIndex).toBe(1)
|
|
})
|
|
|
|
it('should accept onTabPress callback', () => {
|
|
const onTabPress = jest.fn()
|
|
expect(typeof onTabPress).toBe('function')
|
|
})
|
|
|
|
it('should accept showArrow optional prop', () => {
|
|
const props = { showArrow: true }
|
|
expect(props.showArrow).toBe(true)
|
|
})
|
|
|
|
it('should accept onArrowPress callback', () => {
|
|
const onArrowPress = jest.fn()
|
|
expect(typeof onArrowPress).toBe('function')
|
|
})
|
|
|
|
it('should accept isSticky optional prop', () => {
|
|
const props = { isSticky: true }
|
|
expect(props.isSticky).toBe(true)
|
|
})
|
|
|
|
it('should accept wrapperStyle optional prop', () => {
|
|
const props = { wrapperStyle: { marginTop: 10 } }
|
|
expect(props.wrapperStyle).toEqual({ marginTop: 10 })
|
|
})
|
|
|
|
it('should accept onLayout callback', () => {
|
|
const onLayout = jest.fn()
|
|
expect(typeof onLayout).toBe('function')
|
|
})
|
|
})
|
|
|
|
describe('Default Values', () => {
|
|
it('should have default showArrow value of false', () => {
|
|
const defaultShowArrow = false
|
|
expect(defaultShowArrow).toBe(false)
|
|
})
|
|
|
|
it('should have default isSticky value of false', () => {
|
|
const defaultIsSticky = false
|
|
expect(defaultIsSticky).toBe(false)
|
|
})
|
|
})
|
|
})
|