@@ -51,12 +51,10 @@ describe_only_db('mongo')('Idempotency', () => {
51
51
} ) ;
52
52
// Tests
53
53
it ( 'should enforce idempotency for cloud code function' , async ( ) => {
54
- // Declare function
55
54
let counter = 0 ;
56
55
Parse . Cloud . define ( 'myFunction' , ( ) => {
57
56
counter ++ ;
58
57
} ) ;
59
- // Run function
60
58
const params = {
61
59
method : 'POST' ,
62
60
url : 'http://localhost:8378/1/functions/myFunction' ,
@@ -76,12 +74,10 @@ describe_only_db('mongo')('Idempotency', () => {
76
74
} ) ;
77
75
78
76
it ( 'should delete request entry after TTL' , async ( ) => {
79
- // Declare function
80
77
let counter = 0 ;
81
78
Parse . Cloud . define ( 'myFunction' , ( ) => {
82
79
counter ++ ;
83
80
} ) ;
84
- // Run function
85
81
const params = {
86
82
method : 'POST' ,
87
83
url : 'http://localhost:8378/1/functions/myFunction' ,
@@ -102,12 +98,10 @@ describe_only_db('mongo')('Idempotency', () => {
102
98
} ) ;
103
99
104
100
it ( 'should enforce idempotency for cloud code jobs' , async ( ) => {
105
- // Declare job
106
101
let counter = 0 ;
107
102
Parse . Cloud . job ( 'myJob' , ( ) => {
108
103
counter ++ ;
109
104
} ) ;
110
- // Run job
111
105
const params = {
112
106
method : 'POST' ,
113
107
url : 'http://localhost:8378/1/jobs/myJob' ,
@@ -126,12 +120,10 @@ describe_only_db('mongo')('Idempotency', () => {
126
120
} ) ;
127
121
128
122
it ( 'should enforce idempotency for class object creation' , async ( ) => {
129
- // Declare trigger
130
123
let counter = 0 ;
131
124
Parse . Cloud . afterSave ( 'MyClass' , ( ) => {
132
125
counter ++ ;
133
126
} ) ;
134
- // Create object
135
127
const params = {
136
128
method : 'POST' ,
137
129
url : 'http://localhost:8378/1/classes/MyClass' ,
@@ -150,12 +142,10 @@ describe_only_db('mongo')('Idempotency', () => {
150
142
} ) ;
151
143
152
144
it ( 'should enforce idempotency for user object creation' , async ( ) => {
153
- // Declare trigger
154
145
let counter = 0 ;
155
146
Parse . Cloud . afterSave ( '_User' , ( ) => {
156
147
counter ++ ;
157
148
} ) ;
158
- // Create object
159
149
const params = {
160
150
method : 'POST' ,
161
151
url : 'http://localhost:8378/1/users' ,
@@ -178,12 +168,10 @@ describe_only_db('mongo')('Idempotency', () => {
178
168
} ) ;
179
169
180
170
it ( 'should enforce idempotency for installation object creation' , async ( ) => {
181
- // Declare trigger
182
171
let counter = 0 ;
183
172
Parse . Cloud . afterSave ( '_Installation' , ( ) => {
184
173
counter ++ ;
185
174
} ) ;
186
- // Create object
187
175
const params = {
188
176
method : 'POST' ,
189
177
url : 'http://localhost:8378/1/installations' ,
@@ -206,12 +194,10 @@ describe_only_db('mongo')('Idempotency', () => {
206
194
} ) ;
207
195
208
196
it ( 'should not interfere with calls of different request ID' , async ( ) => {
209
- // Declare trigger
210
197
let counter = 0 ;
211
198
Parse . Cloud . afterSave ( 'MyClass' , ( ) => {
212
199
counter ++ ;
213
200
} ) ;
214
- // Create 100 objects
215
201
const promises = [ ...Array ( 100 ) . keys ( ) ] . map ( ( ) => {
216
202
const params = {
217
203
method : 'POST' ,
@@ -247,14 +233,12 @@ describe_only_db('mongo')('Idempotency', () => {
247
233
} ) ;
248
234
249
235
it ( 'should use default configuration when none is set' , async ( ) => {
250
- // Configure server with minimal params
251
236
await setup ( { } ) ;
252
237
expect ( Config . get ( Parse . applicationId ) . idempotencyOptions . ttl ) . toBe ( Definitions . IdempotencyOptions . ttl . default ) ;
253
238
expect ( Config . get ( Parse . applicationId ) . idempotencyOptions . paths ) . toBe ( Definitions . IdempotencyOptions . paths . default ) ;
254
239
} ) ;
255
240
256
241
it ( 'should throw on invalid configuration' , async ( ) => {
257
- // Configure server with invalid params
258
242
await expectAsync ( setup ( { paths : 1 } ) ) . toBeRejected ( ) ;
259
243
await expectAsync ( setup ( { ttl : 'a' } ) ) . toBeRejected ( ) ;
260
244
await expectAsync ( setup ( { ttl : 0 } ) ) . toBeRejected ( ) ;
0 commit comments