[ADF-2242] Search on custom sources is not working. (#2904)

* [ADF-2242] Search on custom sources is not working.

fix search on custom sources

* [ADF-2242] added unit tests

* [ADF-2242] reverted change

* [ADF-2242] simplify code on search method and make extra call only when having custom dropdown defined
This commit is contained in:
suzanadirla
2018-02-02 17:22:33 +02:00
committed by Eugenio Romano
parent 5ee9b09a21
commit 78c6a68e51
5 changed files with 204 additions and 37 deletions

View File

@@ -103,4 +103,22 @@ describe('ContentNodeSelectorService', () => {
expect(search.query.filterQueries).not.toContain({ query: 'ANCESTOR:\'workspace://SpacesStore/null\'' });
});
it('should filter for the extra provided ancestors if defined', () => {
service.search('nuka cola quantum', 'diamond-city', 0, 25, ['extra-diamond-city']);
expect(search.query.filterQueries).toContain({ query: 'ANCESTOR:\'workspace://SpacesStore/diamond-city\' OR ANCESTOR:\'workspace://SpacesStore/extra-diamond-city\'' });
});
it('should NOT filter for extra ancestors if an empty list of ids is provided', () => {
service.search('nuka cola quantum', 'diamond-city', 0, 25, []);
expect(search.query.filterQueries).toContain({ query: 'ANCESTOR:\'workspace://SpacesStore/diamond-city\'' });
});
it('should NOT filter for the extra provided ancestor if it\'s the same as the rootNodeId', () => {
service.search('nuka cola quantum', 'diamond-city', 0, 25, ['diamond-city']);
expect(search.query.filterQueries).toContain({ query: 'ANCESTOR:\'workspace://SpacesStore/diamond-city\'' });
});
});