1
1
/* eslint-disable max-lines */
2
2
/* eslint-disable max-statements */
3
- import Parse from 'parse/node' ;
4
3
import axios from 'axios' ;
4
+ import Parse from 'parse/node' ;
5
5
import qs from 'qs' ;
6
- import { bindAll } from './helper' ;
6
+
7
7
import config from './__mock__/config' ;
8
+ import { bindAll } from './helper' ;
8
9
9
10
const { API_URL , PARSE_APP_ID } = config ;
10
11
@@ -180,7 +181,7 @@ describe('Parse server', () => {
180
181
181
182
// simulate confirmation by the app's backend
182
183
const { data } = await axios . post (
183
- API_URL + ' /oauth/token' ,
184
+ ` ${ API_URL } /oauth/token` ,
184
185
qs . stringify ( {
185
186
client_id : fromApp . publicKey ,
186
187
client_secret : fromApp . secretKey ,
@@ -228,15 +229,15 @@ describe('Parse server', () => {
228
229
} ) ;
229
230
230
231
it ( 'GET the user id associated to the accessToken' , async ( ) => {
231
- const { data } = await axios . get ( API_URL + ' /oauth/user' , {
232
- headers : { Authorization : ' Bearer ' + accessToken . access_token } ,
232
+ const { data } = await axios . get ( ` ${ API_URL } /oauth/user` , {
233
+ headers : { Authorization : ` Bearer ${ accessToken . access_token } ` } ,
233
234
} ) ;
234
235
expect ( data . id ) . toBe ( endUserUserId ) ;
235
236
} ) ;
236
237
237
238
it ( 'GET valid OAuth refreshToken' , async ( ) => {
238
239
const { data } = await axios . post (
239
- API_URL + ' /oauth/token' ,
240
+ ` ${ API_URL } /oauth/token` ,
240
241
qs . stringify ( {
241
242
client_id : application . publicKey ,
242
243
client_secret : application . secretKey ,
@@ -294,8 +295,8 @@ describe('Parse server', () => {
294
295
application2 ,
295
296
) ;
296
297
297
- const { data } = await axios . get ( API_URL + ' /oauth/user' , {
298
- headers : { Authorization : ' Bearer ' + token } ,
298
+ const { data } = await axios . get ( ` ${ API_URL } /oauth/user` , {
299
+ headers : { Authorization : ` Bearer ${ token } ` } ,
299
300
} ) ;
300
301
expect ( data . id ) . toBe ( endUserUserId ) ;
301
302
} ) ;
@@ -310,7 +311,7 @@ describe('Parse server', () => {
310
311
headers : {
311
312
'Content-Type' : 'application/json' ,
312
313
'x-parse-application-id' : PARSE_APP_ID ,
313
- Authorization : ' Bearer ' + accessToken . access_token ,
314
+ Authorization : ` Bearer ${ accessToken . access_token } ` ,
314
315
} ,
315
316
data : { score : 1337 , playerName : 'test9' , cheatMode : false } ,
316
317
} ) ;
@@ -341,7 +342,7 @@ describe('Parse server', () => {
341
342
headers : {
342
343
'Content-Type' : 'application/json' ,
343
344
'x-parse-application-id' : PARSE_APP_ID ,
344
- Authorization : ' Bearer ' + accessToken . access_token ,
345
+ Authorization : ` Bearer ${ accessToken . access_token } ` ,
345
346
} ,
346
347
data : {
347
348
requests : [
@@ -371,7 +372,7 @@ describe('Parse server', () => {
371
372
headers : {
372
373
'Content-Type' : 'application/json' ,
373
374
'x-parse-application-id' : PARSE_APP_ID ,
374
- Authorization : ' Bearer ' + accessToken . access_token ,
375
+ Authorization : ` Bearer ${ accessToken . access_token } ` ,
375
376
} ,
376
377
} ) ;
377
378
expect ( data ) . toEqual ( gameScoreObject ) ;
@@ -384,7 +385,7 @@ describe('Parse server', () => {
384
385
headers : {
385
386
'Content-Type' : 'application/json' ,
386
387
'x-parse-application-id' : PARSE_APP_ID ,
387
- Authorization : ' Bearer ' + accessToken . access_token ,
388
+ Authorization : ` Bearer ${ accessToken . access_token } ` ,
388
389
} ,
389
390
} ) ;
390
391
@@ -398,7 +399,7 @@ describe('Parse server', () => {
398
399
headers : {
399
400
'Content-Type' : 'application/json' ,
400
401
'x-parse-application-id' : PARSE_APP_ID ,
401
- Authorization : ' Bearer ' + accessToken . access_token ,
402
+ Authorization : ` Bearer ${ accessToken . access_token } ` ,
402
403
} ,
403
404
data : {
404
405
count : 1 ,
@@ -472,7 +473,7 @@ describe('Parse server', () => {
472
473
headers : {
473
474
'Content-Type' : 'application/json' ,
474
475
'x-parse-application-id' : PARSE_APP_ID ,
475
- Authorization : ' Bearer ' + accessToken . access_token ,
476
+ Authorization : ` Bearer ${ accessToken . access_token } ` ,
476
477
} ,
477
478
data : {
478
479
requests : requestArray ,
@@ -492,7 +493,7 @@ describe('Parse server', () => {
492
493
headers : {
493
494
'Content-Type' : 'application/json' ,
494
495
'x-parse-application-id' : PARSE_APP_ID ,
495
- Authorization : ' Bearer ' + accessToken . access_token ,
496
+ Authorization : ` Bearer ${ accessToken . access_token } ` ,
496
497
'x-is-sandbox' : true
497
498
} ,
498
499
data : { score : 1339 , playerName : 'test0' , cheatMode : true } ,
@@ -524,7 +525,7 @@ describe('Parse server', () => {
524
525
headers : {
525
526
'Content-Type' : 'application/json' ,
526
527
'x-parse-application-id' : PARSE_APP_ID ,
527
- Authorization : ' Bearer ' + accessToken . access_token ,
528
+ Authorization : ` Bearer ${ accessToken . access_token } ` ,
528
529
'x-is-sandbox' : true
529
530
} ,
530
531
data : {
@@ -561,7 +562,7 @@ describe('Parse server', () => {
561
562
headers : {
562
563
'Content-Type' : 'application/json' ,
563
564
'x-parse-application-id' : PARSE_APP_ID ,
564
- Authorization : ' Bearer ' + accessToken . access_token ,
565
+ Authorization : ` Bearer ${ accessToken . access_token } ` ,
565
566
'x-is-sandbox' : true
566
567
} ,
567
568
} ) ;
@@ -575,7 +576,7 @@ describe('Parse server', () => {
575
576
headers : {
576
577
'Content-Type' : 'application/json' ,
577
578
'x-parse-application-id' : PARSE_APP_ID ,
578
- Authorization : ' Bearer ' + accessToken . access_token ,
579
+ Authorization : ` Bearer ${ accessToken . access_token } ` ,
579
580
'x-is-sandbox' : true
580
581
} ,
581
582
} ) ;
@@ -607,7 +608,7 @@ describe('Parse server', () => {
607
608
headers : {
608
609
'Content-Type' : 'application/json' ,
609
610
'x-parse-application-id' : PARSE_APP_ID ,
610
- Authorization : ' Bearer ' + accessToken . access_token
611
+ Authorization : ` Bearer ${ accessToken . access_token } `
611
612
} ,
612
613
} ) ;
613
614
} catch ( err ) {
@@ -626,7 +627,7 @@ describe('Parse server', () => {
626
627
headers : {
627
628
'Content-Type' : 'application/json' ,
628
629
'x-parse-application-id' : PARSE_APP_ID ,
629
- Authorization : ' Bearer ' + accessToken . access_token ,
630
+ Authorization : ` Bearer ${ accessToken . access_token } ` ,
630
631
'x-is-sandbox' : true
631
632
} ,
632
633
} ) ;
@@ -644,7 +645,7 @@ describe('Parse server', () => {
644
645
headers : {
645
646
'Content-Type' : 'application/json' ,
646
647
'x-parse-application-id' : PARSE_APP_ID ,
647
- Authorization : ' Bearer ' + accessToken . access_token ,
648
+ Authorization : ` Bearer ${ accessToken . access_token } ` ,
648
649
'x-is-sandbox' : true
649
650
} ,
650
651
} ) ;
@@ -659,7 +660,7 @@ describe('Parse server', () => {
659
660
headers : {
660
661
'Content-Type' : 'application/json' ,
661
662
'x-parse-application-id' : PARSE_APP_ID ,
662
- Authorization : ' Bearer ' + accessToken . access_token ,
663
+ Authorization : ` Bearer ${ accessToken . access_token } ` ,
663
664
} ,
664
665
data : { score : 1338 , cheatMode : true } ,
665
666
} ) ;
@@ -690,7 +691,7 @@ describe('Parse server', () => {
690
691
headers : {
691
692
'Content-Type' : 'application/json' ,
692
693
'x-parse-application-id' : PARSE_APP_ID ,
693
- Authorization : ' Bearer ' + accessTokenApp2 . access_token ,
694
+ Authorization : ` Bearer ${ accessTokenApp2 . access_token } ` ,
694
695
} ,
695
696
data : { score : 1338 , cheatMode : true } ,
696
697
} ) ;
@@ -815,7 +816,7 @@ describe('Parse server', () => {
815
816
headers : {
816
817
'Content-Type' : 'application/json' ,
817
818
'x-parse-application-id' : PARSE_APP_ID ,
818
- Authorization : ' Bearer ' + accessTokenApp2 . access_token ,
819
+ Authorization : ` Bearer ${ accessTokenApp2 . access_token } ` ,
819
820
}
820
821
} ) ;
821
822
} catch ( err ) {
@@ -830,7 +831,7 @@ describe('Parse server', () => {
830
831
headers : {
831
832
'Content-Type' : 'application/json' ,
832
833
'x-parse-application-id' : PARSE_APP_ID ,
833
- Authorization : ' Bearer ' + accessToken . access_token ,
834
+ Authorization : ` Bearer ${ accessToken . access_token } ` ,
834
835
} ,
835
836
} ) ;
836
837
0 commit comments