Add a test for new repo_url edit_uri scenario
Add a test that checks that an edit_uri will be generated as expected if the mkdocs.yml contains a `repo_url` value but no `edit_uri` vlaue. Signed-off-by: Isabel Tomb <isabelgtomb@gmail.com>
This commit is contained in:
@@ -299,6 +299,31 @@ describe('helpers', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('should add edit_uri to mkdocs.yml with existing repo_url', async () => {
|
||||
const parsedLocationAnnotation: ParsedLocationAnnotation = {
|
||||
type: 'url',
|
||||
target: 'https://github.com/neworg/newrepo/tree/main/',
|
||||
};
|
||||
|
||||
await patchMkdocsYmlPreBuild(
|
||||
mockDir.resolve('mkdocs_with_repo_url.yml'),
|
||||
mockLogger,
|
||||
parsedLocationAnnotation,
|
||||
scmIntegrations,
|
||||
);
|
||||
|
||||
const updatedMkdocsYml = await fs.readFile(
|
||||
mockDir.resolve('mkdocs_with_repo_url.yml'),
|
||||
);
|
||||
|
||||
expect(updatedMkdocsYml.toString()).toContain(
|
||||
'edit_uri: https://github.com/neworg/newrepo/edit/main/docs',
|
||||
);
|
||||
expect(updatedMkdocsYml.toString()).toContain(
|
||||
'repo_url: https://github.com/backstage/backstage',
|
||||
);
|
||||
});
|
||||
|
||||
it('should not update mkdocs.yml if nothing should be changed', async () => {
|
||||
const parsedLocationAnnotation: ParsedLocationAnnotation = {
|
||||
type: 'dir',
|
||||
|
||||
Reference in New Issue
Block a user