Skip to content

Commit 18a2e73

Browse files
committed
add deps
1 parent c18e7a4 commit 18a2e73

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

DEPRECATIONS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ The following is a list of deprecations, according to the [Deprecation Policy](h
1212
| DEPPS6 | Auth providers disabled by default | [#7953](https://github.com/parse-community/parse-server/pull/7953) | 5.3.0 (2022) | 7.0.0 (2024) | deprecated | - |
1313
| DEPPS7 | Remove file trigger syntax `Parse.Cloud.beforeSaveFile((request) => {})` | [#7966](https://github.com/parse-community/parse-server/pull/7966) | 5.3.0 (2022) | 7.0.0 (2024) | deprecated | - |
1414
| DEPPS8 | Login with expired 3rd party authentication token defaults to `false` | [#7079](https://github.com/parse-community/parse-server/pull/7079) | 5.3.0 (2022) | 7.0.0 (2024) | deprecated | - |
15+
| DEPPS9 | LiveQuery parameter `fields` | [#8389](https://github.com/parse-community/parse-server/issues/8389) | 6.0.0 (2023) | 7.0.0 (2024) | deprecated | - |
1516

1617
[i_deprecation]: ## "The version and date of the deprecation."
1718
[i_removal]: ## "The version and date of the planned removal."

spec/ParseLiveQueryServer.spec.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,62 @@ describe('ParseLiveQueryServer', function () {
10871087
done();
10881088
});
10891089

1090+
it('can deprecate fields', async () => {
1091+
const Deprecator = require('../lib/Deprecator/Deprecator');
1092+
const spy = spyOn(Deprecator, 'logRuntimeDeprecation').and.callFake(() => {});
1093+
jasmine.restoreLibrary('../lib/LiveQuery/Client', 'Client');
1094+
const Client = require('../lib/LiveQuery/Client').Client;
1095+
const parseLiveQueryServer = new ParseLiveQueryServer({});
1096+
// Make mock request message
1097+
const message = generateMockMessage();
1098+
1099+
const clientId = 1;
1100+
const parseWebSocket = {
1101+
clientId,
1102+
send: jasmine.createSpy('send'),
1103+
};
1104+
const client = new Client(clientId, parseWebSocket);
1105+
spyOn(client, 'pushCreate').and.callThrough();
1106+
parseLiveQueryServer.clients.set(clientId, client);
1107+
1108+
// Add mock subscription
1109+
const requestId = 2;
1110+
const query = {
1111+
className: testClassName,
1112+
where: {
1113+
key: 'value',
1114+
},
1115+
fields: ['test'],
1116+
};
1117+
await addMockSubscription(parseLiveQueryServer, clientId, requestId, parseWebSocket, query);
1118+
// Mock _matchesSubscription to return matching
1119+
parseLiveQueryServer._matchesSubscription = function (parseObject) {
1120+
if (!parseObject) {
1121+
return false;
1122+
}
1123+
return true;
1124+
};
1125+
parseLiveQueryServer._matchesACL = function () {
1126+
return Promise.resolve(true);
1127+
};
1128+
1129+
parseLiveQueryServer._onAfterSave(message);
1130+
1131+
// Make sure we send create command to client
1132+
await timeout();
1133+
1134+
expect(client.pushCreate).toHaveBeenCalled();
1135+
const args = parseWebSocket.send.calls.mostRecent().args;
1136+
const toSend = JSON.parse(args[0]);
1137+
expect(toSend.object).toBeDefined();
1138+
expect(toSend.original).toBeUndefined();
1139+
expect(spy).toHaveBeenCalledWith({
1140+
usage: 'Subscribing using fields parameter',
1141+
solution:
1142+
`Subscribe using "keys" instead.`,
1143+
});
1144+
});
1145+
10901146
it('can handle create command with watch', async () => {
10911147
jasmine.restoreLibrary('../lib/LiveQuery/Client', 'Client');
10921148
const Client = require('../lib/LiveQuery/Client').Client;

0 commit comments

Comments
 (0)