Repository: anuraghazra/github-readme-stats
Pull request #3068 (2023-08-13 22:51:09)

Refactor: Stats card: Set username param type for totalCommitsFetcher function inside data fetcher

vercel[bot]: [vc]: #h9yNbyQs6ieumwDuPFdGdEsDkc3YYMrmT2ToBgLYDVo=:eyJpc01vbm9yZXBvIjp0cnVlLCJ0eXBlIjoiZ2l0aHViIiwicHJvamVjdHMiOlt7Im5hbWUiOiJnaXRodWItcmVhZG1lLXN0YXRzIiwiaW5zcGVjdG9yVXJsIjoiaHR0cHM6Ly92ZXJjZWwuY29tL2dpdGh1Yi1yZWFkbWUtc3RhdHMtdGVhbS9naXRodWItcmVhZG1lLXN0YXRzLzRrVkVIWFVvN01TZHBQVDY1NmpRbTlZYlZuOFIiLCJwcmV2aWV3VXJsIjoiZ2l0aHViLXJlYWRtZS1zdGF0cy1naXQtcmVmYWN0by1lYWUxMWYtZ2l0aHViLXJlYWRtZS1zdGF0cy10ZWFtLnZlcmNlbC5hcHAiLCJuZXh0Q29tbWl0U3RhdHVzIjoiREVQTE9ZRUQifV19
**The latest updates on your projects**. Learn more about [Vercel for Git ↗︎](https://vercel.link/github-learn-more)

| Name | Status | Preview | Updated (UTC) |
| :--- | :----- | :------ | :------ |
| **github-readme-stats** | ✅ Ready ([Inspect](https://vercel.com/github-readme-stats-team/github-readme-stats/4kVEHXUo7MSdpPT656jQm9YbVn8R)) | [Visit Preview](https://github-readme-stats-git-refacto-eae11f-github-readme-stats-team.vercel.app) | Aug 13, 2023 10:51pm |


codecov[bot]: ## [Codecov](https://app.codecov.io/gh/anuraghazra/github-readme-stats/pull/3068?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra) Report
Patch coverage: **`100.00%`** and no project coverage change.
> Comparison is base [(`135176f`)](https://app.codecov.io/gh/anuraghazra/github-readme-stats/commit/135176f0735bcf6e674ecfc9268e8d6d3fa6b488?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra) 97.62% compared to head [(`1a58493`)](https://app.codecov.io/gh/anuraghazra/github-readme-stats/pull/3068?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra) 97.62%.

<details><summary>Additional details and impacted files</summary>


```diff
@@           Coverage Diff           @@
##           master    #3068   +/-   ##
=======================================
  Coverage   97.62%   97.62%           
=======================================
  Files          24       24           
  Lines        5343     5343           
  Branches      466      466           
=======================================
  Hits         5216     5216           
  Misses        125      125           
  Partials        2        2           
```


| [Files Changed](https://app.codecov.io/gh/anuraghazra/github-readme-stats/pull/3068?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra) | Coverage Δ | |
|---|---|---|
| [src/fetchers/stats-fetcher.js](https://app.codecov.io/gh/anuraghazra/github-readme-stats/pull/3068?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra#diff-c3JjL2ZldGNoZXJzL3N0YXRzLWZldGNoZXIuanM=) | `93.26% <100.00%> (ø)` | |


</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/anuraghazra/github-readme-stats/pull/3068?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Anurag+Hazra).


Patch:
diff --git a/readme.md b/readme.md
index 2760b19..47783a2 100644
--- a/readme.md
+++ b/readme.md
@@ -156,10 +156,10 @@ You can pass a query parameter `&hide=` to hide any specific stats with comma-se
 
 You can pass a query parameter `&show=` to show any specific additional stats with comma-separated values.
 
-> Options: `&show=reviews,discussions_started,discussions_answered`
+> Options: `&show=reviews,discussions_started,discussions_answered,prs_merged,prs_merged_percentage`
 
 ```md
-![Anurag's GitHub stats](https://github-readme-stats.vercel.app/api?username=anuraghazra&show=reviews)
+![Anurag's GitHub stats](https://github-readme-stats.vercel.app/api?username=anuraghazra&show=reviews,discussions_started,discussions_answered,prs_merged,prs_merged_percentage)
 ```
 
 ### Showing icons
@@ -319,7 +319,7 @@ You can provide multiple comma-separated values in the bg\_color option to rende
 *   `disable_animations` - Disables all animations in the card *(boolean)*. Default: `false`.
 *   `ring_color` - Color of the rank circle *(hex color)*. Defaults to the theme ring color if it exists and otherwise the title color.
 *   `number_format` - Switches between two available formats for displaying the card values `short` (i.e. `6.6k`) and `long` (i.e. `6626`). Default: `short`.
-*   `show` - Shows [additional items](#showing-additional-individual-stats) on stats card (i.e. `reviews`, `discussions_started` or `discussions_answered`) *(Comma-separated values)*. Default: `[] (blank array)`.
+*   `show` - Shows [additional items](#showing-additional-individual-stats) on stats card (i.e. `reviews`, `discussions_started`, `discussions_answered`, `prs_merged` or `prs_merged_percentage`) *(Comma-separated values)*. Default: `[] (blank array)`.
 
 > [!NOTE]\
 > When hide\_rank=`true`, the minimum card width is 270 px + the title length and padding.
@@ -548,7 +548,7 @@ Change the `?username=` value to your [Wakatime](https://wakatime.com) username.
 
 *   Showing additional stats
 
-![Anurag's GitHub stats](https://github-readme-stats.vercel.app/api?username=anuraghazra\&show=reviews,discussions_started,discussions_answered)
+![Anurag's GitHub stats](https://github-readme-stats.vercel.app/api?username=anuraghazra\&show=reviews,discussions_started,discussions_answered,prs_merged,prs_merged_percentage)
 
 *   Showing icons
 
diff --git a/src/cards/stats-card.js b/src/cards/stats-card.js
index 7c5d437..778e676 100644
--- a/src/cards/stats-card.js
+++ b/src/cards/stats-card.js
@@ -28,6 +28,7 @@ const RANK_ONLY_CARD_DEFAULT_WIDTH = 290;
  * @param {string} createTextNodeParams.label The label to display.
  * @param {number} createTextNodeParams.value The value to display.
  * @param {string} createTextNodeParams.id The id of the stat.
+ * @param {string=} createTextNodeParams.unitSymbol The unit symbol of the stat.
  * @param {number} createTextNodeParams.index The index of the stat.
  * @param {boolean} createTextNodeParams.showIcons Whether to show icons.
  * @param {number} createTextNodeParams.shiftValuePos Number of pixels the value has to be shifted to the right.
@@ -40,6 +41,7 @@ const createTextNode = ({
   label,
   value,
   id,
+  unitSymbol,
   index,
   showIcons,
   shiftValuePos,
@@ -69,7 +71,7 @@ const createTextNode = ({
         x="${(showIcons ? 140 : 120) + shiftValuePos}"
         y="12.5"
         data-testid="${id}"
-      >${kValue}</text>
+      >${kValue}${unitSymbol ? ` ${unitSymbol}` : ""}</text>
     </g>
   `;
 };
@@ -93,6 +95,8 @@ const renderStatsCard = (stats, options = {}) => {
     totalCommits,
     totalIssues,
     totalPRs,
+    totalPRsMerged,
+    mergedPRsPercentage,
     totalReviews,
     totalDiscussionsStarted,
     totalDiscussionsAnswered,
@@ -171,6 +175,25 @@ const renderStatsCard = (stats, options = {}) => {
     id: "prs",
   };
 
+  if (show.includes("prs_merged")) {
+    STATS.prs_merged = {
+      icon: icons.prs_merged,
+      label: i18n.t("statcard.prs-merged"),
+      value: totalPRsMerged,
+      id: "prs_merged",
+    };
+  }
+
+  if (show.includes("prs_merged_percentage")) {
+    STATS.prs_merged_percentage = {
+      icon: icons.prs_merged_percentage,
+      label: i18n.t("statcard.prs-merged-percentage"),
+      value: mergedPRsPercentage.toFixed(2),
+      id: "prs_merged_percentage",
+      unitSymbol: "%",
+    };
+  }
+
   if (show.includes("reviews")) {
     STATS.reviews = {
       icon: icons.reviews,
@@ -235,7 +258,11 @@ const renderStatsCard = (stats, options = {}) => {
     .map((key, index) =>
       // create the text nodes, and pass index so that we can calculate the line spacing
       createTextNode({
-        ...STATS[key],
+        icon: STATS[key].icon,
+        label: STATS[key].label,
+        value: STATS[key].value,
+        id: STATS[key].id,
+        unitSymbol: STATS[key].unitSymbol,
         index,
         showIcons: show_icons,
         shiftValuePos: 79.01 + (isLongLocale ? 50 : 0),
diff --git a/src/common/icons.js b/src/common/icons.js
index 3f91d86..d600c14 100644
--- a/src/common/icons.js
+++ b/src/common/icons.js
@@ -2,6 +2,8 @@ const icons = {
   star: `<path fill-rule="evenodd" d="M8 .25a.75.75 0 01.673.418l1.882 3.815 4.21.612a.75.75 0 01.416 1.279l-3.046 2.97.719 4.192a.75.75 0 01-1.088.791L8 12.347l-3.766 1.98a.75.75 0 01-1.088-.79l.72-4.194L.818 6.374a.75.75 0 01.416-1.28l4.21-.611L7.327.668A.75.75 0 018 .25zm0 2.445L6.615 5.5a.75.75 0 01-.564.41l-3.097.45 2.24 2.184a.75.75 0 01.216.664l-.528 3.084 2.769-1.456a.75.75 0 01.698 0l2.77 1.456-.53-3.084a.75.75 0 01.216-.664l2.24-2.183-3.096-.45a.75.75 0 01-.564-.41L8 2.694v.001z"/>`,
   commits: `<path fill-rule="evenodd" d="M1.643 3.143L.427 1.927A.25.25 0 000 2.104V5.75c0 .138.112.25.25.25h3.646a.25.25 0 00.177-.427L2.715 4.215a6.5 6.5 0 11-1.18 4.458.75.75 0 10-1.493.154 8.001 8.001 0 101.6-5.684zM7.75 4a.75.75 0 01.75.75v2.992l2.028.812a.75.75 0 01-.557 1.392l-2.5-1A.75.75 0 017 8.25v-3.5A.75.75 0 017.75 4z"/>`,
   prs: `<path fill-rule="evenodd" d="M7.177 3.073L9.573.677A.25.25 0 0110 .854v4.792a.25.25 0 01-.427.177L7.177 3.427a.25.25 0 010-.354zM3.75 2.5a.75.75 0 100 1.5.75.75 0 000-1.5zm-2.25.75a2.25 2.25 0 113 2.122v5.256a2.251 2.251 0 11-1.5 0V5.372A2.25 2.25 0 011.5 3.25zM11 2.5h-1V4h1a1 1 0 011 1v5.628a2.251 2.251 0 101.5 0V5A2.5 2.5 0 0011 2.5zm1 10.25a.75.75 0 111.5 0 .75.75 0 01-1.5 0zM3.75 12a.75.75 0 100 1.5.75.75 0 000-1.5z"/>`,
+  prs_merged: `<path fill-rule="evenodd" d="M5.45 5.154A4.25 4.25 0 0 0 9.25 7.5h1.378a2.251 2.251 0 1 1 0 1.5H9.25A5.734 5.734 0 0 1 5 7.123v3.505a2.25 2.25 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.95-.218ZM4.25 13.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm8.5-4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5ZM5 3.25a.75.75 0 1 0 0 .005V3.25Z" />`,
+  prs_merged_percentage: `<path fill-rule="evenodd" d="M13.442 2.558a.625.625 0 0 1 0 .884l-10 10a.625.625 0 1 1-.884-.884l10-10a.625.625 0 0 1 .884 0zM4.5 6a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm0 1a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5zm7 6a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm0 1a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5z" />`,
   issues: `<path fill-rule="evenodd" d="M8 1.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13zM0 8a8 8 0 1116 0A8 8 0 010 8zm9 3a1 1 0 11-2 0 1 1 0 012 0zm-.25-6.25a.75.75 0 00-1.5 0v3.5a.75.75 0 001.5 0v-3.5z"/>`,
   icon: `<path fill-rule="evenodd" d="M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z"/>`,
   contribs: `<path fill-rule="evenodd" d="M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z"/>`,
diff --git a/src/fetchers/stats-fetcher.js b/src/fetchers/stats-fetcher.js
index a1e2821..ac51d49 100644
--- a/src/fetchers/stats-fetcher.js
+++ b/src/fetchers/stats-fetcher.js
@@ -54,6 +54,9 @@ const GRAPHQL_STATS_QUERY = `
       pullRequests(first: 1) {
         totalCount
       }
+      mergedPullRequests: pullRequests(states: MERGED) {
+        totalCount
+      }
       openIssues: issues(states: OPEN) {
         totalCount
       }
@@ -140,7 +143,7 @@ const statsFetcher = async (username) => {
 /**
  * Fetch all the commits for all the repositories of a given username.
  *
- * @param {*} username GitHub username.
+ * @param {string} username GitHub username.
  * @returns {Promise<number>} Total commits.
  *
  * @description Done like this because the GitHub API does not provide a way to fetch all the commits. See
@@ -201,6 +204,8 @@ const fetchStats = async (
   const stats = {
     name: "",
     totalPRs: 0,
+    totalPRsMerged: 0,
+    mergedPRsPercentage: 0,
     totalReviews: 0,
     totalCommits: 0,
     totalIssues: 0,
@@ -246,6 +251,9 @@ const fetchStats = async (
   }
 
   stats.totalPRs = user.pullRequests.totalCount;
+  stats.totalPRsMerged = user.mergedPullRequests.totalCount;
+  stats.mergedPRsPercentage =
+    (user.mergedPullRequests.totalCount / user.pullRequests.totalCount) * 100;
   stats.totalReviews =
     user.contributionsCollection.totalPullRequestReviewContributions;
   stats.totalIssues = user.openIssues.totalCount + user.closedIssues.totalCount;
diff --git a/src/fetchers/types.d.ts b/src/fetchers/types.d.ts
index 3a86205..b0cc2f4 100644
--- a/src/fetchers/types.d.ts
+++ b/src/fetchers/types.d.ts
@@ -18,6 +18,8 @@ export type RepositoryData = {
 export type StatsData = {
   name: string;
   totalPRs: number;
+  totalPRsMerged: number;
+  mergedPRsPercentage: number;
   totalReviews: number;
   totalCommits: number;
   totalIssues: number;
diff --git a/src/translations.js b/src/translations.js
index b39f17b..1ced5f6 100644
--- a/src/translations.js
+++ b/src/translations.js
@@ -325,6 +325,66 @@ const statCardLocales = ({ name, apostrophe }) => {
       vi: "Tổng Số Thảo Luận Đã Trả Lời",
       se: "Totalt antal diskussioner besvarade",
     },
+    "statcard.prs-merged": {
+      ar: "مجموع الطلبات المدمجة",
+      cn: "合并的 PR 总数",
+      "zh-tw": "合併的 PR 總數",
+      cs: "Celkem sloučených PR",
+      de: "Insgesamt zusammengeführte PRs",
+      en: "Total PRs Merged",
+      bn: "সর্বমোট PR একত্রীকৃত",
+      es: "PR totales fusionados",
+      fr: "Nombre total de PR fusionnés",
+      hu: "Összes egyesített PR",
+      it: "PR totali uniti",
+      ja: "マージされた PR の総数",
+      kr: "병합된 총 PR",
+      nl: "Totaal samengevoegde PR's",
+      "pt-pt": "Total de PRs Fundidos",
+      "pt-br": "Total de PRs Fundidos",
+      np: "कुल PRs मर्ज गरिएको",
+      el: "Σύνολο Συγχωνευμένων PR",
+      ru: "Всего объединённых pull request`ов",
+      "uk-ua": "Всього об'єднаних pull request`iв",
+      id: "Total PR Digabungkan",
+      my: "Jumlah PR Digabungkan",
+      sk: "Celkový počet zlúčených PR",
+      tr: "Toplam Birleştirilmiş PR",
+      pl: "Łącznie połączonych PR",
+      uz: "Birlangan PR-lar soni",
+      vi: "Tổng Số PR Đã Hợp Nhất",
+      se: "Totalt antal sammanfogade PR",
+    },
+    "statcard.prs-merged-percentage": {
+      ar: "نسبة الطلبات المدمجة",
+      cn: "合并的 PR 百分比",
+      "zh-tw": "合併的 PR 百分比",
+      cs: "Sloučené PRs v procentech",
+      de: "Zusammengeführte PRs in Prozent",
+      en: "Merged PRs Percentage",
+      bn: "PR একত্রীকরণের শতাংশ",
+      es: "Porcentaje de PR fusionados",
+      fr: "Pourcentage de PR fusionnés",
+      hu: "Egyesített PR-k százaléka",
+      it: "Percentuale di PR uniti",
+      ja: "マージされた PR の割合",
+      kr: "병합된 PR의 비율",
+      nl: "Percentage samengevoegde PR's",
+      "pt-pt": "Percentagem de PRs Fundidos",
+      "pt-br": "Porcentagem de PRs Fundidos",
+      np: "PR मर्ज गरिएको प्रतिशत",
+      el: "Ποσοστό Συγχωνευμένων PR",
+      ru: "Процент объединённых pull request`ов",
+      "uk-ua": "Відсоток об'єднаних pull request`iв",
+      id: "Persentase PR Digabungkan",
+      my: "Peratus PR Digabungkan",
+      sk: "Percento zlúčených PR",
+      tr: "Birleştirilmiş PR Yüzdesi",
+      pl: "Procent połączonych PR",
+      uz: "Birlangan PR-lar foizi",
+      vi: "Tỷ Lệ PR Đã Hợp Nhất",
+      se: "Procent av sammanfogade PR",
+    },
   };
 };
 


Test patch:
diff --git a/tests/api.test.js b/tests/api.test.js
index 3c72583..567d2c1 100644
--- a/tests/api.test.js
+++ b/tests/api.test.js
@@ -13,6 +13,8 @@ const stats = {
   totalCommits: 200,
   totalIssues: 300,
   totalPRs: 400,
+  totalPRsMerged: 320,
+  mergedPRsPercentage: 80,
   totalReviews: 50,
   totalDiscussionsStarted: 10,
   totalDiscussionsAnswered: 40,
@@ -41,6 +43,7 @@ const data_stats = {
         totalPullRequestReviewContributions: stats.totalReviews,
       },
       pullRequests: { totalCount: stats.totalPRs },
+      mergedPullRequests: { totalCount: stats.totalPRsMerged },
       openIssues: { totalCount: stats.totalIssues },
       closedIssues: { totalCount: 0 },
       followers: { totalCount: 0 },
diff --git a/tests/fetchStats.test.js b/tests/fetchStats.test.js
index 80b19bf..6db4ef4 100644
--- a/tests/fetchStats.test.js
+++ b/tests/fetchStats.test.js
@@ -16,6 +16,7 @@ const data_stats = {
         totalPullRequestReviewContributions: 50,
       },
       pullRequests: { totalCount: 300 },
+      mergedPullRequests: { totalCount: 240 },
       openIssues: { totalCount: 100 },
       closedIssues: { totalCount: 100 },
       followers: { totalCount: 100 },
@@ -121,6 +122,8 @@ describe("Test fetchStats", () => {
       totalCommits: 100,
       totalIssues: 200,
       totalPRs: 300,
+      totalPRsMerged: 240,
+      mergedPRsPercentage: 80,
       totalReviews: 50,
       totalStars: 300,
       totalDiscussionsStarted: 10,
@@ -155,6 +158,8 @@ describe("Test fetchStats", () => {
       totalCommits: 100,
       totalIssues: 200,
       totalPRs: 300,
+      totalPRsMerged: 240,
+      mergedPRsPercentage: 80,
       totalReviews: 50,
       totalStars: 300,
       totalDiscussionsStarted: 10,
@@ -195,6 +200,8 @@ describe("Test fetchStats", () => {
       totalCommits: 1000,
       totalIssues: 200,
       totalPRs: 300,
+      totalPRsMerged: 240,
+      mergedPRsPercentage: 80,
       totalReviews: 50,
       totalStars: 300,
       totalDiscussionsStarted: 10,
@@ -226,6 +233,8 @@ describe("Test fetchStats", () => {
       totalCommits: 1000,
       totalIssues: 200,
       totalPRs: 300,
+      totalPRsMerged: 240,
+      mergedPRsPercentage: 80,
       totalReviews: 50,
       totalStars: 200,
       totalDiscussionsStarted: 10,
@@ -255,6 +264,8 @@ describe("Test fetchStats", () => {
       totalCommits: 100,
       totalIssues: 200,
       totalPRs: 300,
+      totalPRsMerged: 240,
+      mergedPRsPercentage: 80,
       totalReviews: 50,
       totalStars: 400,
       totalDiscussionsStarted: 10,
@@ -284,6 +295,8 @@ describe("Test fetchStats", () => {
       totalCommits: 100,
       totalIssues: 200,
       totalPRs: 300,
+      totalPRsMerged: 240,
+      mergedPRsPercentage: 80,
       totalReviews: 50,
       totalStars: 300,
       totalDiscussionsStarted: 10,
@@ -313,6 +326,8 @@ describe("Test fetchStats", () => {
       totalCommits: 100,
       totalIssues: 200,
       totalPRs: 300,
+      totalPRsMerged: 240,
+      mergedPRsPercentage: 80,
       totalReviews: 50,
       totalStars: 300,
       totalDiscussionsStarted: 10,
diff --git a/tests/renderStatsCard.test.js b/tests/renderStatsCard.test.js
index 174aa07..fbc02a9 100644
--- a/tests/renderStatsCard.test.js
+++ b/tests/renderStatsCard.test.js
@@ -18,6 +18,8 @@ const stats = {
   totalCommits: 200,
   totalIssues: 300,
   totalPRs: 400,
+  totalPRsMerged: 320,
+  mergedPRsPercentage: 80,
   totalReviews: 50,
   totalDiscussionsStarted: 10,
   totalDiscussionsAnswered: 50,
@@ -52,6 +54,10 @@ describe("Test renderStatsCard", () => {
     expect(
       queryByTestId(document.body, "discussions_answered"),
     ).not.toBeInTheDocument();
+    expect(queryByTestId(document.body, "prs_merged")).not.toBeInTheDocument();
+    expect(
+      queryByTestId(document.body, "prs_merged_percentage"),
+    ).not.toBeInTheDocument();
   });
 
   it("should have proper name apostrophe", () => {
@@ -85,16 +91,24 @@ describe("Test renderStatsCard", () => {
     expect(queryByTestId(document.body, "reviews")).toBeNull();
     expect(queryByTestId(document.body, "discussions_started")).toBeNull();
     expect(queryByTestId(document.body, "discussions_answered")).toBeNull();
+    expect(queryByTestId(document.body, "prs_merged")).toBeNull();
+    expect(queryByTestId(document.body, "prs_merged_percentage")).toBeNull();
   });
 
   it("should show additional stats", () => {
     document.body.innerHTML = renderStatsCard(stats, {
-      show: ["reviews", "discussions_started", "discussions_answered"],
+      show: [
+        "reviews",
+        "discussions_started",
+        "discussions_answered",
+        "prs_merged",
+        "prs_merged_percentage",
+      ],
     });
 
     expect(
       document.body.getElementsByTagName("svg")[0].getAttribute("height"),
-    ).toBe("270");
+    ).toBe("320");
 
     expect(queryByTestId(document.body, "stars")).toBeDefined();
     expect(queryByTestId(document.body, "commits")).toBeDefined();
@@ -104,6 +118,8 @@ describe("Test renderStatsCard", () => {
     expect(queryByTestId(document.body, "reviews")).toBeDefined();
     expect(queryByTestId(document.body, "discussions_started")).toBeDefined();
     expect(queryByTestId(document.body, "discussions_answered")).toBeDefined();
+    expect(queryByTestId(document.body, "prs_merged")).toBeDefined();
+    expect(queryByTestId(document.body, "prs_merged_percentage")).toBeDefined();
   });
 
   it("should hide_rank", () => {