Add additional test for error returned by search API

This commit is contained in:
Will Abson 2016-10-12 14:57:52 +01:00
parent 78a0253ebb
commit fa73a55ebd

View File

@ -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();
}
);
});
});