-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbasic.feature
113 lines (105 loc) · 2.32 KB
/
basic.feature
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
Feature: Basic Features for lodash-match-pattern
Background:
Given I have a basic user
Scenario: The user object matches a copy of itself.
Then the user matches the pattern
"""
{
id: 43,
email: 'joe@matchapattern.org',
website: 'http://matchapattern.org',
firstName: 'Joe',
lastName: 'Matcher',
phone: '(333) 444-5555',
createDate: '2016-05-22T00:23:23.343Z',
tvshows: [
'Match Game',
'Sopranos',
'House of Cards'
],
mother: {
id: 23,
email: 'mom@aol.com'
},
friends: [
{id: 21, email: 'pat@mp.co', active: true},
{id: 89, email: 'gerri@mp.co', active: false},
{id: 14, email: 'kim@mp.co', active: true}
]
}
"""
Scenario: The user object matches its property types.
Then the user matches the pattern
"""
{
# Note that embedded comments are also allowed on whole line
id: _.isInteger, # ... or end of line
email: _.isEmail,
website: _.isUrl,
firstName: /[A-Z]\w+/,
lastName: /[a-z]/i,
phone: /\(\d{3}\)\s*\d{3}[- ]\d{4}/,
createDate: _.isDateString,
tvshows: [
_.isString,
_.isString,
_.isString
],
mother: _.isObject,
friends: _.isArray
}
"""
Scenario: Partial match example -- change the user email
Given I change the email to "billyjoe@duckduck.go"
Then the user matches the pattern
"""
{
id: _.isInteger,
email: 'billyjoe@duckduck.go'
...
}
"""
Scenario: Partial match of array
Then the user matches the pattern
"""
{
tvshows: [
'House of Cards',
'Sopranos'
...
]
...
}
"""
Scenario: Superset match of array
Then the user matches the pattern
"""
{
tvshows: [
'House of Cards',
'Match Game',
'Sopranos',
"Grey's Anatomy"
^^^
]
...
}
"""
Scenario: Omit the password
Then the user matches the pattern
"""
{
id: 43,
password: _.isOmitted
...
}
"""
Scenario: Use parameters in a matcher
Then the user matches the pattern
"""
{
id: _.isBetween|42.9|43.1,
tvshows: _.isContainerFor|'House of Cards',
...
}
"""