Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-lou committed Oct 28, 2024
1 parent cf8842d commit 6d677ee
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
15 changes: 14 additions & 1 deletion src/utils/__tests__/changelog.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ describe('generateChangesetFromGit', () => {
pr?: {
local?: string;
remote?: {
author: { login: string };
author?: { login: string };
number: string;
body?: string;
milestone?: string;
Expand Down Expand Up @@ -389,6 +389,19 @@ describe('generateChangesetFromGit', () => {
{},
'### Various fixes & improvements\n\n- Upgraded the kernel (#123) by @sentry',
],
[
'Does not error when PR author is null',
[
{
hash: 'abcdef1234567890',
title: 'Upgraded the kernel',
body: '',
pr: { remote: { number: '123' } },
},
],
{},
'### Various fixes & improvements\n\n- Upgraded the kernel (#123)',
],
[
'handle multiple commits properly',
[
Expand Down
4 changes: 2 additions & 2 deletions src/utils/changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ interface CommitInfo {
nodes: Array<{
number: string;
body: string;
author: {
author?: {
login: string;
};
milestone: {
Expand Down Expand Up @@ -472,7 +472,7 @@ async function getPRAndMilestoneFromCommit(
hash.slice(1),
pr
? {
author: pr.author?.login ?? null,
author: pr.author?.login,
pr: pr.number,
prBody: pr.body,
milestone: pr.milestone?.number ?? null,
Expand Down

0 comments on commit 6d677ee

Please sign in to comment.