/* eslint-disable @typescript-eslint/no-unused-vars */ import type { ViewStyle } from 'react-native'; import type { StatePath, StyleDefinition } from './branchedStyle'; const stateLevels = [['selected'], ['pressed', 'hovered'], ['highContrast']] as const; const validDefinition: StyleDefinition = { opacity: 1, selected: { pressed: { highContrast: { opacity: 0.7, }, }, highContrast: { opacity: 0.8, }, }, highContrast: { opacity: 0.9, }, }; const fullPath: StatePath = 'selected.pressed.highContrast'; const skippedLevelPath: StatePath = 'selected.highContrast'; // @ts-expect-error State paths must follow hierarchy order. const reversedPath: StatePath = 'pressed.selected'; const invalidDefinition: StyleDefinition = { pressed: { // @ts-expect-error States from the same hierarchy level cannot be nested. hovered: { opacity: 0.5, }, }, }; describe('branchedStyle types', () => { it('accepts recursive definitions and ordered paths', () => { expect(validDefinition).toBeDefined(); expect(fullPath).toBe('selected.pressed.highContrast'); expect(skippedLevelPath).toBe('selected.highContrast'); expect(invalidDefinition).toBeDefined(); }); });