build(aio): add the id
to the DocumentContents at doc-gen time (#16139)
This commit is contained in:

committed by
Miško Hevery

parent
6ed812ff75
commit
d0dcabd700
@ -31,7 +31,7 @@ module.exports = function convertToJsonProcessor(log, createDocMessage) {
|
|||||||
log.warn(createDocMessage('Title property expected', doc));
|
log.warn(createDocMessage('Title property expected', doc));
|
||||||
}
|
}
|
||||||
|
|
||||||
doc.renderedContent = JSON.stringify({ title, contents }, null, 2);
|
doc.renderedContent = JSON.stringify({ id: doc.path, title, contents }, null, 2);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -21,9 +21,11 @@ describe('convertToJson processor', () => {
|
|||||||
docType: 'test-doc',
|
docType: 'test-doc',
|
||||||
title: 'The Title',
|
title: 'The Title',
|
||||||
name: 'The Name',
|
name: 'The Name',
|
||||||
|
path: 'test/doc',
|
||||||
renderedContent: 'Some Content'
|
renderedContent: 'Some Content'
|
||||||
}];
|
}];
|
||||||
processor.$process(docs);
|
processor.$process(docs);
|
||||||
|
expect(JSON.parse(docs[0].renderedContent).id).toEqual('test/doc');
|
||||||
expect(JSON.parse(docs[0].renderedContent).title).toEqual('The Title');
|
expect(JSON.parse(docs[0].renderedContent).title).toEqual('The Title');
|
||||||
expect(JSON.parse(docs[0].renderedContent).contents).toEqual('Some Content');
|
expect(JSON.parse(docs[0].renderedContent).contents).toEqual('Some Content');
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user