File tree Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,32 @@ describe('Parse LiveQuery', () => {
58
58
await object . save ( ) ;
59
59
} ) ;
60
60
61
+ it ( 'can subscribe to query with null connect fields' , async done => {
62
+ const client = new Parse . LiveQueryClient ( {
63
+ applicationId : 'integration' ,
64
+ serverURL : 'ws://localhost:1337' ,
65
+ javascriptKey : null ,
66
+ masterKey : null ,
67
+ sessionToken : null ,
68
+ installationId : null ,
69
+ } ) ;
70
+ client . open ( ) ;
71
+ const object = new TestObject ( ) ;
72
+ await object . save ( ) ;
73
+
74
+ const query = new Parse . Query ( TestObject ) ;
75
+ query . equalTo ( 'objectId' , object . id ) ;
76
+ const subscription = await client . subscribe ( query ) ;
77
+ subscription . on ( 'update' , async object => {
78
+ assert . equal ( object . get ( 'foo' ) , 'bar' ) ;
79
+ client . close ( ) ;
80
+ done ( ) ;
81
+ } ) ;
82
+ await subscription . subscribePromise ;
83
+ object . set ( { foo : 'bar' } ) ;
84
+ await object . save ( ) ;
85
+ } ) ;
86
+
61
87
it ( 'can subscribe to multiple queries' , async ( ) => {
62
88
const objectA = new TestObject ( ) ;
63
89
const objectB = new TestObject ( ) ;
Original file line number Diff line number Diff line change @@ -160,10 +160,10 @@ class LiveQueryClient extends EventEmitter {
160
160
this . requestId = 1 ;
161
161
this . serverURL = serverURL ;
162
162
this . applicationId = applicationId ;
163
- this . javascriptKey = javascriptKey ;
164
- this . masterKey = masterKey ;
163
+ this . javascriptKey = javascriptKey || undefined ;
164
+ this . masterKey = masterKey || undefined ;
165
165
this . sessionToken = sessionToken || undefined ;
166
- this . installationId = installationId ;
166
+ this . installationId = installationId || undefined ;
167
167
this . additionalProperties = true ;
168
168
this . connectPromise = resolvingPromise ( ) ;
169
169
this . subscriptions = new Map ( ) ;
You can’t perform that action at this time.
0 commit comments