[ADF-3055] fix bug with page size for facet fields (#3359)

* fix bug with page size for facet fields

* move page size to a constant

* move const inside the scope

* test fixes
This commit is contained in:
Denys Vuika
2018-05-22 10:33:46 +01:00
committed by Eugenio Romano
parent b92cc2ad60
commit 5aa523d9ac
4 changed files with 59 additions and 8 deletions

View File

@@ -144,6 +144,35 @@ describe('SearchQueryBuilder', () => {
expect(query2).toBeNull();
});
it('should fetch facet from the config by label', () => {
const config: SearchConfiguration = {
categories: [],
facetFields: [
{ 'field': 'content.mimetype', 'mincount': 1, 'label': 'Type' },
{ 'field': 'content.size', 'mincount': 1, 'label': 'Size' }
]
};
const builder = new SearchQueryBuilderService(buildConfig(config), null);
const field = builder.getFacetField('Size');
expect(field.label).toBe('Size');
expect(field.field).toBe('content.size');
});
it('should not fetch facet from the config by label', () => {
const config: SearchConfiguration = {
categories: [],
facetFields: [
{ 'field': 'content.mimetype', 'mincount': 1, 'label': 'Type' },
{ 'field': 'content.size', 'mincount': 1, 'label': 'Size' }
]
};
const builder = new SearchQueryBuilderService(buildConfig(config), null);
const field = builder.getFacetField('Missing');
expect(field).toBeUndefined();
});
xit('should build query and raise an event on update', async () => {
const builder = new SearchQueryBuilderService(buildConfig({}), null);
const query = {};