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:
Simon Larsen 2024-06-14 14:11:32 +01:00
parent e9c94876c0
commit 48e3c24c6e
No known key found for this signature in database
GPG Key ID: 96C5DCA24769DBCA
24 changed files with 23 additions and 17 deletions

View File

@ -5,6 +5,7 @@ import Route from "Common/Types/API/Route";
import URL from "Common/Types/API/URL";
import Email from "Common/Types/Email";
import * as React from "react";
import { describe, expect, jest } from "@jest/globals";
// Mock the Navigation module to avoid real navigation
jest.mock("../../Utils/Navigation", () => {

View File

@ -2,6 +2,7 @@ import Alert, { AlertType } from "../../Components/Alerts/Alert";
import "@testing-library/jest-dom/extend-expect";
import { fireEvent, render, screen } from "@testing-library/react";
import React from "react";
import { describe, expect, jest } from "@jest/globals";
describe("alert tests", () => {
test("it should render all props passed", () => {

View File

@ -2,6 +2,7 @@ import Badge, { BadgeType } from "../../Components/Badge/Badge";
import "@testing-library/jest-dom/extend-expect";
import { render, screen } from "@testing-library/react";
import React from "react";
import { describe, expect, test } from "@jest/globals";
describe("Badge", () => {
test("it should render all props", () => {

View File

@ -8,6 +8,7 @@ import userEvent from "@testing-library/user-event";
import { UserEvent } from "@testing-library/user-event/dist/types/setup/setup";
import Route from "Common/Types/API/Route";
import * as React from "react";
import { describe, expect, jest } from "@jest/globals";
describe("BasicForm test", () => {
const fields: Fields<FormValues<any>> = [

View File

@ -1,6 +1,6 @@
import Breadcrumbs from "../../Components/Breadcrumbs/Breadcrumbs";
import Navigation from "../../Utils/Navigation";
import { describe, expect, test } from "@jest/globals";
import { describe, expect, test, jest } from "@jest/globals";
import Route from "Common/Types/API/Route";
import Link from "Common/Types/Link";
import * as React from "react";

View File

@ -8,6 +8,7 @@ import "@testing-library/jest-dom/extend-expect";
import { fireEvent, render, screen } from "@testing-library/react";
import IconProp from "Common/Types/Icon/IconProp";
import React from "react";
import { describe, expect, jest } from "@jest/globals";
describe("Button", () => {
test("it should render correctly with title and icon", () => {

View File

@ -7,6 +7,7 @@ import "@testing-library/jest-dom/extend-expect";
import { fireEvent, render, screen } from "@testing-library/react";
import IconProp from "Common/Types/Icon/IconProp";
import React, { ReactElement } from "react";
import { describe, expect, jest } from "@jest/globals";
describe("Card", () => {
const props: ComponentProps = {

View File

@ -3,6 +3,7 @@ import "@testing-library/jest-dom/extend-expect";
import { fireEvent, render } from "@testing-library/react";
import Color from "Common/Types/Color";
import * as React from "react";
import { describe, expect, jest } from "@jest/globals";
describe("Color Viewer", () => {
test("Render the component", () => {

View File

@ -10,7 +10,6 @@ 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;

View File

@ -2,7 +2,7 @@ import Dropdown, { DropdownOption } from "../../Components/Dropdown/Dropdown";
import "@testing-library/jest-dom/extend-expect";
import { fireEvent, render, screen } from "@testing-library/react";
import React from "react";
import { describe, expect, jest } from "@jest/globals";
describe("Dropdown", () => {
const options: DropdownOption[] = [
{ value: "1", label: "1" },

View File

@ -1,7 +1,7 @@
import DuplicateModel from "../../Components/DuplicateModel/DuplicateModel";
import { ModelField } from "../../Components/Forms/ModelForm";
import Select from "../../Utils/BaseDatabase/Select";
import { describe, expect, it } from "@jest/globals";
import { describe, expect, it, jest } from "@jest/globals";
import {
fireEvent,
render,

View File

@ -3,8 +3,7 @@ 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";
import { describe, expect, test } from "@jest/globals";
describe("Loader tests", () => {
test("it should render if bar loader show up", () => {

View File

@ -5,7 +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";
import { describe, expect, jest } from "@jest/globals";
describe("OrderedSateList", () => {
interface ItemData {

View File

@ -5,7 +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";
import { describe, expect, jest } from "@jest/globals";
describe("Pagination", () => {
it("renders Component", () => {

View File

@ -3,7 +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";
import { describe, expect, test } from "@jest/globals";
describe("<Pill />", () => {
test("Checking text", () => {

View File

@ -4,7 +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";
import { describe, expect, test } from "@jest/globals";
describe("ProbeElement Component", () => {
const mockProbe: Probe = new Probe();

View File

@ -2,7 +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";
import { describe, expect, test } from "@jest/globals";
describe("ProgressBar Component", () => {
function getProgressBar(): HTMLElement {

View File

@ -4,7 +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";
import { describe, expect, jest, test } from "@jest/globals";
describe("RadioButtons", () => {
const options: RadioButton[] = [

View File

@ -2,7 +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";
import { describe, expect, jest, test } from "@jest/globals";
describe("SideOver", () => {
const childElementText: string = "child element";

View File

@ -3,7 +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";
import { describe, expect, jest, test } from "@jest/globals";
describe("Tabs", () => {
const activeClass: string = "bg-gray-100 text-gray-700";

View File

@ -2,7 +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";
import { describe, expect, test, jest } from "@jest/globals";
describe("TextArea", () => {
test("renders textarea element with initialValue only", () => {

View File

@ -5,7 +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";
import { describe, expect, test } from "@jest/globals";
describe("Test for Toast.tsx", () => {
test("should render the component", () => {

View File

@ -5,7 +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";
import { describe, expect, jest, test } from "@jest/globals";
describe("Ping", () => {
jest.setTimeout(240000);

View File

@ -194,6 +194,7 @@ export default tseslint.config(
globals: {
...globals.browser,
...globals.node,
JSX: true,
},
parserOptions: {
project: ["./tsconfig.json"], // Specify it only for TypeScript files