Skip to content

Commit 0a980df

Browse files
committed
Update ParseQuery.FullTextSearch.spec.js
1 parent 09a3bb7 commit 0a980df

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

spec/ParseQuery.FullTextSearch.spec.js

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const fullTextHelper = () => {
5252
});
5353
};
5454

55-
describe('Parse.Query Full Text Search testing', () => {
55+
fdescribe('Parse.Query Full Text Search testing', () => {
5656
it('fullTextSearch: $search', done => {
5757
fullTextHelper()
5858
.then(() => {
@@ -122,11 +122,31 @@ describe('Parse.Query Full Text Search testing', () => {
122122

123123
it('fulltext descending by $score', async () => {
124124
await fullTextHelper();
125-
const query = new Parse.Query('TestObject');
126-
query.fullText('subject', 'coffee');
127-
query.descending('$score');
128-
const objects = await query.find();
129-
expect(objects.length).toBe(3);
125+
const where = {
126+
subject: {
127+
$text: {
128+
$search: {
129+
$term: 'coffee',
130+
},
131+
},
132+
},
133+
};
134+
const order = '-$score';
135+
const keys = '$score';
136+
const { data } = await request({
137+
method: 'POST',
138+
url: 'http://localhost:8378/1/classes/TestObject',
139+
body: { where, order, keys, _method: 'GET' },
140+
headers: {
141+
'X-Parse-Application-Id': 'test',
142+
'X-Parse-REST-API-Key': 'test',
143+
'Content-Type': 'application/json',
144+
},
145+
});
146+
expect(data.results.length).toBe(3);
147+
expect(data.results[0].score);
148+
expect(data.results[1].score);
149+
expect(data.results[2].score);
130150
});
131151

132152
it('fullTextSearch: $language', done => {

0 commit comments

Comments
 (0)