@@ -11,9 +11,11 @@ describe('Idempotency', () => {
11
11
/** Enable TTL expiration simulated by removing entry instead of waiting for MongoDB TTL monitor which
12
12
runs only every 60s, so it can take up to 119s until entry removal - ain't nobody got time for that */
13
13
const SIMULATE_TTL = true ;
14
+ const applicationId = "testIdempotency" ;
15
+
14
16
// Helpers
15
17
async function deleteRequestEntry ( reqId ) {
16
- const config = Config . get ( Parse . applicationId ) ;
18
+ const config = Config . get ( applicationId ) ;
17
19
const res = await rest . find (
18
20
config ,
19
21
auth . master ( config ) ,
@@ -25,7 +27,7 @@ describe('Idempotency', () => {
25
27
}
26
28
async function setup ( options ) {
27
29
await reconfigureServer ( {
28
- appId : Parse . applicationId ,
30
+ appId : applicationId ,
29
31
masterKey : Parse . masterKey ,
30
32
serverURL : Parse . serverURL ,
31
33
idempotencyOptions : options ,
@@ -56,7 +58,7 @@ describe('Idempotency', () => {
56
58
'X-Parse-Request-Id' : 'abc-123' ,
57
59
} ,
58
60
} ;
59
- expect ( Config . get ( Parse . applicationId ) . idempotencyOptions . ttl ) . toBe ( 30 ) ;
61
+ expect ( Config . get ( applicationId ) . idempotencyOptions . ttl ) . toBe ( 30 ) ;
60
62
await request ( params ) ;
61
63
await request ( params ) . then ( fail , e => {
62
64
expect ( e . status ) . toEqual ( 400 ) ;
@@ -74,7 +76,7 @@ describe('Idempotency', () => {
74
76
method : 'POST' ,
75
77
url : 'http://localhost:8378/1/functions/myFunction' ,
76
78
headers : {
77
- 'X-Parse-Application-Id' : Parse . applicationId ,
79
+ 'X-Parse-Application-Id' : applicationId ,
78
80
'X-Parse-Master-Key' : Parse . masterKey ,
79
81
'X-Parse-Request-Id' : 'abc-123' ,
80
82
} ,
@@ -98,7 +100,7 @@ describe('Idempotency', () => {
98
100
method : 'POST' ,
99
101
url : 'http://localhost:8378/1/jobs/myJob' ,
100
102
headers : {
101
- 'X-Parse-Application-Id' : Parse . applicationId ,
103
+ 'X-Parse-Application-Id' : applicationId ,
102
104
'X-Parse-Master-Key' : Parse . masterKey ,
103
105
'X-Parse-Request-Id' : 'abc-123' ,
104
106
} ,
@@ -120,7 +122,7 @@ describe('Idempotency', () => {
120
122
method : 'POST' ,
121
123
url : 'http://localhost:8378/1/classes/MyClass' ,
122
124
headers : {
123
- 'X-Parse-Application-Id' : Parse . applicationId ,
125
+ 'X-Parse-Application-Id' : applicationId ,
124
126
'X-Parse-Master-Key' : Parse . masterKey ,
125
127
'X-Parse-Request-Id' : 'abc-123' ,
126
128
} ,
@@ -146,7 +148,7 @@ describe('Idempotency', () => {
146
148
password : 'pass' ,
147
149
} ,
148
150
headers : {
149
- 'X-Parse-Application-Id' : Parse . applicationId ,
151
+ 'X-Parse-Application-Id' : applicationId ,
150
152
'X-Parse-Master-Key' : Parse . masterKey ,
151
153
'X-Parse-Request-Id' : 'abc-123' ,
152
154
} ,
@@ -172,7 +174,7 @@ describe('Idempotency', () => {
172
174
deviceType : 'ios' ,
173
175
} ,
174
176
headers : {
175
- 'X-Parse-Application-Id' : Parse . applicationId ,
177
+ 'X-Parse-Application-Id' : applicationId ,
176
178
'X-Parse-Master-Key' : Parse . masterKey ,
177
179
'X-Parse-Request-Id' : 'abc-123' ,
178
180
} ,
@@ -195,7 +197,7 @@ describe('Idempotency', () => {
195
197
method : 'POST' ,
196
198
url : 'http://localhost:8378/1/classes/MyClass' ,
197
199
headers : {
198
- 'X-Parse-Application-Id' : Parse . applicationId ,
200
+ 'X-Parse-Application-Id' : applicationId ,
199
201
'X-Parse-Master-Key' : Parse . masterKey ,
200
202
'X-Parse-Request-Id' : uuid . v4 ( ) ,
201
203
} ,
@@ -213,7 +215,7 @@ describe('Idempotency', () => {
213
215
method : 'POST' ,
214
216
url : 'http://localhost:8378/1/functions/myFunction' ,
215
217
headers : {
216
- 'X-Parse-Application-Id' : Parse . applicationId ,
218
+ 'X-Parse-Application-Id' : applicationId ,
217
219
'X-Parse-Master-Key' : Parse . masterKey ,
218
220
'X-Parse-Request-Id' : 'abc-123' ,
219
221
} ,
@@ -226,10 +228,10 @@ describe('Idempotency', () => {
226
228
227
229
it ( 'should use default configuration when none is set' , async ( ) => {
228
230
await setup ( { } ) ;
229
- expect ( Config . get ( Parse . applicationId ) . idempotencyOptions . ttl ) . toBe (
231
+ expect ( Config . get ( applicationId ) . idempotencyOptions . ttl ) . toBe (
230
232
Definitions . IdempotencyOptions . ttl . default
231
233
) ;
232
- expect ( Config . get ( Parse . applicationId ) . idempotencyOptions . paths ) . toBe (
234
+ expect ( Config . get ( applicationId ) . idempotencyOptions . paths ) . toBe (
233
235
Definitions . IdempotencyOptions . paths . default
234
236
) ;
235
237
} ) ;
0 commit comments