build(aio): better error message for invalid links (#16993)

This commit is contained in:
Pete Bacon Darwin
2017-05-24 18:59:06 +01:00
committed by Chuck Jazdzewski
parent 19a509a92c
commit b0c5018c70
4 changed files with 66 additions and 1 deletions

View File

@ -74,6 +74,8 @@ module.exports = function getLinkInfo(getDocFromAlias, encodeCodeBlock, log) {
if (linkInfo.title === undefined) {
linkInfo.valid = false;
linkInfo.errorType = 'no-title';
linkInfo.error = 'The link is missing a title';
}
return linkInfo;

View File

@ -23,6 +23,8 @@ describe('getLinkInfo', () => {
const currentDoc = { };
const linkInfo = getLinkInfo('browser-support', undefined, currentDoc);
expect(linkInfo.valid).toBe(false);
expect(linkInfo.errorType).toEqual('no-title');
expect(linkInfo.error).toEqual('The link is missing a title');
});
it('should use the target document title if available and no title is specified', () => {