forked from cdek-it/react-native-ui-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.setup.ts
More file actions
27 lines (20 loc) · 679 Bytes
/
jest.setup.ts
File metadata and controls
27 lines (20 loc) · 679 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import 'jest-extended'
import 'react-native-gesture-handler/jestSetup'
import { setUpTests } from 'react-native-reanimated'
setUpTests()
generatePropsCombinations = <T>(properties: PropertyCombinations<T>): T[] => {
const keys = Object.keys(properties) as Array<keyof T>
const combine = (index: number, current: Partial<T>): T[] => {
if (index === keys.length) {
return [current as T]
}
const key = keys[index]
const values = properties[key]
const combinations: T[] = []
for (const value of values) {
combinations.push(...combine(index + 1, { ...current, [key]: value }))
}
return combinations
}
return combine(0, {})
}