Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions apps/mobile/__tests__/animations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,17 @@ describe('Animation Functions', () => {
expect(result).toEqual({ type: 'spring', val: 50, config: SpringPresets.gentle });
});
});

describe('fadeInDelayed', () => {
test('should call withDelay and withTiming with correct parameters', () => {
const targetValue = 1;
const delayMs = 300;

fadeInDelayed(targetValue, delayMs);

expect(withTiming).toHaveBeenCalledWith(targetValue, TimingPresets.normal);
// withTiming mock returns the value itself, so withDelay gets the targetValue as second arg
expect(withDelay).toHaveBeenCalledWith(delayMs, targetValue);
});
});
});
12 changes: 10 additions & 2 deletions apps/mobile/jest.setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@ jest.mock('react-native-reanimated', () => {
return {
useSharedValue: jest.fn(() => ({ value: 0 })),
useAnimatedStyle: jest.fn(() => ({})),
withSpring: jest.fn((val) => val),
withTiming: jest.fn((val) => val),
withSpring: jest.fn((val, config) => val),
withTiming: jest.fn((val, config) => val),
withDelay: jest.fn((delay, val) => val),
withSequence: jest.fn((...args) => args),
Easing: {
out: jest.fn((val) => val),
inOut: jest.fn((val) => val),
quad: 'quad',
cubic: 'cubic',
},
createAnimatedComponent: jest.fn((Component) => Component),
default: {
View: 'View',
Expand Down
Loading