Changeset View
Changeset View
Standalone View
Standalone View
keyserver/src/database/search-utils.test.js
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | describe('processQueryForSearch(query: string)', () => { | ||||
it('should add + before every word', () => { | it('should add + before every word', () => { | ||||
expect(processQueryForSearch('test')).toBe('+test'); | expect(processQueryForSearch('test')).toBe('+test'); | ||||
expect(processQueryForSearch('test hello')).toBe('+test +hello'); | expect(processQueryForSearch('test hello')).toBe('+test +hello'); | ||||
expect(processQueryForSearch('test \nhello')).toBe('+test +hello'); | expect(processQueryForSearch('test \nhello')).toBe('+test +hello'); | ||||
}); | }); | ||||
it('should remove + < > ~ from the query', () => { | it('should remove + < > ~ from the query', () => { | ||||
expect(processQueryForSearch('+ < > ~')).toBe(''); | expect(processQueryForSearch('+ < > ~')).toBe(''); | ||||
}); | }); | ||||
it('should return an empty string, if the input consists only of stopwords', () => { | |||||
const [stopWord1, stopWord2, stopWord3] = stopwords; | |||||
expect(processQueryForSearch(stopWord1)).toBe(''); | |||||
expect(segmentAndStem(`${stopWord1} ${stopWord2} ${stopWord3}`)).toBe(''); | |||||
}); | |||||
}); | }); |