refactor: organize imports inside tests files (#4542)
Co-authored-by: Alexandr <qwerty541zxc@gmail.com>
This commit is contained in:
committed by
martin-mfg
co-authored by
Alexandr
parent
bcecc583df
commit
c0901616e2
@@ -1,19 +1,19 @@
|
||||
// @ts-check
|
||||
|
||||
import {
|
||||
afterEach,
|
||||
beforeEach,
|
||||
describe,
|
||||
expect,
|
||||
it,
|
||||
jest,
|
||||
} from "@jest/globals";
|
||||
import axios from "axios";
|
||||
import MockAdapter from "axios-mock-adapter";
|
||||
import api from "../api-renamed/index.js";
|
||||
import { calculateRank } from "../src/calculateRank.js";
|
||||
import { renderStatsCard } from "../src/cards/stats.js";
|
||||
import { CONSTANTS, renderError } from "../src/common/utils.js";
|
||||
import {
|
||||
expect,
|
||||
it,
|
||||
describe,
|
||||
afterEach,
|
||||
beforeEach,
|
||||
jest,
|
||||
} from "@jest/globals";
|
||||
|
||||
/**
|
||||
* @type {import("../src/fetchers/stats").StatsData}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from "@jest/globals";
|
||||
import "@testing-library/jest-dom";
|
||||
import { calculateRank } from "../src/calculateRank.js";
|
||||
import { expect, it, describe } from "@jest/globals";
|
||||
|
||||
describe("Test calculateRank", () => {
|
||||
it("new user gets C rank", () => {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { describe, expect, it } from "@jest/globals";
|
||||
import { queryByTestId } from "@testing-library/dom";
|
||||
import "@testing-library/jest-dom";
|
||||
import { cssToObject } from "@uppercod/css-to-object";
|
||||
import { Card } from "../src/common/Card.js";
|
||||
import { icons } from "../src/common/icons.js";
|
||||
import { getCardColors } from "../src/common/utils.js";
|
||||
import { expect, it, describe } from "@jest/globals";
|
||||
|
||||
describe("Card", () => {
|
||||
it("should hide border", () => {
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
import dotenv from "dotenv";
|
||||
dotenv.config();
|
||||
|
||||
import { beforeAll, describe, expect, test } from "@jest/globals";
|
||||
import axios from "axios";
|
||||
import { renderGistCard } from "../../src/cards/gist.js";
|
||||
import { renderRepoCard } from "../../src/cards/repo.js";
|
||||
import { renderStatsCard } from "../../src/cards/stats.js";
|
||||
import { renderTopLanguages } from "../../src/cards/top-languages.js";
|
||||
import { renderWakatimeCard } from "../../src/cards/wakatime.js";
|
||||
import { renderGistCard } from "../../src/cards/gist.js";
|
||||
import { expect, describe, beforeAll, test } from "@jest/globals";
|
||||
|
||||
const REPO = "curly-fiesta";
|
||||
const USER = "catelinemnemosyne";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { afterEach, describe, expect, it } from "@jest/globals";
|
||||
import "@testing-library/jest-dom";
|
||||
import axios from "axios";
|
||||
import MockAdapter from "axios-mock-adapter";
|
||||
import { expect, it, describe, afterEach } from "@jest/globals";
|
||||
import { fetchGist } from "../src/fetchers/gist.js";
|
||||
|
||||
const gist_data = {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { afterEach, describe, expect, it } from "@jest/globals";
|
||||
import "@testing-library/jest-dom";
|
||||
import axios from "axios";
|
||||
import MockAdapter from "axios-mock-adapter";
|
||||
import { fetchRepo } from "../src/fetchers/repo.js";
|
||||
import { expect, it, describe, afterEach } from "@jest/globals";
|
||||
|
||||
const data_repo = {
|
||||
repository: {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { afterEach, beforeEach, describe, expect, it } from "@jest/globals";
|
||||
import "@testing-library/jest-dom";
|
||||
import axios from "axios";
|
||||
import MockAdapter from "axios-mock-adapter";
|
||||
import { calculateRank } from "../src/calculateRank.js";
|
||||
import { fetchStats } from "../src/fetchers/stats.js";
|
||||
import { expect, it, describe, beforeEach, afterEach } from "@jest/globals";
|
||||
|
||||
// Test parameters.
|
||||
const data_stats = {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { afterEach, describe, expect, it } from "@jest/globals";
|
||||
import "@testing-library/jest-dom";
|
||||
import axios from "axios";
|
||||
import MockAdapter from "axios-mock-adapter";
|
||||
import { fetchTopLanguages } from "../src/fetchers/top-languages.js";
|
||||
import { expect, it, describe, afterEach } from "@jest/globals";
|
||||
|
||||
const mock = new MockAdapter(axios);
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { afterEach, describe, expect, it } from "@jest/globals";
|
||||
import "@testing-library/jest-dom";
|
||||
import axios from "axios";
|
||||
import MockAdapter from "axios-mock-adapter";
|
||||
import { fetchWakatimeStats } from "../src/fetchers/wakatime.js";
|
||||
import { expect, it, describe, afterEach } from "@jest/globals";
|
||||
|
||||
const mock = new MockAdapter(axios);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "@jest/globals";
|
||||
import { flexLayout } from "../src/common/utils.js";
|
||||
import { expect, it, describe } from "@jest/globals";
|
||||
|
||||
describe("flexLayout", () => {
|
||||
it("should work with row & col layouts", () => {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// @ts-check
|
||||
|
||||
import { afterEach, describe, expect, it, jest } from "@jest/globals";
|
||||
import "@testing-library/jest-dom";
|
||||
import axios from "axios";
|
||||
import MockAdapter from "axios-mock-adapter";
|
||||
import { expect, it, describe, afterEach, jest } from "@jest/globals";
|
||||
import gist from "../api-renamed/gist.js";
|
||||
import { renderGistCard } from "../src/cards/gist.js";
|
||||
import { CONSTANTS, renderError } from "../src/common/utils.js";
|
||||
import gist from "../api-renamed/gist.js";
|
||||
|
||||
const gist_data = {
|
||||
data: {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { expect, it, describe } from "@jest/globals";
|
||||
import { describe, expect, it } from "@jest/globals";
|
||||
import { I18n } from "../src/common/I18n.js";
|
||||
import { statCardLocales } from "../src/translations.js";
|
||||
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
/**
|
||||
* @file Tests for the status/pat-info cloud function.
|
||||
*/
|
||||
|
||||
import dotenv from "dotenv";
|
||||
dotenv.config();
|
||||
|
||||
import {
|
||||
afterEach,
|
||||
beforeAll,
|
||||
describe,
|
||||
expect,
|
||||
it,
|
||||
jest,
|
||||
} from "@jest/globals";
|
||||
import axios from "axios";
|
||||
import MockAdapter from "axios-mock-adapter";
|
||||
import patInfo, { RATE_LIMIT_SECONDS } from "../api-renamed/status/pat-info.js";
|
||||
import {
|
||||
expect,
|
||||
it,
|
||||
describe,
|
||||
afterEach,
|
||||
beforeAll,
|
||||
jest,
|
||||
} from "@jest/globals";
|
||||
|
||||
const mock = new MockAdapter(axios);
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// @ts-check
|
||||
|
||||
import { afterEach, describe, expect, it, jest } from "@jest/globals";
|
||||
import "@testing-library/jest-dom";
|
||||
import axios from "axios";
|
||||
import MockAdapter from "axios-mock-adapter";
|
||||
import pin from "../api-renamed/pin.js";
|
||||
import { renderRepoCard } from "../src/cards/repo.js";
|
||||
import { CONSTANTS, renderError } from "../src/common/utils.js";
|
||||
import { expect, it, describe, afterEach, jest } from "@jest/globals";
|
||||
|
||||
const data_repo = {
|
||||
repository: {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { renderGistCard } from "../src/cards/gist.js";
|
||||
import { describe, expect, it } from "@jest/globals";
|
||||
import { queryByTestId } from "@testing-library/dom";
|
||||
import { cssToObject } from "@uppercod/css-to-object";
|
||||
import { themes } from "../themes/index.js";
|
||||
import "@testing-library/jest-dom";
|
||||
import { cssToObject } from "@uppercod/css-to-object";
|
||||
import { renderGistCard } from "../src/cards/gist.js";
|
||||
import { themes } from "../themes/index.js";
|
||||
|
||||
/**
|
||||
* @type {import("../src/fetchers/gist").GistData}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { describe, expect, it } from "@jest/globals";
|
||||
import { queryByTestId } from "@testing-library/dom";
|
||||
import "@testing-library/jest-dom";
|
||||
import { cssToObject } from "@uppercod/css-to-object";
|
||||
import { renderRepoCard } from "../src/cards/repo.js";
|
||||
import { expect, it, describe } from "@jest/globals";
|
||||
|
||||
import { themes } from "../themes/index.js";
|
||||
|
||||
const data_repo = {
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
import { describe, expect, it } from "@jest/globals";
|
||||
import {
|
||||
getByTestId,
|
||||
queryAllByTestId,
|
||||
queryByTestId,
|
||||
} from "@testing-library/dom";
|
||||
import "@testing-library/jest-dom";
|
||||
import { cssToObject } from "@uppercod/css-to-object";
|
||||
import { renderStatsCard } from "../src/cards/stats.js";
|
||||
import { expect, it, describe } from "@jest/globals";
|
||||
import { CustomError } from "../src/common/utils.js";
|
||||
|
||||
// adds special assertions like toHaveTextContent
|
||||
import "@testing-library/jest-dom";
|
||||
|
||||
import { themes } from "../themes/index.js";
|
||||
|
||||
const stats = {
|
||||
|
||||
@@ -1,27 +1,25 @@
|
||||
import { describe, expect, it } from "@jest/globals";
|
||||
import { queryAllByTestId, queryByTestId } from "@testing-library/dom";
|
||||
import "@testing-library/jest-dom";
|
||||
import { cssToObject } from "@uppercod/css-to-object";
|
||||
import {
|
||||
getLongestLang,
|
||||
degreesToRadians,
|
||||
radiansToDegrees,
|
||||
polarToCartesian,
|
||||
cartesianToPolar,
|
||||
getCircleLength,
|
||||
MIN_CARD_WIDTH,
|
||||
calculateCompactLayoutHeight,
|
||||
calculateNormalLayoutHeight,
|
||||
calculateDonutLayoutHeight,
|
||||
calculateDonutVerticalLayoutHeight,
|
||||
calculateNormalLayoutHeight,
|
||||
calculatePieLayoutHeight,
|
||||
cartesianToPolar,
|
||||
degreesToRadians,
|
||||
donutCenterTranslation,
|
||||
trimTopLanguages,
|
||||
renderTopLanguages,
|
||||
MIN_CARD_WIDTH,
|
||||
getCircleLength,
|
||||
getDefaultLanguagesCountByLayout,
|
||||
getLongestLang,
|
||||
polarToCartesian,
|
||||
radiansToDegrees,
|
||||
renderTopLanguages,
|
||||
trimTopLanguages,
|
||||
} from "../src/cards/top-languages.js";
|
||||
import { expect, it, describe } from "@jest/globals";
|
||||
|
||||
// adds special assertions like toHaveTextContent
|
||||
import "@testing-library/jest-dom";
|
||||
|
||||
import { themes } from "../themes/index.js";
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { describe, expect, it } from "@jest/globals";
|
||||
import { queryByTestId } from "@testing-library/dom";
|
||||
import "@testing-library/jest-dom";
|
||||
import { renderWakatimeCard } from "../src/cards/wakatime.js";
|
||||
import { wakaTimeData } from "./fetchWakatime.test.js";
|
||||
import { expect, it, describe } from "@jest/globals";
|
||||
|
||||
describe("Test Render WakaTime Card", () => {
|
||||
it("should render correctly", () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { describe, expect, it, jest } from "@jest/globals";
|
||||
import "@testing-library/jest-dom";
|
||||
import { retryer, RETRIES } from "../src/common/retryer.js";
|
||||
import { RETRIES, retryer } from "../src/common/retryer.js";
|
||||
import { logger } from "../src/common/utils.js";
|
||||
import { expect, it, describe, jest } from "@jest/globals";
|
||||
|
||||
const fetcher = jest.fn((variables, token) => {
|
||||
logger.log(variables, token);
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
* @file Tests for the status/up cloud function.
|
||||
*/
|
||||
|
||||
import { afterEach, describe, expect, it, jest } from "@jest/globals";
|
||||
import axios from "axios";
|
||||
import MockAdapter from "axios-mock-adapter";
|
||||
import up, { RATE_LIMIT_SECONDS } from "../api-renamed/status/up.js";
|
||||
import { expect, it, describe, afterEach, jest } from "@jest/globals";
|
||||
|
||||
const mock = new MockAdapter(axios);
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// @ts-check
|
||||
|
||||
import { afterEach, describe, expect, it, jest } from "@jest/globals";
|
||||
import "@testing-library/jest-dom";
|
||||
import axios from "axios";
|
||||
import MockAdapter from "axios-mock-adapter";
|
||||
import topLangs from "../api-renamed/top-langs.js";
|
||||
import { renderTopLanguages } from "../src/cards/top-languages.js";
|
||||
import { CONSTANTS, renderError } from "../src/common/utils.js";
|
||||
import { expect, it, describe, afterEach, jest } from "@jest/globals";
|
||||
|
||||
const data_langs = {
|
||||
data: {
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { describe, expect, it } from "@jest/globals";
|
||||
import { queryByTestId } from "@testing-library/dom";
|
||||
import "@testing-library/jest-dom";
|
||||
import {
|
||||
encodeHTML,
|
||||
formatBytes,
|
||||
getCardColors,
|
||||
kFormatter,
|
||||
parseBoolean,
|
||||
renderError,
|
||||
wrapTextMultiline,
|
||||
formatBytes,
|
||||
} from "../src/common/utils.js";
|
||||
import { expect, it, describe } from "@jest/globals";
|
||||
|
||||
describe("Test utils.js", () => {
|
||||
it("should test kFormatter", () => {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { afterEach, describe, expect, it, jest } from "@jest/globals";
|
||||
import "@testing-library/jest-dom";
|
||||
import axios from "axios";
|
||||
import MockAdapter from "axios-mock-adapter";
|
||||
import wakatime from "../api-renamed/wakatime.js";
|
||||
import { renderWakatimeCard } from "../src/cards/wakatime.js";
|
||||
import { expect, it, describe, afterEach, jest } from "@jest/globals";
|
||||
|
||||
const wakaTimeData = {
|
||||
data: {
|
||||
|
||||
Reference in New Issue
Block a user