fix: Make WakaTime card compatible with new API (#2707)

* fix: Make WakaTime card compatible with new API

This commit makes sure that the WakaTime card works with the new
WakaTime API. See https://github.com/anuraghazra/github-readme-stats/issues/2698
for more information.

* fix: fix chinese simplified translations

* fix: improve WakaTime range order

* test: fix WakaTime tests

* refactor: remove WakaTime range loop

* refactor: remove redundant WakaTime call

* test: fix e2e tests

Co-authored-by: Hakula Chen <i@hakula.xyz>

---------

Co-authored-by: Hakula Chen <i@hakula.xyz>
This commit is contained in:
Rick Staa
2023-06-02 14:37:59 +05:30
committed by GitHub
co-authored by Hakula Chen
parent e0b3d833b0
commit c301289f7d
10 changed files with 57 additions and 22 deletions
@@ -123,7 +123,7 @@ exports[`Test Render Wakatime Card should render correctly with compact layout 1
y="0"
class="header"
data-testid="header"
>Wakatime Stats</text>
>Wakatime Stats (last 7 days)</text>
</g>
</g>
@@ -303,7 +303,7 @@ exports[`Test Render Wakatime Card should render correctly with compact layout w
y="0"
class="header"
data-testid="header"
>Wakatime Stats</text>
>Wakatime Stats (last 7 days)</text>
</g>
</g>
+1 -1
View File
@@ -54,7 +54,7 @@ const WAKATIME_DATA = {
is_up_to_date: false,
is_up_to_date_pending_future: false,
percent_calculated: 0,
range: "last_7_days",
range: "all_time",
status: "pending_update",
timeout: 15,
username: USER,
+1 -1
View File
@@ -105,7 +105,7 @@ describe("Wakatime fetcher", () => {
const username = "anuraghazra";
mock
.onGet(
`https://wakatime.com/api/v1/users/${username}/stats/all_time?is_including_today=true`,
`https://wakatime.com/api/v1/users/${username}/stats?is_including_today=true`,
)
.reply(200, wakaTimeData);
+1 -1
View File
@@ -43,7 +43,7 @@ describe("Test Render Wakatime Card", () => {
expect(
document.querySelector('g[transform="translate(0, 0)"]>text.stat.bold')
.textContent,
).toBe("本周没有编程活动");
).toBe("Wakatime 用户个人资料未公开");
});
it("should render without rounding", () => {