Skip to content

Commit e3a169c

Browse files
committed
fix tests
1 parent 7f31285 commit e3a169c

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

spec/ParseLiveQueryQuery.spec.js

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const Parse = require('parse/node');
44

55
describe('ParseLiveQuery query operation', function () {
66
beforeEach(function (done) {
7+
Parse.CoreManager.getLiveQueryController().setDefaultLiveQueryClient(null);
78
// Mock ParseWebSocketServer
89
const mockParseWebSocketServer = jasmine.createSpy('ParseWebSocketServer');
910
jasmine.mockLibrary(
@@ -17,7 +18,11 @@ describe('ParseLiveQuery query operation', function () {
1718
done();
1819
});
1920

20-
afterEach(function () {
21+
afterEach(async function () {
22+
const client = await Parse.CoreManager.getLiveQueryController().getDefaultLiveQueryClient();
23+
if (client) {
24+
await client.close();
25+
}
2126
jasmine.restoreLibrary('../lib/LiveQuery/ParseWebSocketServer', 'ParseWebSocketServer');
2227
});
2328

@@ -59,7 +64,14 @@ describe('ParseLiveQuery query operation', function () {
5964
}
6065

6166
it('can handle query command with existing subscription', async () => {
62-
await reconfigureServer();
67+
await reconfigureServer({
68+
liveQuery: {
69+
classNames: ['TestObject'],
70+
},
71+
startLiveQueryServer: true,
72+
verbose: false,
73+
silent: true,
74+
});
6375

6476
const { ParseLiveQueryServer } = require('../lib/LiveQuery/ParseLiveQueryServer');
6577
const parseLiveQueryServer = new ParseLiveQueryServer({
@@ -138,7 +150,14 @@ describe('ParseLiveQuery query operation', function () {
138150
});
139151

140152
it('respects field filtering (keys) when executing query', async () => {
141-
await reconfigureServer();
153+
await reconfigureServer({
154+
liveQuery: {
155+
classNames: ['TestObject'],
156+
},
157+
startLiveQueryServer: true,
158+
verbose: false,
159+
silent: true,
160+
});
142161

143162
const { ParseLiveQueryServer } = require('../lib/LiveQuery/ParseLiveQueryServer');
144163
const parseLiveQueryServer = new ParseLiveQueryServer({
@@ -192,7 +211,14 @@ describe('ParseLiveQuery query operation', function () {
192211
});
193212

194213
it('handles query with where constraints', async () => {
195-
await reconfigureServer();
214+
await reconfigureServer({
215+
liveQuery: {
216+
classNames: ['TestObject'],
217+
},
218+
startLiveQueryServer: true,
219+
verbose: false,
220+
silent: true,
221+
});
196222

197223
const { ParseLiveQueryServer } = require('../lib/LiveQuery/ParseLiveQueryServer');
198224
const parseLiveQueryServer = new ParseLiveQueryServer({

0 commit comments

Comments
 (0)