mirror of
https://github.com/anuraghazra/github-readme-stats.git
synced 2025-01-30 14:08:14 +08:00
fix: bug where wakatime api returns undefined languages (#1403)
Co-authored-by: Markus Tyrkkö <markus.tyrkko@nitor.com>
This commit is contained in:
parent
bc6c22ea17
commit
28fa0b8877
@ -123,7 +123,7 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => {
|
||||
} = options;
|
||||
|
||||
const shouldHideLangs = Array.isArray(hide) && hide.length > 0;
|
||||
if (shouldHideLangs) {
|
||||
if (shouldHideLangs && languages !== undefined) {
|
||||
const languagesToHide = new Set(hide.map((lang) => lowercaseTrim(lang)));
|
||||
languages = languages.filter(
|
||||
(lang) => !languagesToHide.has(lowercaseTrim(lang.name)),
|
||||
@ -138,7 +138,7 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => {
|
||||
|
||||
const lheight = parseInt(line_height, 10);
|
||||
|
||||
langsCount = clampValue(parseInt(langs_count), 1, langs_count);
|
||||
const langsCount = clampValue(parseInt(langs_count), 1, langs_count);
|
||||
|
||||
// returns theme based colors with proper overrides and defaults
|
||||
const {
|
||||
|
@ -46,4 +46,12 @@ describe("Test Render Wakatime Card", () => {
|
||||
document.body.innerHTML = renderWakatimeCard(wakaTimeData.data, {});
|
||||
expect(document.querySelector("rect")).toHaveAttribute("rx", "4.5");
|
||||
});
|
||||
|
||||
it('should show "no coding activitiy this week" message when there hasn not been activity', () => {
|
||||
document.body.innerHTML = renderWakatimeCard({
|
||||
...wakaTimeData.data,
|
||||
languages: undefined
|
||||
}, {});
|
||||
expect(document.querySelector(".stat").textContent).toBe("No coding activity this week")
|
||||
})
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user