Skip to content

Commit bfba08b

Browse files
committed
Update ParseQuery.FullTextSearch.spec.js
1 parent a0a2a7f commit bfba08b

File tree

1 file changed

+12
-56
lines changed

1 file changed

+12
-56
lines changed

spec/ParseQuery.FullTextSearch.spec.js

Lines changed: 12 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -251,64 +251,20 @@ describe_only_db('mongo')('[mongodb] Parse.Query Full Text Search testing', () =
251251
.catch(done.fail);
252252
});
253253

254-
it('fullTextSearch: $diacriticSensitive - false', done => {
255-
fullTextHelper()
256-
.then(() => {
257-
const where = {
258-
subject: {
259-
$text: {
260-
$search: {
261-
$term: 'CAFÉ',
262-
$diacriticSensitive: false,
263-
},
264-
},
265-
},
266-
};
267-
return request({
268-
method: 'POST',
269-
url: 'http://localhost:8378/1/classes/TestObject',
270-
body: { where, _method: 'GET' },
271-
headers: {
272-
'X-Parse-Application-Id': 'test',
273-
'X-Parse-REST-API-Key': 'test',
274-
'Content-Type': 'application/json',
275-
},
276-
});
277-
})
278-
.then(resp => {
279-
expect(resp.data.results.length).toBe(2);
280-
done();
281-
}, done.fail);
254+
it('fullTextSearch: $diacriticSensitive - false', async () => {
255+
await fullTextHelper();
256+
const query = new Parse.Query('TestObject');
257+
query.fullText('subject', 'CAFÉ', { diacriticSensitive: false });
258+
const resp = await query.find();
259+
expect(resp.length).toBe(2);
282260
});
283261

284-
it('fullTextSearch: $caseSensitive', done => {
285-
fullTextHelper()
286-
.then(() => {
287-
const where = {
288-
subject: {
289-
$text: {
290-
$search: {
291-
$term: 'Coffee',
292-
$caseSensitive: true,
293-
},
294-
},
295-
},
296-
};
297-
return request({
298-
method: 'POST',
299-
url: 'http://localhost:8378/1/classes/TestObject',
300-
body: { where, _method: 'GET' },
301-
headers: {
302-
'X-Parse-Application-Id': 'test',
303-
'X-Parse-REST-API-Key': 'test',
304-
'Content-Type': 'application/json',
305-
},
306-
});
307-
})
308-
.then(resp => {
309-
expect(resp.data.results.length).toBe(1);
310-
done();
311-
}, done.fail);
262+
it('fullTextSearch: $caseSensitive', async () => {
263+
await fullTextHelper();
264+
const query = new Parse.Query('TestObject');
265+
query.fullText('subject', 'Coffee', { caseSensitive: true });
266+
const results = await query.find();
267+
expect(results.length).toBe(1);
312268
});
313269
});
314270

0 commit comments

Comments
 (0)