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