diff --git a/plugins/techdocs-node/src/stages/generate/helpers.test.ts b/plugins/techdocs-node/src/stages/generate/helpers.test.ts index 3589b71c60..a40239c595 100644 --- a/plugins/techdocs-node/src/stages/generate/helpers.test.ts +++ b/plugins/techdocs-node/src/stages/generate/helpers.test.ts @@ -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',