chore: add tests on github pull request action to force empty authors

Signed-off-by: Romain Billon <romain.billon@agicap.com>
This commit is contained in:
Romain Billon
2024-06-01 21:53:31 +02:00
parent 403394ad87
commit f912f6150a
@@ -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',
},
},
},
],
});
});
});
});