-
Notifications
You must be signed in to change notification settings - Fork 16
/
jest_data_driven.javascript.txt
26 lines (19 loc) · 2.04 KB
/
jest_data_driven.javascript.txt
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
JEST_DATA_DRIVEN
ALTERNATIVES ==> #See testcheck
VERSION ==> #Part of Jest monorepo (see its doc), package 'jest-jasmine2'
#Data-driven testing
describe|it|test.each #Calls FUNC() with each VAL|ARR
(VAL_ARR|ARR_ARR) #'TEST_TITLE' can use VAL,... as data with either:
('TEST_TITLE', FUNC(VAL,...)) # - UTIL.format() placeholders, and also:
# - %#: current array index
# - $VAR: OBJ.VAR
# - $VARR
#ARR_ARR is like VAR_ARR, but firing several VAL,...
# - linear iteration, not Cartesian product
describe|it|test.each(`...`) #Calls FUNC() with each OBJ
('TEST_TITLE', FUNC({ VAR, ...}))#`...` is tagged template with:
# VAR|VAR2|... (header row: names)
# VAL|VAL2|... (other rows: data)
#Whitespaces are ignored