build(aio): better error message for invalid links (#16993)
This commit is contained in:

committed by
Chuck Jazdzewski

parent
19a509a92c
commit
b0c5018c70
@ -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;
|
||||
|
@ -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', () => {
|
||||
|
Reference in New Issue
Block a user