Skip to content

Commit e3458b6

Browse files
committed
Update ProtectedFields.spec.js
1 parent ae9a836 commit e3458b6

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

spec/ProtectedFields.spec.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,12 +1822,19 @@ describe('ProtectedFields', function () {
18221822
);
18231823
});
18241824

1825-
it('should handle malformed $or with null element', async function () {
1826-
const query = new Parse.Query(Parse.User);
1827-
query.withJSON({ where: { $or: [null, { username: 'test' }] } });
1828-
// Should not throw TypeError from denyProtectedFields;
1829-
// may fail downstream in validateQuery (pre-existing issue)
1830-
await expectAsync(query.find()).toBeRejected();
1825+
it('should not throw TypeError in denyProtectedFields for null element in $or', async function () {
1826+
const Config = require('../lib/Config');
1827+
const authModule = require('../lib/Auth');
1828+
const RestQuery = require('../lib/RestQuery');
1829+
const config = Config.get(Parse.applicationId);
1830+
const restQuery = await RestQuery({
1831+
method: RestQuery.Method.find,
1832+
config,
1833+
auth: authModule.nobody(config),
1834+
className: '_User',
1835+
restWhere: { $or: [null, { username: 'test' }] },
1836+
});
1837+
await expectAsync(restQuery.denyProtectedFields()).toBeResolved();
18311838
});
18321839
});
18331840
});

0 commit comments

Comments
 (0)