11local apid = import 'apid/apid.libsonnet' ;
2- local is = import 'apid/is.libsonnet' ;
2+ local _ = import 'apid/is.libsonnet' ;
33
44local vars = import 'vars.libsonnet' ;
55
@@ -38,12 +38,15 @@ local steps(method, body, expected) = [
3838 for body in [vars.json]
3939 for expected in [
4040 {
41- 'random float' : is.float(66.861 ),
42- [is.key.string('random' )]: is.int(88 ),
43- [is.key.regex('first\\ w+' )]: 'Lilith' ,
44- Stephanie: {
41+ 'random float' : _.float(66.861 ),
42+ [_.key.string('random' )]: _.int(88 ),
43+ [_.key.regex('first\\ w+' )]: 'Lilith' ,
44+ [_.key.or([
45+ _.string("Stephanie" ),
46+ _.len(9 )
47+ ])]: {
4548 age: 93 ,
46- address: is .json({
49+ address: _ .json({
4750 city: 'Kobe' ,
4851 country: 'Australia' ,
4952 countryCode: 'VE' ,
@@ -53,126 +56,12 @@ local steps(method, body, expected) = [
5356 'Marline' ,
5457 'Catharine' ,
5558 ],
56- countryCode: is.len(2 ),
59+ countryCode: _.and(
60+ [
61+ _.len(2 ),
62+ _.string('VE' )
63+ ]
64+ )
5765 },
5866 ]
59- }
60- // + {
61- // ['string-%s-%s-%s' % [method, 'body', expected]]: json_body_spec(method, body, expected)
62- // for method in ['POST', 'PUT', 'PATCH', 'DELETE']
63- // for body in [vars.json]
64- // for expected in [
65- // [
66- // {
67- // selector: 'firstname',
68- // is: 'Lilith',
69- // },
70- // ],
71- // ]
72- // } + {
73- // ['json-%s-%s-%s' % [method, 'body', expected]]: json_body_spec(method, body, expected)
74- // for method in ['POST', 'PUT', 'PATCH', 'DELETE']
75- // for body in [vars.json]
76- // for expected in [
77- // [
78- // {
79- // selector: 'Stephanie',
80- // is: {
81- // age: 93,
82- // },
83- // },
84- // ],
85- // ]
86- // } + {
87- // ['array-%s-%s-%s' % [method, 'body', expected]]: json_body_spec(method, body, expected)
88- // for method in ['POST', 'PUT', 'PATCH', 'DELETE']
89- // for body in [vars.json]
90- // for expected in [
91- // [
92- // {
93- // selector: 'array of objects',
94- // is: [
95- // {
96- // index: 0,
97- // 'index start at 5': 5,
98- // },
99- // {
100- // index: 1,
101- // 'index start at 5': 6,
102- // },
103- // {
104- // index: 2,
105- // 'index start at 5': 7,
106- // },
107- // ],
108- // },
109- // ],
110- // ]
111- // } + {
112- // ['unordered-array-%s-%s-%s' % [method, 'body', expected]]: json_body_spec(method, body, expected)
113- // for method in ['POST', 'PUT', 'PATCH', 'DELETE']
114- // for body in [vars.json]
115- // for expected in [
116- // [
117- // {
118- // selector: 'array of objects',
119- // is: [
120- // {
121- // index: 2,
122- // 'index start at 5': 7,
123- // },
124- // {
125- // index: 0,
126- // 'index start at 5': 5,
127- // },
128- // {
129- // index: 1,
130- // 'index start at 5': 6,
131- // },
132- // ],
133- // },
134- // ],
135- // ]
136- // } + {
137- // ['array-index-array-%s-%s-%s' % [method, 'body', expected]]: json_body_spec(method, body, expected)
138- // for method in ['POST', 'PUT', 'PATCH', 'DELETE']
139- // for body in [vars.json]
140- // for expected in [
141- // [
142- // {
143- // selector: 'array of objects.1',
144- // is: {
145- // index: 1,
146- // 'index start at 5': 6,
147- // },
148- // },
149- // ],
150- // ]
151- // } + {
152- // ['regex-simple-%s-%s-%s' % [method, 'body', expected]]: json_body_spec(method, body, expected)
153- // for method in ['POST', 'PUT', 'PATCH', 'DELETE']
154- // for body in [vars.json]
155- // for expected in [
156- // [
157- // {
158- // selector: 'regEx',
159- // is: 'hello+ to you',
160- // },
161- // ],
162- // ]
163- // } + {
164- // ['regex-email-%s-%s-%s' % [method, 'body', expected]]: json_body_spec(method, body, expected)
165- // for method in ['POST', 'PUT', 'PATCH', 'DELETE']
166- // for body in [vars.json]
167- // for expected in [
168- // [
169- // {
170- // selector: 'email uses current data',
171- // is: '^\\S+@\\S+\\.\\S+$',
172- // },
173- // ],
174- // ]
175- // }
176-
177-
178-
67+ }
0 commit comments