fix: incorrect imports in test files

This commit is contained in:
Deepen Timalsina 2025-04-15 21:14:52 +05:45
parent c48d847f62
commit 64bf831afd
44 changed files with 65 additions and 65 deletions

View file

@ -1,6 +1,6 @@
import React from "react";
import { Excalidraw, mutateElement } from "../../index";
import { Excalidraw, mutateElement } from "../../src/index";
import { API } from "../../tests/helpers/api";
import { act, assertElements, render } from "../../tests/test-utils";

View file

@ -1,6 +1,6 @@
import { ORIG_ID } from "@excalidraw/common";
import { Excalidraw } from "../../index";
import { Excalidraw } from "../../src/index";
import { API } from "../../tests/helpers/api";
import {
act,

View file

@ -1,7 +1,7 @@
import { queryByTestId, fireEvent } from "@testing-library/react";
import React from "react";
import { Excalidraw } from "../../index";
import { Excalidraw } from "../../src/index";
import { API } from "../../tests/helpers/api";
import { Pointer, UI } from "../../tests/helpers/ui";
import { render } from "../../tests/test-utils";

View file

@ -1,6 +1,6 @@
import { pointFrom } from "@excalidraw/math";
import { Excalidraw } from "../../index";
import { Excalidraw } from "../../src/index";
import { API } from "../../tests/helpers/api";
import { render } from "../../tests/test-utils";

View file

@ -7,7 +7,7 @@ import {
STROKE_WIDTH,
} from "@excalidraw/common";
import { Excalidraw } from "../../index";
import { Excalidraw } from "../../src/index";
import { API } from "../../tests/helpers/api";
import { UI } from "../../tests/helpers/ui";
import { render } from "../../tests/test-utils";

View file

@ -2,7 +2,7 @@ import React from "react";
import { DEFAULT_SIDEBAR } from "@excalidraw/common";
import { DefaultSidebar } from "../index";
import { DefaultSidebar } from "../src/index";
import {
fireEvent,
waitFor,

View file

@ -3,7 +3,7 @@ import { vi } from "vitest";
import { DEFAULT_SIDEBAR } from "@excalidraw/common";
import { Excalidraw, Sidebar } from "../../index";
import { Excalidraw, Sidebar } from "../../src/index";
import {
act,
fireEvent,

View file

@ -2,7 +2,7 @@ import React from "react";
import { KEYS } from "@excalidraw/common";
import { Excalidraw } from "../../index";
import { Excalidraw } from "../../src/index";
import { Keyboard } from "../../tests/helpers/ui";
import {
render,

View file

@ -1,6 +1,6 @@
import React from "react";
import { Excalidraw, MainMenu } from "../../index";
import { Excalidraw, MainMenu } from "../../src/index";
import { render, queryAllByTestId } from "../../tests/test-utils";
describe("Test internal component fallback rendering", () => {

View file

@ -16,7 +16,7 @@ import type {
ExcalidrawTextElementWithContainer,
} from "@excalidraw/element/types";
import { Excalidraw } from "../../index";
import { Excalidraw } from "../../src/index";
import { API } from "../../tests/helpers/api";
import { Keyboard, Pointer, UI } from "../../tests/helpers/ui";
import { getTextEditor, updateTextEditor } from "../../tests/queries/dom";

View file

@ -3,7 +3,7 @@ import { vi } from "vitest";
import { reseed } from "@excalidraw/common";
import { Excalidraw } from "../index";
import { Excalidraw } from "../src/index";
import * as StaticScene from "../src/renderer/staticScene";
import { render, queryByTestId, unmountComponent } from "../tests/test-utils";

View file

@ -1,7 +1,7 @@
import React from "react";
import { expect } from "vitest";
import { Excalidraw } from "../index";
import { Excalidraw } from "../src/index";
import { mockMermaidToExcalidraw } from "./helpers/mocks";
import { getTextEditor, updateTextEditor } from "./queries/dom";

View file

@ -3,7 +3,7 @@ import React from "react";
import { CODES } from "@excalidraw/common";
import { copiedStyles } from "../src/actions/actionStyles";
import { Excalidraw } from "../index";
import { Excalidraw } from "../src/index";
import { API } from "../tests/helpers/api";
import { Keyboard, Pointer, UI } from "../tests/helpers/ui";
import {

View file

@ -4,8 +4,8 @@ import { EXPORT_DATA_TYPES, MIME_TYPES } from "@excalidraw/common";
import type { ExcalidrawTextElement } from "@excalidraw/element/types";
import { getDefaultAppState } from "../appState";
import { Excalidraw } from "../index";
import { getDefaultAppState } from "../src/appState";
import { Excalidraw } from "../src/index";
import { API } from "./helpers/api";
import { Pointer, UI } from "./helpers/ui";

View file

@ -1,4 +1,4 @@
import { tryParseSpreadsheet } from "../charts";
import { tryParseSpreadsheet } from "../src/charts";
describe("tryParseSpreadsheet", () => {
it("works for numbers with comma in them", () => {

View file

@ -1,4 +1,4 @@
import { getNameInitial } from "../clients";
import { getNameInitial } from "../src/clients";
describe("getClientInitials", () => {
it("returns substring if one name provided", () => {

View file

@ -7,9 +7,9 @@ import { KEYS, arrayToMap, getLineHeight } from "@excalidraw/common";
import { getElementBounds } from "@excalidraw/element/bounds";
import { createPasteEvent, serializeAsClipboardJSON } from "../clipboard";
import { createPasteEvent, serializeAsClipboardJSON } from "../src/clipboard";
import { Excalidraw } from "../index";
import { Excalidraw } from "../src/index";
import { API } from "./helpers/api";
import { mockMermaidToExcalidraw } from "./helpers/mocks";
@ -21,7 +21,7 @@ import {
unmountComponent,
} from "./test-utils";
import type { NormalizedZoomValue } from "../types";
import type { NormalizedZoomValue } from "../src/types";
const { h } = window;

View file

@ -6,7 +6,7 @@ import { KEYS, reseed } from "@excalidraw/common";
import { setDateTimeForTests } from "@excalidraw/common";
import { copiedStyles } from "../src/actions/actionStyles";
import { Excalidraw } from "../index";
import { Excalidraw } from "../src/index";
import * as StaticScene from "../src/renderer/staticScene";
import { API } from "./helpers/api";

View file

@ -17,7 +17,7 @@ import { API } from "./helpers/api";
import { Keyboard, Pointer, UI } from "./helpers/ui";
import { act, GlobalTestState, render, unmountComponent } from "./test-utils";
import type { NormalizedZoomValue } from "../types";
import type { NormalizedZoomValue } from "../src/types";
const { h } = window;
const mouse = new Pointer("mouse");

View file

@ -11,7 +11,7 @@ import { reconcileElements } from "../../src/data/reconcile";
import type { RemoteExcalidrawElement } from "../../src/data/reconcile";
import type { AppState } from "../../types";
import type { AppState } from "../../src/types";
type Id = string;
type ElementLike = {

View file

@ -16,7 +16,7 @@ import type { NormalizedZoomValue } from "@excalidraw/excalidraw/src/types";
import { API } from "../helpers/api";
import * as restore from "../../src/data/restore";
import { getDefaultAppState } from "../../appState";
import { getDefaultAppState } from "../../src/appState";
import type { ImportedDataState } from "../../src/data/types";

View file

@ -5,7 +5,7 @@ import { KEYS, reseed } from "@excalidraw/common";
import type { ExcalidrawLinearElement } from "@excalidraw/element/types";
import { Excalidraw } from "../index";
import { Excalidraw } from "../src/index";
import * as InteractiveScene from "../src/renderer/interactiveScene";
import * as StaticScene from "../src/renderer/staticScene";

View file

@ -5,8 +5,8 @@ import { mutateElement } from "@excalidraw/element/mutateElement";
import { KEYS } from "@excalidraw/common";
import { actionSelectAll } from "../src/actions";
import { t } from "../i18n";
import { Excalidraw } from "../index";
import { t } from "../src/i18n";
import { Excalidraw } from "../src/index";
import { API } from "../tests/helpers/api";
import { Keyboard, Pointer, UI } from "../tests/helpers/ui";

View file

@ -4,8 +4,8 @@ import { useMemo } from "react";
import { THEME } from "@excalidraw/common";
import { t } from "../i18n";
import { Excalidraw, Footer, MainMenu } from "../index";
import { t } from "../src/i18n";
import { Excalidraw, Footer, MainMenu } from "../src/index";
import { fireEvent, GlobalTestState, toggleMenu, render } from "./test-utils";

View file

@ -4,11 +4,11 @@ import { SVG_NS } from "@excalidraw/common";
import type { FileId } from "@excalidraw/element/types";
import { getDefaultAppState } from "../appState";
import { getDefaultAppState } from "../src/appState";
import { getDataURL } from "../src/data/blob";
import { encodePngMetadata } from "../src/data/image";
import { serializeAsJSON } from "../src/data/json";
import { Excalidraw } from "../index";
import { Excalidraw } from "../src/index";
import {
decodeSvgBase64Payload,
encodeSvgBase64Payload,

View file

@ -1,7 +1,7 @@
import React from "react";
import { vi } from "vitest";
import { Excalidraw } from "../index";
import { Excalidraw } from "../src/index";
import { API } from "./helpers/api";
import { act, render } from "./test-utils";

View file

@ -20,8 +20,8 @@ import type {
} from "@excalidraw/element/types";
import { actionFlipHorizontal, actionFlipVertical } from "../src/actions";
import { createPasteEvent } from "../clipboard";
import { Excalidraw } from "../index";
import { createPasteEvent } from "../src/clipboard";
import { Excalidraw } from "../src/index";
// Importing to spy on it and mock the implementation (mocking does not work with simple vi.mock for some reason)
import * as blobModule from "../src/data/blob";
@ -37,7 +37,7 @@ import {
waitFor,
} from "./test-utils";
import type { NormalizedZoomValue } from "../types";
import type { NormalizedZoomValue } from "../src/types";
const { h } = window;
const mouse = new Pointer("mouse");

View file

@ -43,13 +43,13 @@ import type {
import type { Mutable } from "@excalidraw/common/utility-types";
import { getMimeType } from "../../src/data/blob";
import { createTestHook } from "../../components/App";
import { getDefaultAppState } from "../../appState";
import { createTestHook } from "../../src/components/App";
import { getDefaultAppState } from "../../src/appState";
import { GlobalTestState, createEvent, fireEvent, act } from "../test-utils";
import type { Action } from "../../src/actions/types";
import type App from "../../components/App";
import type { AppState } from "../../types";
import type App from "../../src/components/App";
import type { AppState } from "../../src/types";
const readFile = util.promisify(fs.readFile);

View file

@ -38,13 +38,13 @@ import type {
ExcalidrawImageElement,
} from "@excalidraw/element/types";
import { createTestHook } from "../../components/App";
import { createTestHook } from "../../src/components/App";
import { getTextEditor } from "../queries/dom";
import { act, fireEvent, GlobalTestState, screen } from "../test-utils";
import { API } from "./api";
import type { ToolType } from "../../types";
import type { ToolType } from "../../src/types";
// so that window.h is available when App.tsx is not imported as well.
createTestHook();

View file

@ -48,12 +48,12 @@ import {
createRedoAction,
} from "../src/actions/actionHistory.js";
import { actionToggleViewMode } from "../src/actions/actionToggleViewMode.js";
import { getDefaultAppState } from "../appState";
import { HistoryEntry } from "../history";
import { Excalidraw } from "../index";
import { getDefaultAppState } from "../src/appState";
import { HistoryEntry } from "../src/history";
import { Excalidraw } from "../src/index";
import * as StaticScene from "../src/renderer/staticScene";
import { Snapshot, CaptureUpdateAction } from "../store";
import { AppStateChange, ElementsChange } from "../change";
import { Snapshot, CaptureUpdateAction } from "../src/store";
import { AppStateChange, ElementsChange } from "../src/change";
import { API } from "./helpers/api";
import { Keyboard, Pointer, UI } from "./helpers/ui";
@ -66,7 +66,7 @@ import {
getCloneByOrigId,
} from "./test-utils";
import type { AppState } from "../types";
import type { AppState } from "../src/types";
const { h } = window;

View file

@ -25,7 +25,7 @@ import { getElementLineSegments } from "@excalidraw/element/bounds";
import type { ExcalidrawElement } from "@excalidraw/element/types";
import { Excalidraw } from "../index";
import { Excalidraw } from "../src/index";
import { getSelectedElements } from "../src/scene";

View file

@ -11,13 +11,13 @@ import type { ExcalidrawGenericElement } from "@excalidraw/element/types";
import { parseLibraryJSON } from "../src/data/blob";
import { serializeLibraryAsJSON } from "../src/data/json";
import { distributeLibraryItemsOnSquareGrid } from "../src/data/library";
import { Excalidraw } from "../index";
import { Excalidraw } from "../src/index";
import { API } from "./helpers/api";
import { UI } from "./helpers/ui";
import { fireEvent, getCloneByOrigId, render, waitFor } from "./test-utils";
import type { LibraryItem, LibraryItems } from "../types";
import type { LibraryItem, LibraryItems } from "../src/types";
const { h } = window;

View file

@ -30,7 +30,7 @@ import type {
FontString,
} from "@excalidraw/element/types";
import { Excalidraw, mutateElement } from "../index";
import { Excalidraw, mutateElement } from "../src/index";
import * as InteractiveCanvas from "../src/renderer/interactiveScene";
import * as StaticScene from "../src/renderer/staticScene";
import { API } from "../tests/helpers/api";

View file

@ -15,7 +15,7 @@ import type {
import type Scene from "@excalidraw/excalidraw/src/scene/Scene";
import { Excalidraw } from "../index";
import { Excalidraw } from "../src/index";
import * as InteractiveCanvas from "../src/renderer/interactiveScene";
import * as StaticScene from "../src/renderer/staticScene";

View file

@ -5,7 +5,7 @@ import { KEYS, reseed } from "@excalidraw/common";
import type { ExcalidrawLinearElement } from "@excalidraw/element/types";
import { Excalidraw } from "../index";
import { Excalidraw } from "../src/index";
import * as InteractiveCanvas from "../src/renderer/interactiveScene";
import * as StaticScene from "../src/renderer/staticScene";

View file

@ -3,12 +3,12 @@ import { vi } from "vitest";
import { resolvablePromise } from "@excalidraw/common";
import { Excalidraw, CaptureUpdateAction } from "../../index";
import { Excalidraw, CaptureUpdateAction } from "../../src/index";
import { API } from "../helpers/api";
import { Pointer } from "../helpers/ui";
import { render } from "../test-utils";
import type { ExcalidrawImperativeAPI } from "../../types";
import type { ExcalidrawImperativeAPI } from "../../src/types";
describe("event callbacks", () => {
const h = window.h;

View file

@ -7,7 +7,7 @@ import { setDateTimeForTests } from "@excalidraw/common";
import type { ExcalidrawElement } from "@excalidraw/element/types";
import { Excalidraw } from "../index";
import { Excalidraw } from "../src/index";
import * as StaticScene from "../src/renderer/staticScene";
import { API } from "./helpers/api";

View file

@ -3,7 +3,7 @@ import { expect } from "vitest";
import { reseed } from "@excalidraw/common";
import { Excalidraw } from "../index";
import { Excalidraw } from "../src/index";
import { UI } from "./helpers/ui";
import { render, unmountComponent } from "./test-utils";

View file

@ -2,7 +2,7 @@ import React from "react";
import { KEYS } from "@excalidraw/common";
import { Excalidraw } from "../index";
import { Excalidraw } from "../src/index";
import { API } from "./helpers/api";
import { Keyboard } from "./helpers/ui";

View file

@ -9,7 +9,7 @@ import {
import type { ExcalidrawTextElement } from "@excalidraw/element/types";
import { Excalidraw } from "../index";
import { Excalidraw } from "../src/index";
import { API } from "./helpers/api";
import { Keyboard } from "./helpers/ui";

View file

@ -3,9 +3,9 @@ import { vi } from "vitest";
import { KEYS, reseed } from "@excalidraw/common";
import { SHAPES } from "../components/shapes";
import { SHAPES } from "../src/components/shapes";
import { Excalidraw } from "../index";
import { Excalidraw } from "../src/index";
import * as InteractiveCanvas from "../src/renderer/interactiveScene";
import * as StaticScene from "../src/renderer/staticScene";

View file

@ -2,7 +2,7 @@ import React from "react";
import { KEYS } from "@excalidraw/common";
import { Excalidraw } from "../index";
import { Excalidraw } from "../src/index";
import { API } from "./helpers/api";
import { Keyboard } from "./helpers/ui";

View file

@ -2,12 +2,12 @@ import React from "react";
import { resolvablePromise } from "@excalidraw/common";
import { Excalidraw } from "../index";
import { Excalidraw } from "../src/index";
import { Pointer } from "./helpers/ui";
import { act, render } from "./test-utils";
import type { ExcalidrawImperativeAPI } from "../types";
import type { ExcalidrawImperativeAPI } from "../src/types";
describe("setActiveTool()", () => {
const h = window.h;

View file

@ -2,7 +2,7 @@ import React from "react";
import { CURSOR_TYPE, KEYS } from "@excalidraw/common";
import { Excalidraw } from "../index";
import { Excalidraw } from "../src/index";
import { API } from "./helpers/api";
import { Keyboard, Pointer, UI } from "./helpers/ui";