forked from mirrored/github-readme-stats
Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
147a5d9e2a | ||
|
|
2c970b29c1 | ||
|
|
5c25f9c429 | ||
|
|
0ff426d258 | ||
|
|
4b8198fa21 | ||
|
|
70f0264905 | ||
|
|
0850a97630 | ||
|
|
5ae959b57c | ||
|
|
77dcdab42c | ||
|
|
227711c628 | ||
|
|
42fdff624f |
@@ -9,7 +9,7 @@ import {
|
|||||||
kFormatter,
|
kFormatter,
|
||||||
measureText,
|
measureText,
|
||||||
} from "../common/utils.js";
|
} from "../common/utils.js";
|
||||||
import { getStyles } from "../getStyles.js";
|
import { getStyles } from "../common/getStyles.js";
|
||||||
import { statCardLocales } from "../translations.js";
|
import { statCardLocales } from "../translations.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
getCardColors,
|
getCardColors,
|
||||||
lowercaseTrim,
|
lowercaseTrim,
|
||||||
} from "../common/utils.js";
|
} from "../common/utils.js";
|
||||||
import { getStyles } from "../getStyles.js";
|
import { getStyles } from "../common/getStyles.js";
|
||||||
import { wakatimeCardLocales } from "../translations.js";
|
import { wakatimeCardLocales } from "../translations.js";
|
||||||
|
|
||||||
/** Import language colors.
|
/** Import language colors.
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import { getAnimations } from "../getStyles.js";
|
import { getAnimations } from "./getStyles.js";
|
||||||
import { encodeHTML, flexLayout } from "./utils.js";
|
import { encodeHTML, flexLayout } from "./utils.js";
|
||||||
|
|
||||||
class Card {
|
class Card {
|
||||||
|
|||||||
@@ -45,8 +45,11 @@ const retryer = async (fetcher, variables, retries = 0) => {
|
|||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
// also checking for bad credentials if any tokens gets invalidated
|
// also checking for bad credentials if any tokens gets invalidated
|
||||||
const isBadCredential = err.response.data && err.response.data.message === "Bad credentials";
|
const isBadCredential = err.response.data && err.response.data.message === "Bad credentials";
|
||||||
|
const isAccountSuspended =
|
||||||
|
err.response.data &&
|
||||||
|
err.response.data.message === "Sorry. Your account was suspended.";
|
||||||
|
|
||||||
if (isBadCredential) {
|
if (isBadCredential || isAccountSuspended) {
|
||||||
logger.log(`PAT_${retries + 1} Failed`);
|
logger.log(`PAT_${retries + 1} Failed`);
|
||||||
retries++;
|
retries++;
|
||||||
// directly return from the function
|
// directly return from the function
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// @ts-check
|
// @ts-check
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import githubUsernameRegex from "github-username-regex";
|
import githubUsernameRegex from "github-username-regex";
|
||||||
import { calculateRank } from "../calculateRank.js";
|
import { calculateRank } from "../common/calculateRank.js";
|
||||||
import { retryer } from "../common/retryer.js";
|
import { retryer } from "../common/retryer.js";
|
||||||
import {
|
import {
|
||||||
CustomError,
|
CustomError,
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ import { jest } from "@jest/globals";
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import MockAdapter from "axios-mock-adapter";
|
import MockAdapter from "axios-mock-adapter";
|
||||||
import api from "../api/index.js";
|
import api from "../api/index.js";
|
||||||
import { calculateRank } from "../src/calculateRank.js";
|
import { calculateRank } from "../src/common/calculateRank.js";
|
||||||
import { renderStatsCard } from "../src/cards/stats-card.js";
|
import { renderStatsCard } from "../src/cards/stats-card.js";
|
||||||
import { CONSTANTS, renderError } from "../src/common/utils.js";
|
import { CONSTANTS, renderError } from "../src/common/utils.js";
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import "@testing-library/jest-dom";
|
import "@testing-library/jest-dom";
|
||||||
import { calculateRank } from "../src/calculateRank.js";
|
import { calculateRank } from "../src/common/calculateRank.js";
|
||||||
|
|
||||||
describe("Test calculateRank", () => {
|
describe("Test calculateRank", () => {
|
||||||
it("should calculate rank correctly", () => {
|
it("should calculate rank correctly", () => {
|
||||||
|
|||||||
+25
-20
@@ -11,22 +11,27 @@ import { renderStatsCard } from "../../src/cards/stats-card.js";
|
|||||||
import { renderTopLanguages } from "../../src/cards/top-languages-card.js";
|
import { renderTopLanguages } from "../../src/cards/top-languages-card.js";
|
||||||
import { renderWakatimeCard } from "../../src/cards/wakatime-card.js";
|
import { renderWakatimeCard } from "../../src/cards/wakatime-card.js";
|
||||||
|
|
||||||
const REPO = "curly-fiesta";
|
const REPO = "dummy-cra";
|
||||||
const USER = "catelinemnemosyne";
|
const USER = "grsdummy";
|
||||||
const STATS_DATA = {
|
const STATS_DATA = {
|
||||||
name: "Cateline Mnemosyne",
|
name: "grsdummy",
|
||||||
totalPRs: 1,
|
totalPRs: 2,
|
||||||
totalCommits: 7,
|
totalCommits: 2,
|
||||||
totalIssues: 1,
|
totalIssues: 1,
|
||||||
totalStars: 1,
|
totalStars: 1,
|
||||||
contributedTo: 1,
|
contributedTo: 2,
|
||||||
rank: {
|
rank: {
|
||||||
level: "A+",
|
level: "A+",
|
||||||
score: 50.893750297869225,
|
score: 50.900829325065935,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const LANGS_DATA = {
|
const LANGS_DATA = {
|
||||||
|
TypeScript: {
|
||||||
|
color: "#3178c6",
|
||||||
|
name: "TypeScript",
|
||||||
|
size: 2049,
|
||||||
|
},
|
||||||
HTML: {
|
HTML: {
|
||||||
color: "#e34c26",
|
color: "#e34c26",
|
||||||
name: "HTML",
|
name: "HTML",
|
||||||
@@ -37,19 +42,19 @@ const LANGS_DATA = {
|
|||||||
name: "CSS",
|
name: "CSS",
|
||||||
size: 930,
|
size: 930,
|
||||||
},
|
},
|
||||||
JavaScript: {
|
Python: {
|
||||||
color: "#f1e05a",
|
color: "#3572A5",
|
||||||
name: "JavaScript",
|
name: "Python",
|
||||||
size: 1912,
|
size: 671,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const WAKATIME_DATA = {
|
const WAKATIME_DATA = {
|
||||||
human_readable_range: "last week",
|
human_readable_range: "last week",
|
||||||
is_already_updating: false,
|
is_already_updating: false,
|
||||||
is_coding_activity_visible: true,
|
is_coding_activity_visible: false,
|
||||||
is_including_today: false,
|
is_including_today: false,
|
||||||
is_other_usage_visible: true,
|
is_other_usage_visible: false,
|
||||||
is_stuck: false,
|
is_stuck: false,
|
||||||
is_up_to_date: false,
|
is_up_to_date: false,
|
||||||
is_up_to_date_pending_future: false,
|
is_up_to_date_pending_future: false,
|
||||||
@@ -57,24 +62,24 @@ const WAKATIME_DATA = {
|
|||||||
range: "last_7_days",
|
range: "last_7_days",
|
||||||
status: "pending_update",
|
status: "pending_update",
|
||||||
timeout: 15,
|
timeout: 15,
|
||||||
username: USER,
|
username: "grsdummy",
|
||||||
writes_only: false,
|
writes_only: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
const REPOSITORY_DATA = {
|
const REPOSITORY_DATA = {
|
||||||
name: "cra-test",
|
name: "dummy-cra",
|
||||||
nameWithOwner: `${USER}/cra-test`,
|
nameWithOwner: "grsdummy/dummy-cra",
|
||||||
isPrivate: false,
|
isPrivate: false,
|
||||||
isArchived: false,
|
isArchived: false,
|
||||||
isTemplate: false,
|
isTemplate: false,
|
||||||
stargazers: {
|
stargazers: {
|
||||||
totalCount: 1,
|
totalCount: 1,
|
||||||
},
|
},
|
||||||
description: "Simple cra test repo.",
|
description: "Dummy create react app.",
|
||||||
primaryLanguage: {
|
primaryLanguage: {
|
||||||
color: "#f1e05a",
|
color: "#3178c6",
|
||||||
id: "MDg6TGFuZ3VhZ2UxNDA=",
|
id: "MDg6TGFuZ3VhZ2UyODc=",
|
||||||
name: "JavaScript",
|
name: "TypeScript",
|
||||||
},
|
},
|
||||||
forkCount: 0,
|
forkCount: 0,
|
||||||
starCount: 1,
|
starCount: 1,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import "@testing-library/jest-dom";
|
import "@testing-library/jest-dom";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import MockAdapter from "axios-mock-adapter";
|
import MockAdapter from "axios-mock-adapter";
|
||||||
import { calculateRank } from "../src/calculateRank.js";
|
import { calculateRank } from "../src/common/calculateRank.js";
|
||||||
import { fetchStats } from "../src/fetchers/stats-fetcher.js";
|
import { fetchStats } from "../src/fetchers/stats-fetcher.js";
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
|
|||||||
Reference in New Issue
Block a user