mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
Add additional test for error returned by search API
This commit is contained in:
parent
78a0253ebb
commit
fa73a55ebd
@ -56,6 +56,16 @@ describe('AlfrescoSearchService', () => {
|
||||
}
|
||||
};
|
||||
|
||||
let fakeError = {
|
||||
error: {
|
||||
errorKey: 'Search failed',
|
||||
statusCode: 400,
|
||||
briefSummary: '08220082 search failed',
|
||||
stackTrace: 'For security reasons the stack trace is no longer displayed, but the property is kept for previous versions.',
|
||||
descriptionURL: 'https://api-explorer.alfresco.com'
|
||||
}
|
||||
};
|
||||
|
||||
let fakeApi = {
|
||||
core: {
|
||||
searchApi: {
|
||||
@ -101,4 +111,16 @@ describe('AlfrescoSearchService', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('should notify errors returned from the API', (done) => {
|
||||
spyOn(fakeApi.core.searchApi, 'liveSearchNodes').and.returnValue(Promise.reject(fakeError));
|
||||
service.getLiveSearchResults('').subscribe(
|
||||
() => {},
|
||||
(res: any) => {
|
||||
expect(res).toBeDefined();
|
||||
expect(res).toEqual(fakeError);
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user