build(aio): fail doc-gen if referenced images are missing

This commit is contained in:
Peter Bacon Darwin
2017-07-16 11:58:59 +01:00
committed by Pete Bacon Darwin
parent 9d97163c64
commit c453b7bcfa
2 changed files with 8 additions and 12 deletions

View File

@ -58,7 +58,7 @@ describe('addImageDimensions post-processor', () => {
expect(log.warn).toHaveBeenCalled();
});
it('should log a warning for images whose source cannot be loaded', () => {
it('should fail for images whose source cannot be loaded', () => {
getImageDimensionsSpy.and.callFake(() => {
const error = new Error('no such file or directory');
error.code = 'ENOENT';
@ -68,13 +68,8 @@ describe('addImageDimensions post-processor', () => {
docType: 'a',
renderedContent: '<img src="missing">'
}];
processor.$process(docs);
expect(() => processor.$process(docs)).toThrowError('Unable to load src in image tag `<img src="missing">` - doc (a) ');
expect(getImageDimensionsSpy).toHaveBeenCalled();
expect(docs).toEqual([jasmine.objectContaining({
docType: 'a',
renderedContent: '<img src="missing">'
})]);
expect(log.warn).toHaveBeenCalled();
});
it('should ignore images with width or height attributes', () => {
@ -87,7 +82,6 @@ describe('addImageDimensions post-processor', () => {
`
}];
processor.$process(docs);
expect(getImageDimensionsSpy).not.toHaveBeenCalled();
expect(docs).toEqual([jasmine.objectContaining({
docType: 'a',
renderedContent: `