build(aio): add the `id` to the DocumentContents at doc-gen time (#16139)
This commit is contained in:
parent
6ed812ff75
commit
d0dcabd700
|
@ -31,7 +31,7 @@ module.exports = function convertToJsonProcessor(log, createDocMessage) {
|
|||
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',
|
||||
title: 'The Title',
|
||||
name: 'The Name',
|
||||
path: 'test/doc',
|
||||
renderedContent: 'Some Content'
|
||||
}];
|
||||
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).contents).toEqual('Some Content');
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue