@@ -232,7 +232,7 @@ describe('ParseLiveQueryServer', function () {
232
232
classNames : [ 'Yolo' ] ,
233
233
} ,
234
234
} )
235
- . then ( parseServer => {
235
+ . then ( ( parseServer ) => {
236
236
saveSpy = spyOn ( parseServer . config . liveQueryController , 'onAfterSave' ) ;
237
237
deleteSpy = spyOn (
238
238
parseServer . config . liveQueryController ,
@@ -247,7 +247,7 @@ describe('ParseLiveQueryServer', function () {
247
247
const obj = new Parse . Object ( 'Yolo' ) ;
248
248
return obj . save ( ) ;
249
249
} )
250
- . then ( obj => {
250
+ . then ( ( obj ) => {
251
251
return obj . destroy ( ) ;
252
252
} )
253
253
. then ( ( ) => {
@@ -307,52 +307,6 @@ describe('ParseLiveQueryServer', function () {
307
307
expect ( client . pushConnect ) . toHaveBeenCalled ( ) ;
308
308
} ) ;
309
309
310
- it ( 'basic beforeConnect rejection' , async ( ) => {
311
- Parse . Cloud . beforeConnect ( function ( ) {
312
- throw new Error ( 'You shall not pass!' ) ;
313
- } ) ;
314
- const parseLiveQueryServer = new ParseLiveQueryServer ( { } ) ;
315
- const parseWebSocket = {
316
- clientId : - 1 ,
317
- } ;
318
- await parseLiveQueryServer . _handleConnect ( parseWebSocket , {
319
- sessionToken : 'token' ,
320
- } ) ;
321
- expect ( parseLiveQueryServer . clients . size ) . toBe ( 0 ) ;
322
- const Client = require ( '../lib/LiveQuery/Client' ) . Client ;
323
- expect ( Client . pushError ) . toHaveBeenCalled ( ) ;
324
- } ) ;
325
-
326
- it ( 'basic beforeSubscribe rejection' , async ( ) => {
327
- Parse . Cloud . beforeSubscribe ( 'test' , function ( ) {
328
- throw new Error ( 'You shall not pass!' ) ;
329
- } ) ;
330
- const parseLiveQueryServer = new ParseLiveQueryServer ( { } ) ;
331
- const parseWebSocket = {
332
- clientId : - 1 ,
333
- } ;
334
- await parseLiveQueryServer . _handleConnect ( parseWebSocket , {
335
- sessionToken : 'token' ,
336
- } ) ;
337
- const query = {
338
- className : 'test' ,
339
- where : {
340
- key : 'value' ,
341
- } ,
342
- fields : [ 'test' ] ,
343
- } ;
344
- const requestId = 2 ;
345
- const request = {
346
- query : query ,
347
- requestId : requestId ,
348
- sessionToken : 'sessionToken' ,
349
- } ;
350
- await parseLiveQueryServer . _handleSubscribe ( parseWebSocket , request ) ;
351
- expect ( parseLiveQueryServer . clients . size ) . toBe ( 1 ) ;
352
- const Client = require ( '../lib/LiveQuery/Client' ) . Client ;
353
- expect ( Client . pushError ) . toHaveBeenCalled ( ) ;
354
- } ) ;
355
-
356
310
it ( 'can handle subscribe command without clientId' , async ( ) => {
357
311
const parseLiveQueryServer = new ParseLiveQueryServer ( { } ) ;
358
312
const incompleteParseConn = { } ;
@@ -775,7 +729,7 @@ describe('ParseLiveQueryServer', function () {
775
729
expect ( client . pushDelete ) . not . toHaveBeenCalled ( ) ;
776
730
} ) ;
777
731
778
- it ( 'can handle object delete command which matches some subscriptions' , async done => {
732
+ it ( 'can handle object delete command which matches some subscriptions' , async ( done ) => {
779
733
const parseLiveQueryServer = new ParseLiveQueryServer ( { } ) ;
780
734
// Make deletedParseObject
781
735
const parseObject = new Parse . Object ( testClassName ) ;
@@ -819,7 +773,7 @@ describe('ParseLiveQueryServer', function () {
819
773
parseLiveQueryServer . _onAfterSave ( message ) ;
820
774
} ) ;
821
775
822
- it ( 'can handle object save command which does not match any subscription' , async done => {
776
+ it ( 'can handle object save command which does not match any subscription' , async ( done ) => {
823
777
const parseLiveQueryServer = new ParseLiveQueryServer ( { } ) ;
824
778
// Make mock request message
825
779
const message = generateMockMessage ( ) ;
@@ -850,7 +804,7 @@ describe('ParseLiveQueryServer', function () {
850
804
} , jasmine . ASYNC_TEST_WAIT_TIME ) ;
851
805
} ) ;
852
806
853
- it ( 'can handle object enter command which matches some subscriptions' , async done => {
807
+ it ( 'can handle object enter command which matches some subscriptions' , async ( done ) => {
854
808
const parseLiveQueryServer = new ParseLiveQueryServer ( { } ) ;
855
809
// Make mock request message
856
810
const message = generateMockMessage ( true ) ;
@@ -887,7 +841,7 @@ describe('ParseLiveQueryServer', function () {
887
841
} , jasmine . ASYNC_TEST_WAIT_TIME ) ;
888
842
} ) ;
889
843
890
- it ( 'can handle object update command which matches some subscriptions' , async done => {
844
+ it ( 'can handle object update command which matches some subscriptions' , async ( done ) => {
891
845
const parseLiveQueryServer = new ParseLiveQueryServer ( { } ) ;
892
846
// Make mock request message
893
847
const message = generateMockMessage ( true ) ;
@@ -920,7 +874,7 @@ describe('ParseLiveQueryServer', function () {
920
874
} , jasmine . ASYNC_TEST_WAIT_TIME ) ;
921
875
} ) ;
922
876
923
- it ( 'can handle object leave command which matches some subscriptions' , async done => {
877
+ it ( 'can handle object leave command which matches some subscriptions' , async ( done ) => {
924
878
const parseLiveQueryServer = new ParseLiveQueryServer ( { } ) ;
925
879
// Make mock request message
926
880
const message = generateMockMessage ( true ) ;
@@ -957,7 +911,7 @@ describe('ParseLiveQueryServer', function () {
957
911
} , jasmine . ASYNC_TEST_WAIT_TIME ) ;
958
912
} ) ;
959
913
960
- it ( 'can handle update command with original object' , async done => {
914
+ it ( 'can handle update command with original object' , async ( done ) => {
961
915
jasmine . restoreLibrary ( '../lib/LiveQuery/Client' , 'Client' ) ;
962
916
const Client = require ( '../lib/LiveQuery/Client' ) . Client ;
963
917
const parseLiveQueryServer = new ParseLiveQueryServer ( { } ) ;
@@ -1007,7 +961,7 @@ describe('ParseLiveQueryServer', function () {
1007
961
} , jasmine . ASYNC_TEST_WAIT_TIME ) ;
1008
962
} ) ;
1009
963
1010
- it ( 'can handle object create command which matches some subscriptions' , async done => {
964
+ it ( 'can handle object create command which matches some subscriptions' , async ( done ) => {
1011
965
const parseLiveQueryServer = new ParseLiveQueryServer ( { } ) ;
1012
966
// Make mock request message
1013
967
const message = generateMockMessage ( ) ;
@@ -1040,7 +994,7 @@ describe('ParseLiveQueryServer', function () {
1040
994
} , jasmine . ASYNC_TEST_WAIT_TIME ) ;
1041
995
} ) ;
1042
996
1043
- it ( 'can handle create command with fields' , async done => {
997
+ it ( 'can handle create command with fields' , async ( done ) => {
1044
998
jasmine . restoreLibrary ( '../lib/LiveQuery/Client' , 'Client' ) ;
1045
999
const Client = require ( '../lib/LiveQuery/Client' ) . Client ;
1046
1000
const parseLiveQueryServer = new ParseLiveQueryServer ( { } ) ;
@@ -1546,7 +1500,7 @@ describe('ParseLiveQueryServer', function () {
1546
1500
} ) ;
1547
1501
1548
1502
describe ( 'class level permissions' , ( ) => {
1549
- it ( 'matches CLP when find is closed' , done => {
1503
+ it ( 'matches CLP when find is closed' , ( done ) => {
1550
1504
const parseLiveQueryServer = new ParseLiveQueryServer ( { } ) ;
1551
1505
const acl = new Parse . ACL ( ) ;
1552
1506
acl . setReadAccess ( testUserId , true ) ;
@@ -1571,13 +1525,13 @@ describe('ParseLiveQueryServer', function () {
1571
1525
requestId ,
1572
1526
'find'
1573
1527
)
1574
- . then ( isMatched => {
1528
+ . then ( ( isMatched ) => {
1575
1529
expect ( isMatched ) . toBe ( false ) ;
1576
1530
done ( ) ;
1577
1531
} ) ;
1578
1532
} ) ;
1579
1533
1580
- it ( 'matches CLP when find is open' , done => {
1534
+ it ( 'matches CLP when find is open' , ( done ) => {
1581
1535
const parseLiveQueryServer = new ParseLiveQueryServer ( { } ) ;
1582
1536
const acl = new Parse . ACL ( ) ;
1583
1537
acl . setReadAccess ( testUserId , true ) ;
@@ -1602,13 +1556,13 @@ describe('ParseLiveQueryServer', function () {
1602
1556
requestId ,
1603
1557
'find'
1604
1558
)
1605
- . then ( isMatched => {
1559
+ . then ( ( isMatched ) => {
1606
1560
expect ( isMatched ) . toBe ( true ) ;
1607
1561
done ( ) ;
1608
1562
} ) ;
1609
1563
} ) ;
1610
1564
1611
- it ( 'matches CLP when find is restricted to userIds' , done => {
1565
+ it ( 'matches CLP when find is restricted to userIds' , ( done ) => {
1612
1566
const parseLiveQueryServer = new ParseLiveQueryServer ( { } ) ;
1613
1567
const acl = new Parse . ACL ( ) ;
1614
1568
acl . setReadAccess ( testUserId , true ) ;
@@ -1633,13 +1587,13 @@ describe('ParseLiveQueryServer', function () {
1633
1587
requestId ,
1634
1588
'find'
1635
1589
)
1636
- . then ( isMatched => {
1590
+ . then ( ( isMatched ) => {
1637
1591
expect ( isMatched ) . toBe ( true ) ;
1638
1592
done ( ) ;
1639
1593
} ) ;
1640
1594
} ) ;
1641
1595
1642
- it ( 'matches CLP when find is restricted to userIds' , done => {
1596
+ it ( 'matches CLP when find is restricted to userIds' , ( done ) => {
1643
1597
const parseLiveQueryServer = new ParseLiveQueryServer ( { } ) ;
1644
1598
const acl = new Parse . ACL ( ) ;
1645
1599
acl . setReadAccess ( testUserId , true ) ;
@@ -1664,7 +1618,7 @@ describe('ParseLiveQueryServer', function () {
1664
1618
requestId ,
1665
1619
'find'
1666
1620
)
1667
- . then ( isMatched => {
1621
+ . then ( ( isMatched ) => {
1668
1622
expect ( isMatched ) . toBe ( false ) ;
1669
1623
done ( ) ;
1670
1624
} ) ;
@@ -2001,7 +1955,7 @@ describe('LiveQueryController', () => {
2001
1955
classNames : [ 'Yolo' ] ,
2002
1956
} ,
2003
1957
} )
2004
- . then ( parseServer => {
1958
+ . then ( ( parseServer ) => {
2005
1959
saveSpy = spyOn (
2006
1960
parseServer . config . liveQueryController ,
2007
1961
'onAfterSave'
@@ -2019,7 +1973,7 @@ describe('LiveQueryController', () => {
2019
1973
const obj = new Parse . Object ( 'Yolo' ) ;
2020
1974
return obj . save ( ) ;
2021
1975
} )
2022
- . then ( obj => {
1976
+ . then ( ( obj ) => {
2023
1977
return obj . destroy ( ) ;
2024
1978
} )
2025
1979
. then ( ( ) => {
@@ -2099,3 +2053,49 @@ describe('LiveQueryController', () => {
2099
2053
} ) ;
2100
2054
} ) ;
2101
2055
} ) ;
2056
+
2057
+ it ( 'basic beforeConnect rejection' , async ( ) => {
2058
+ Parse . Cloud . beforeConnect ( function ( ) {
2059
+ throw new Error ( 'You shall not pass!' ) ;
2060
+ } ) ;
2061
+ const parseLiveQueryServer = new ParseLiveQueryServer ( { } ) ;
2062
+ const parseWebSocket = {
2063
+ clientId : - 1 ,
2064
+ } ;
2065
+ await parseLiveQueryServer . _handleConnect ( parseWebSocket , {
2066
+ sessionToken : 'token' ,
2067
+ } ) ;
2068
+ expect ( parseLiveQueryServer . clients . size ) . toBe ( 0 ) ;
2069
+ const Client = require ( '../lib/LiveQuery/Client' ) . Client ;
2070
+ expect ( Client . pushError ) . toHaveBeenCalled ( ) ;
2071
+ } ) ;
2072
+
2073
+ it ( 'basic beforeSubscribe rejection' , async ( ) => {
2074
+ Parse . Cloud . beforeSubscribe ( 'test' , function ( ) {
2075
+ throw new Error ( 'You shall not pass!' ) ;
2076
+ } ) ;
2077
+ const parseLiveQueryServer = new ParseLiveQueryServer ( { } ) ;
2078
+ const parseWebSocket = {
2079
+ clientId : - 1 ,
2080
+ } ;
2081
+ await parseLiveQueryServer . _handleConnect ( parseWebSocket , {
2082
+ sessionToken : 'token' ,
2083
+ } ) ;
2084
+ const query = {
2085
+ className : 'test' ,
2086
+ where : {
2087
+ key : 'value' ,
2088
+ } ,
2089
+ fields : [ 'test' ] ,
2090
+ } ;
2091
+ const requestId = 2 ;
2092
+ const request = {
2093
+ query : query ,
2094
+ requestId : requestId ,
2095
+ sessionToken : 'sessionToken' ,
2096
+ } ;
2097
+ await parseLiveQueryServer . _handleSubscribe ( parseWebSocket , request ) ;
2098
+ expect ( parseLiveQueryServer . clients . size ) . toBe ( 0 ) ;
2099
+ const Client = require ( '../lib/LiveQuery/Client' ) . Client ;
2100
+ expect ( Client . pushError ) . toHaveBeenCalled ( ) ;
2101
+ } ) ;
0 commit comments