diff --git a/plugins/scaffolder-backend-module-github/src/actions/githubPullRequest.test.ts b/plugins/scaffolder-backend-module-github/src/actions/githubPullRequest.test.ts index 485f7dec14..ccb1efa29b 100644 --- a/plugins/scaffolder-backend-module-github/src/actions/githubPullRequest.test.ts +++ b/plugins/scaffolder-backend-module-github/src/actions/githubPullRequest.test.ts @@ -1026,5 +1026,40 @@ describe('createPublishGithubPullRequestAction', () => { ], }); }); + it('discards author name and email if forceEmptyGitAuthor is set', async () => { + input.forceEmptyGitAuthor = true; + const clientFactory = jest.fn(async () => fakeClient as any); + const githubCredentialsProvider: GithubCredentialsProvider = { + getCredentials: jest.fn(), + }; + + const instanceWithConfig = createPublishGithubPullRequestAction({ + integrations, + githubCredentialsProvider, + clientFactory, + }); + + await instanceWithConfig.handler(ctx); + + expect(fakeClient.createPullRequest).toHaveBeenCalledWith({ + owner: 'myorg', + repo: 'myrepo', + title: 'Create my new app', + head: 'new-app', + body: 'This PR is really good', + changes: [ + { + commit: 'Create my new app', + files: { + 'file.txt': { + content: Buffer.from('Hello there!').toString('base64'), + encoding: 'base64', + mode: '100644', + }, + }, + }, + ], + }); + }); }); });