mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-21 06:40:39 +00:00
refactor: Update import statement for jest in setupTest.js
This commit updates the import statement for jest in the setupTest.js file. The previous import statement used "globals" as the module name, which is incorrect. The correct module name is "jest". This change ensures that the jest module is imported correctly, improving the accuracy and reliability of the test setup.
This commit is contained in:
parent
fcd6c8ea7d
commit
e9c94876c0
@ -10,6 +10,7 @@ import ComponentMetadata, {
|
||||
} from "Common/Types/Workflow/Component";
|
||||
import React from "react";
|
||||
|
||||
|
||||
/// @dev we use different UUID for (id & title), description, and category to ensure that the component is unique
|
||||
|
||||
type GetComponentMetadataFunction = (category?: string) => ComponentMetadata;
|
||||
|
@ -2,7 +2,7 @@ import { ButtonStyleType } from "../../Components/Button/Button";
|
||||
import ConfirmModal, {
|
||||
ComponentProps,
|
||||
} from "../../Components/Modal/ConfirmModal";
|
||||
import { describe, expect, it } from "@jest/globals";
|
||||
import { describe, expect, it, jest, beforeEach } from "@jest/globals";
|
||||
import { fireEvent, render, screen } from "@testing-library/react";
|
||||
import React from "react";
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
import DictionaryOfStrings, {
|
||||
ComponentProps,
|
||||
} from "../../Components/Dictionary/DictionaryOfStrings";
|
||||
import { describe, expect, it } from "@jest/globals";
|
||||
import { describe, expect, it, jest } from "@jest/globals";
|
||||
import "@testing-library/jest-dom/extend-expect";
|
||||
import { fireEvent, render, screen } from "@testing-library/react";
|
||||
import Dictionary from "Common/Types/Dictionary";
|
||||
|
@ -2,6 +2,7 @@ import HiddenText from "../../Components/HiddenText/HiddenText";
|
||||
import "@testing-library/jest-dom/extend-expect";
|
||||
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
|
||||
import React from "react";
|
||||
import { describe, expect, test } from "@jest/globals";
|
||||
|
||||
describe("tests for HiddenText component", () => {
|
||||
test("it should click hidden-text and reveal text in document", async () => {
|
||||
|
@ -2,6 +2,7 @@ import Input, { ComponentProps, InputType } from "../../Components/Input/Input";
|
||||
import "@testing-library/jest-dom/extend-expect";
|
||||
import { cleanup, fireEvent, render, screen } from "@testing-library/react";
|
||||
import React from "react";
|
||||
import { describe, expect, afterEach, jest } from "@jest/globals";
|
||||
|
||||
describe("Input", () => {
|
||||
afterEach(() => {
|
||||
|
@ -3,6 +3,8 @@ import "@testing-library/jest-dom/extend-expect";
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import Color from "Common/Types/Color";
|
||||
import React from "react";
|
||||
import { describe, expect } from "@jest/globals";
|
||||
|
||||
|
||||
describe("Loader tests", () => {
|
||||
test("it should render if bar loader show up", () => {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { ButtonStyleType } from "../../Components/Button/Button";
|
||||
import ButtonType from "../../Components/Button/ButtonTypes";
|
||||
import Modal, { ModalWidth } from "../../Components/Modal/Modal";
|
||||
import { describe, expect, it } from "@jest/globals";
|
||||
import { jest, describe, expect, it } from "@jest/globals";
|
||||
import "@testing-library/jest-dom/extend-expect";
|
||||
import { fireEvent, render } from "@testing-library/react";
|
||||
import IconProp from "Common/Types/Icon/IconProp";
|
||||
|
@ -5,6 +5,7 @@ import { describe, expect, it } from "@jest/globals";
|
||||
import "@testing-library/jest-dom";
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import React from "react";
|
||||
import { describe, expect } from "@jest/globals";
|
||||
|
||||
describe("OrderedSateList", () => {
|
||||
interface ItemData {
|
||||
|
@ -5,6 +5,7 @@ import { describe, expect, it } from "@jest/globals";
|
||||
import "@testing-library/jest-dom/extend-expect";
|
||||
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
|
||||
import React from "react";
|
||||
import { describe, expect } from "@jest/globals";
|
||||
|
||||
describe("Pagination", () => {
|
||||
it("renders Component", () => {
|
||||
|
@ -3,6 +3,7 @@ import "@testing-library/jest-dom/extend-expect";
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import Color from "Common/Types/Color";
|
||||
import * as React from "react";
|
||||
import { describe, expect } from "@jest/globals";
|
||||
|
||||
describe("<Pill />", () => {
|
||||
test("Checking text", () => {
|
||||
|
@ -4,6 +4,7 @@ import { render, screen } from "@testing-library/react";
|
||||
import ObjectID from "Common/Types/ObjectID";
|
||||
import Probe from "Model/Models/Probe";
|
||||
import * as React from "react";
|
||||
import { describe, expect } from "@jest/globals";
|
||||
|
||||
describe("ProbeElement Component", () => {
|
||||
const mockProbe: Probe = new Probe();
|
||||
|
@ -2,6 +2,7 @@ import ProgressBar from "../../Components/ProgressBar/ProgressBar";
|
||||
import "@testing-library/jest-dom/extend-expect";
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import * as React from "react";
|
||||
import { describe, expect } from "@jest/globals";
|
||||
|
||||
describe("ProgressBar Component", () => {
|
||||
function getProgressBar(): HTMLElement {
|
||||
|
@ -4,6 +4,7 @@ import RadioButtons, {
|
||||
import "@testing-library/jest-dom/extend-expect";
|
||||
import { fireEvent, render } from "@testing-library/react";
|
||||
import React from "react";
|
||||
import { describe, expect } from "@jest/globals";
|
||||
|
||||
describe("RadioButtons", () => {
|
||||
const options: RadioButton[] = [
|
||||
|
@ -2,6 +2,7 @@ import SideOver, { ComponentProps } from "../../Components/SideOver/SideOver";
|
||||
import "@testing-library/jest-dom/extend-expect";
|
||||
import { fireEvent, render, screen } from "@testing-library/react";
|
||||
import React, { ReactElement } from "react";
|
||||
import { describe, expect } from "@jest/globals";
|
||||
|
||||
describe("SideOver", () => {
|
||||
const childElementText: string = "child element";
|
||||
|
@ -3,6 +3,7 @@ import Tabs from "../../Components/Tabs/Tabs";
|
||||
import "@testing-library/jest-dom/extend-expect";
|
||||
import { fireEvent, render } from "@testing-library/react";
|
||||
import React from "react";
|
||||
import { describe, expect } from "@jest/globals";
|
||||
|
||||
describe("Tabs", () => {
|
||||
const activeClass: string = "bg-gray-100 text-gray-700";
|
||||
|
@ -2,6 +2,7 @@ import TextArea from "../../Components/TextArea/TextArea";
|
||||
import "@testing-library/jest-dom/extend-expect";
|
||||
import { fireEvent, render } from "@testing-library/react";
|
||||
import React from "react";
|
||||
import { describe, expect } from "@jest/globals";
|
||||
|
||||
describe("TextArea", () => {
|
||||
test("renders textarea element with initialValue only", () => {
|
||||
|
@ -5,6 +5,7 @@ import userEvent from "@testing-library/user-event";
|
||||
import { UserEvent } from "@testing-library/user-event/dist/types/setup/setup";
|
||||
import OneUptimeDate from "Common/Types/Date";
|
||||
import * as React from "react";
|
||||
import { describe, expect } from "@jest/globals";
|
||||
|
||||
describe("Test for Toast.tsx", () => {
|
||||
test("should render the component", () => {
|
||||
|
@ -15,13 +15,13 @@ const logger = new FluentClient("fluentd.test", {
|
||||
},
|
||||
});
|
||||
|
||||
app.get("/", function (request, response) {
|
||||
app.get("/", (request, response) => {
|
||||
logger.emit("follow", { from: "userA", to: "userB" });
|
||||
response.send("Hello World!");
|
||||
});
|
||||
|
||||
const port = 7856;
|
||||
|
||||
app.listen(port, function () {
|
||||
app.listen(port, () => {
|
||||
console.log("Listening on " + port);
|
||||
});
|
||||
|
@ -23,7 +23,7 @@
|
||||
// };
|
||||
|
||||
exports.hook_rcpt = function (next, connection, params) {
|
||||
var rcpt = params[0];
|
||||
const rcpt = params[0];
|
||||
this.loginfo("Got recipient: " + rcpt);
|
||||
next();
|
||||
};
|
||||
|
@ -5,6 +5,7 @@ import Hostname from "Common/Types/API/Hostname";
|
||||
import BadDataException from "Common/Types/Exception/BadDataException";
|
||||
import IPv4 from "Common/Types/IP/IPv4";
|
||||
import PositiveNumber from "Common/Types/PositiveNumber";
|
||||
import { describe, expect } from "@jest/globals";
|
||||
|
||||
describe("Ping", () => {
|
||||
jest.setTimeout(240000);
|
||||
|
152
eslint.config.js
152
eslint.config.js
@ -4,6 +4,8 @@ import eslint from "@eslint/js";
|
||||
import tseslint from "typescript-eslint";
|
||||
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
|
||||
import globals from "globals";
|
||||
import unusedImports from "eslint-plugin-unused-imports";
|
||||
import react from "eslint-plugin-react";
|
||||
|
||||
export default tseslint.config(
|
||||
{
|
||||
@ -30,6 +32,11 @@ export default tseslint.config(
|
||||
...tseslint.configs.recommended, // TODO: make this strict and not recommended
|
||||
eslintPluginPrettierRecommended,
|
||||
{
|
||||
plugins: {
|
||||
"unused-imports": unusedImports,
|
||||
react: react,
|
||||
},
|
||||
|
||||
rules: {
|
||||
"no-control-regex": "off", // TODO: Remove this rule
|
||||
"@typescript-eslint/no-explicit-any": "off", // TODO: Remove this rule
|
||||
@ -37,20 +44,161 @@ export default tseslint.config(
|
||||
"@typescript-eslint/no-duplicate-enum-values": "off", // TODO: Remove this rule
|
||||
"no-constant-binary-expression": "off", // TODO: Remove this rule
|
||||
"@typescript-eslint/ban-ts-comment": "off", // TODO: Remove this rule
|
||||
"multiline-comment-style": "off", // TODO: Remove this rule
|
||||
"no-fallthrough": "error",
|
||||
"no-unreachable": "error",
|
||||
"no-cond-assign": "error",
|
||||
"valid-typeof": "error",
|
||||
"no-func-assign": "error",
|
||||
curly: "error",
|
||||
"no-extra-semi": "error",
|
||||
"no-else-return": "error",
|
||||
"no-div-regex": "error",
|
||||
"no-octal": "error",
|
||||
"no-extra-bind": "error",
|
||||
"unicode-bom": "error",
|
||||
"no-extra-boolean-cast": "error",
|
||||
"wrap-regex": "error",
|
||||
"wrap-iife": "error",
|
||||
"yield-star-spacing": "error",
|
||||
"no-implicit-coercion": "error",
|
||||
"no-extra-label": "error",
|
||||
|
||||
"no-lonely-if": "error",
|
||||
"no-floating-decimal": "error",
|
||||
eqeqeq: "error",
|
||||
"dot-notation": "off", // Off because it messes up with typescript compiler.
|
||||
"@typescript-eslint/dot-notation": "off", //temp off.
|
||||
"linebreak-style": ["error", "unix"],
|
||||
"@typescript-eslint/no-empty-interface": [
|
||||
"error",
|
||||
{
|
||||
allowSingleExtends: true,
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
argsIgnorePattern: "^_",
|
||||
varsIgnorePattern: "^_",
|
||||
caughtErrorsIgnorePattern: "^_",
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/no-extra-non-null-assertion": "error",
|
||||
"@typescript-eslint/no-floating-promises": "error",
|
||||
"@typescript-eslint/await-thenable": "error",
|
||||
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
||||
"unused-imports/no-unused-imports": "error",
|
||||
"unused-imports/no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
vars: "all",
|
||||
varsIgnorePattern: "^_",
|
||||
args: "after-used",
|
||||
argsIgnorePattern: "^_",
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/explicit-member-accessibility": ["error"],
|
||||
"no-console": "error",
|
||||
"no-undef": "error",
|
||||
"no-empty": "error",
|
||||
"prefer-arrow-callback": "error",
|
||||
"constructor-super": "error",
|
||||
"no-case-declarations": "error",
|
||||
"no-mixed-spaces-and-tabs": "error",
|
||||
"no-useless-escape": "error",
|
||||
"prettier/prettier": "error",
|
||||
"react/jsx-no-undef": "error",
|
||||
"react/jsx-no-bind": [
|
||||
"error",
|
||||
{
|
||||
allowArrowFunctions: true,
|
||||
allowBind: false,
|
||||
ignoreRefs: false,
|
||||
},
|
||||
],
|
||||
"react/no-children-prop": "error",
|
||||
"react/no-deprecated": "error",
|
||||
"react/boolean-prop-naming": "error",
|
||||
"react/no-is-mounted": "error",
|
||||
"react/no-find-dom-node": "error",
|
||||
"one-var-declaration-per-line": "error",
|
||||
"arrow-parens": "error",
|
||||
"arrow-body-style": ["error", "always"],
|
||||
"@typescript-eslint/typedef": [
|
||||
"error",
|
||||
{
|
||||
arrowParameter: true,
|
||||
variableDeclaration: true,
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/strict-boolean-expressions": "off", //Need to enable this very soon
|
||||
"@typescript-eslint/explicit-function-return-type": [
|
||||
"error",
|
||||
{
|
||||
allowExpressions: true,
|
||||
},
|
||||
],
|
||||
"react/no-did-update-set-state": "error",
|
||||
"react/no-unknown-property": "error",
|
||||
"react/no-unused-prop-types": "error",
|
||||
"react/jsx-no-duplicate-props": "error",
|
||||
"react/no-unused-state": "error",
|
||||
"react/jsx-uses-vars": "error",
|
||||
"react/prop-types": "error",
|
||||
"react/react-in-jsx-scope": "error",
|
||||
"react/no-string-refs": "error",
|
||||
"jsx-a11y/href-no-hash": [0],
|
||||
"react/no-unescaped-entities": "error",
|
||||
"react/display-name": "error",
|
||||
"react/jsx-pascal-case": "error",
|
||||
"array-callback-return": "error",
|
||||
"no-loop-func": "error",
|
||||
"no-duplicate-imports": "error",
|
||||
"no-promise-executor-return": "error",
|
||||
"capitalized-comments": "off", // this is turned off because come commented code should not be capitalized.
|
||||
"for-direction": "error",
|
||||
"getter-return": "error",
|
||||
"no-async-promise-executor": "error",
|
||||
"prefer-const": [
|
||||
"error",
|
||||
{
|
||||
destructuring: "any",
|
||||
ignoreReadBeforeAssign: false,
|
||||
},
|
||||
],
|
||||
"no-var": "error",
|
||||
"object-curly-spacing": ["error", "always"],
|
||||
"no-unneeded-ternary": "error",
|
||||
"@typescript-eslint/ban-types": [
|
||||
"error",
|
||||
{
|
||||
types: {
|
||||
String: true,
|
||||
Boolean: true,
|
||||
Number: true,
|
||||
Symbol: false,
|
||||
"{}": true,
|
||||
Object: true,
|
||||
object: true,
|
||||
Function: true,
|
||||
},
|
||||
extendDefaults: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
settings: {
|
||||
react: {
|
||||
version: "18.1.0",
|
||||
},
|
||||
},
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.browser,
|
||||
...globals.node,
|
||||
},
|
||||
parserOptions: {
|
||||
project: ["./tsconfig.json"], // Specify it only for TypeScript files
|
||||
// or `project: true` in typescript-eslint version >= 5.52.0
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
|
1598
package-lock.json
generated
1598
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -6,6 +6,8 @@
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@types/lodash": "^4.17.1",
|
||||
"eslint-plugin-react": "^7.34.2",
|
||||
"eslint-plugin-unused-imports": "^3.2.0",
|
||||
"globals": "^15.4.0",
|
||||
"jest": "^29.7.0",
|
||||
"mailparser": "^3.7.1",
|
||||
|
Loading…
Reference in New Issue
Block a user