From 19c2d2007f7113c0e9bc748fca81f74241a7427d Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Mon, 23 Sep 2024 15:27:51 +0500 Subject: [PATCH] core: fix imports in tests --- packages/core/__e2e__/monographs.test.js | 2 +- packages/core/__e2e__/offers.test.js | 4 ++-- packages/core/__e2e__/pricing.test.js | 2 +- packages/core/__e2e__/sync.test.js | 8 ++++---- packages/core/__e2e__/token-manager.test.js | 2 +- packages/core/__e2e__/user-manager.test.js | 2 +- packages/core/__tests__/backup.test.js | 7 ++++++- packages/core/__tests__/db.test.js | 4 ++-- packages/core/__tests__/lookup.test.js | 2 +- packages/core/__tests__/note-history.test.js | 2 +- packages/core/__tests__/notebooks.test.js | 2 +- packages/core/__tests__/reminders.test.js | 4 ++-- packages/core/__tests__/settings.test.js | 2 +- packages/core/__tests__/shortcuts.test.js | 2 +- packages/core/__tests__/storage.test.js | 2 +- packages/core/__tests__/utils/index.ts | 3 +-- packages/core/__tests__/vault.test.js | 4 ++-- packages/core/src/api/__tests__/debug.test.js | 2 +- packages/core/src/api/sync/__tests__/collector.test.js | 4 ++-- packages/core/src/api/sync/__tests__/merger.test.js | 4 ++-- packages/core/src/content-types/__tests__/tiptap.test.js | 4 ++-- packages/core/src/utils/__tests__/html-diff.test.js | 2 +- packages/core/src/utils/__tests__/set.test.js | 2 +- packages/core/src/utils/__tests__/title-format.test.js | 2 +- 24 files changed, 39 insertions(+), 35 deletions(-) diff --git a/packages/core/__e2e__/monographs.test.js b/packages/core/__e2e__/monographs.test.js index 7ceabff5f..0e8397507 100644 --- a/packages/core/__e2e__/monographs.test.js +++ b/packages/core/__e2e__/monographs.test.js @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -import { databaseTest, noteTest } from "../__tests__/utils/index.js"; +import { databaseTest, noteTest } from "../__tests__/utils/index.ts"; import { login, logout } from "./utils.js"; import { test, expect, afterAll } from "vitest"; diff --git a/packages/core/__e2e__/offers.test.js b/packages/core/__e2e__/offers.test.js index 77835e717..6ab658081 100644 --- a/packages/core/__e2e__/offers.test.js +++ b/packages/core/__e2e__/offers.test.js @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -import hosts from "../src/utils/constants.js"; -import { Offers } from "../src/api/offers.js"; +import hosts from "../src/utils/constants.ts"; +import { Offers } from "../src/api/offers.ts"; import { test, expect } from "vitest"; test("get offer code", async () => { diff --git a/packages/core/__e2e__/pricing.test.js b/packages/core/__e2e__/pricing.test.js index e53b8392c..6e335f516 100644 --- a/packages/core/__e2e__/pricing.test.js +++ b/packages/core/__e2e__/pricing.test.js @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -import { Pricing } from "../src/api/pricing.js"; +import { Pricing } from "../src/api/pricing.ts"; import { test, expect, describe } from "vitest"; test.each(["monthly", "yearly", undefined])(`get %s price`, async (period) => { diff --git a/packages/core/__e2e__/sync.test.js b/packages/core/__e2e__/sync.test.js index a88a0098c..15a783025 100644 --- a/packages/core/__e2e__/sync.test.js +++ b/packages/core/__e2e__/sync.test.js @@ -17,11 +17,11 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -import Database from "../src/api/index.js"; -import { NodeStorageInterface } from "../__mocks__/node-storage.mock.js"; -import { FS } from "../__mocks__/fs.mock.js"; +import Database from "../src/api/index.ts"; +import { NodeStorageInterface } from "../__mocks__/node-storage.mock.ts"; +import { FS } from "../__mocks__/fs.mock.ts"; import Compressor from "../__mocks__/compressor.mock.js"; -import { CHECK_IDS, EV, EVENTS } from "../src/common.js"; +import { CHECK_IDS, EV, EVENTS } from "../src/common.ts"; import { EventSource } from "event-source-polyfill"; import { test, expect, vitest } from "vitest"; import { login } from "./utils.js"; diff --git a/packages/core/__e2e__/token-manager.test.js b/packages/core/__e2e__/token-manager.test.js index d3e4cda1c..77e1ef6f7 100644 --- a/packages/core/__e2e__/token-manager.test.js +++ b/packages/core/__e2e__/token-manager.test.js @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -import { databaseTest } from "../__tests__/utils/index.js"; +import { databaseTest } from "../__tests__/utils/index.ts"; import { login } from "./utils.js"; import { test, expect } from "vitest"; diff --git a/packages/core/__e2e__/user-manager.test.js b/packages/core/__e2e__/user-manager.test.js index 156658f56..8ff4d4eeb 100644 --- a/packages/core/__e2e__/user-manager.test.js +++ b/packages/core/__e2e__/user-manager.test.js @@ -18,7 +18,7 @@ along with this program. If not, see . */ import { authenticator } from "otplib"; -import { databaseTest } from "../__tests__/utils/index.js"; +import { databaseTest } from "../__tests__/utils/index.ts"; import { login, USER } from "./utils.js"; import { test, expect } from "vitest"; diff --git a/packages/core/__tests__/backup.test.js b/packages/core/__tests__/backup.test.js index 8df0c5d65..8a4d090db 100644 --- a/packages/core/__tests__/backup.test.js +++ b/packages/core/__tests__/backup.test.js @@ -17,7 +17,12 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -import { TEST_NOTE, databaseTest, loginFakeUser, notebookTest } from "./utils/index.js"; +import { + TEST_NOTE, + databaseTest, + loginFakeUser, + notebookTest +} from "./utils/index.ts"; import { test, expect } from "vitest"; test("export backup", () => diff --git a/packages/core/__tests__/db.test.js b/packages/core/__tests__/db.test.js index f0206f74e..8c4df3aef 100644 --- a/packages/core/__tests__/db.test.js +++ b/packages/core/__tests__/db.test.js @@ -17,9 +17,9 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -import Constants from "../src/utils/constants.js"; +import Constants from "../src/utils/constants.ts"; import { test, expect } from "vitest"; -import { databaseTest } from "./utils/index.js"; +import { databaseTest } from "./utils/index.ts"; test("db.host should change HOST", () => databaseTest().then((db) => { diff --git a/packages/core/__tests__/lookup.test.js b/packages/core/__tests__/lookup.test.js index 9641e86c9..f5765d972 100644 --- a/packages/core/__tests__/lookup.test.js +++ b/packages/core/__tests__/lookup.test.js @@ -23,7 +23,7 @@ import { notebookTest, TEST_NOTEBOOK2, databaseTest -} from "./utils/index.js"; +} from "./utils/index.ts"; import { test, expect } from "vitest"; const content = { diff --git a/packages/core/__tests__/note-history.test.js b/packages/core/__tests__/note-history.test.js index 5ed5b6f6f..e7f742e03 100644 --- a/packages/core/__tests__/note-history.test.js +++ b/packages/core/__tests__/note-history.test.js @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -import { delay, noteTest, TEST_NOTE } from "./utils/index.js"; +import { delay, noteTest, TEST_NOTE } from "./utils/index.ts"; import { test, expect } from "vitest"; // async function sessionTest(db, noteId) { diff --git a/packages/core/__tests__/notebooks.test.js b/packages/core/__tests__/notebooks.test.js index 540cf1202..50c72b122 100644 --- a/packages/core/__tests__/notebooks.test.js +++ b/packages/core/__tests__/notebooks.test.js @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -import { notebookTest, TEST_NOTEBOOK } from "./utils/index.js"; +import { notebookTest, TEST_NOTEBOOK } from "./utils/index.ts"; import { test, expect } from "vitest"; test("add a notebook", () => diff --git a/packages/core/__tests__/reminders.test.js b/packages/core/__tests__/reminders.test.js index 46f2dfd8f..a7387d2cb 100644 --- a/packages/core/__tests__/reminders.test.js +++ b/packages/core/__tests__/reminders.test.js @@ -23,10 +23,10 @@ import { formatReminderTime, getUpcomingReminderTime, isReminderActive -} from "../src/collections/reminders.js"; +} from "../src/collections/reminders.ts"; import MockDate from "mockdate"; import { describe, afterAll, beforeEach, test, expect } from "vitest"; -import { databaseTest } from "./utils/index.js"; +import { databaseTest } from "./utils/index.ts"; import dayjs from "dayjs"; import assert from "assert"; diff --git a/packages/core/__tests__/settings.test.js b/packages/core/__tests__/settings.test.js index 73eba0677..4293028b2 100644 --- a/packages/core/__tests__/settings.test.js +++ b/packages/core/__tests__/settings.test.js @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -import { databaseTest } from "./utils/index.js"; +import { databaseTest } from "./utils/index.ts"; import { test, expect } from "vitest"; test("save group options", () => diff --git a/packages/core/__tests__/shortcuts.test.js b/packages/core/__tests__/shortcuts.test.js index 30f12d83d..efdc48627 100644 --- a/packages/core/__tests__/shortcuts.test.js +++ b/packages/core/__tests__/shortcuts.test.js @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -import { databaseTest, notebookTest } from "./utils/index.js"; +import { databaseTest, notebookTest } from "./utils/index.ts"; import { test, expect } from "vitest"; test("create a shortcut of an invalid item should throw", () => diff --git a/packages/core/__tests__/storage.test.js b/packages/core/__tests__/storage.test.js index f5382b279..4b57d2d37 100644 --- a/packages/core/__tests__/storage.test.js +++ b/packages/core/__tests__/storage.test.js @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -import { NodeStorageInterface } from "../__mocks__/node-storage.mock.js"; +import { NodeStorageInterface } from "../__mocks__/node-storage.mock.ts"; import { test, expect } from "vitest"; test("add a value", async () => { diff --git a/packages/core/__tests__/utils/index.ts b/packages/core/__tests__/utils/index.ts index ebf8a8492..fbad5b126 100644 --- a/packages/core/__tests__/utils/index.ts +++ b/packages/core/__tests__/utils/index.ts @@ -23,8 +23,7 @@ import { FS } from "../../__mocks__/fs.mock.js"; import Compressor from "../../__mocks__/compressor.mock.js"; import { EventSourcePolyfill as EventSource } from "event-source-polyfill"; import { randomBytes } from "../../src/utils/random.js"; -import { Note, Notebook } from "../../src/types.js"; -import { NoteContent } from "../../src/collections/session-content.js"; +import { Note, Notebook, NoteContent } from "../../src/types.js"; import { SqliteDialect } from "@streetwriters/kysely"; import BetterSQLite3 from "better-sqlite3-multiple-ciphers"; import path from "path"; diff --git a/packages/core/__tests__/vault.test.js b/packages/core/__tests__/vault.test.js index cd016ac05..a39922df6 100644 --- a/packages/core/__tests__/vault.test.js +++ b/packages/core/__tests__/vault.test.js @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -import { VAULT_ERRORS } from "../src/api/vault.js"; -import { databaseTest, delay, noteTest, TEST_NOTE } from "./utils/index.js"; +import { VAULT_ERRORS } from "../src/api/vault.ts"; +import { databaseTest, delay, noteTest, TEST_NOTE } from "./utils/index.ts"; import { test, expect } from "vitest"; test("create vault", () => diff --git a/packages/core/src/api/__tests__/debug.test.js b/packages/core/src/api/__tests__/debug.test.js index 91b663e66..17612bcf5 100644 --- a/packages/core/src/api/__tests__/debug.test.js +++ b/packages/core/src/api/__tests__/debug.test.js @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -import { Debug } from "../debug.js"; +import { Debug } from "../debug.ts"; import createFetchMock from "vitest-fetch-mock"; import { vi, test, expect } from "vitest"; const fetchMocker = createFetchMock(vi); diff --git a/packages/core/src/api/sync/__tests__/collector.test.js b/packages/core/src/api/sync/__tests__/collector.test.js index d79d027ad..cadfc4726 100644 --- a/packages/core/src/api/sync/__tests__/collector.test.js +++ b/packages/core/src/api/sync/__tests__/collector.test.js @@ -21,8 +21,8 @@ import { databaseTest, TEST_NOTE, loginFakeUser -} from "../../../../__tests__/utils/index.js"; -import Collector from "../collector.js"; +} from "../../../../__tests__/utils/index.ts"; +import Collector from "../collector.ts"; import { test, expect } from "vitest"; test("newly created note should get included in collector", () => diff --git a/packages/core/src/api/sync/__tests__/merger.test.js b/packages/core/src/api/sync/__tests__/merger.test.js index 15534c8b0..4578fa839 100644 --- a/packages/core/src/api/sync/__tests__/merger.test.js +++ b/packages/core/src/api/sync/__tests__/merger.test.js @@ -21,9 +21,9 @@ import { TEST_NOTE, databaseTest, loginFakeUser -} from "../../../../__tests__/utils/index.js"; +} from "../../../../__tests__/utils/index.ts"; import { expect, describe, vi } from "vitest"; -import Merger from "../merger.js"; +import Merger from "../merger.ts"; describe.concurrent("merge item synchronously", (test) => { test("accept remote item if no local item is found", () => diff --git a/packages/core/src/content-types/__tests__/tiptap.test.js b/packages/core/src/content-types/__tests__/tiptap.test.js index dd366238a..d718e9001 100644 --- a/packages/core/src/content-types/__tests__/tiptap.test.js +++ b/packages/core/src/content-types/__tests__/tiptap.test.js @@ -20,8 +20,8 @@ along with this program. If not, see . import { IMG_CONTENT, IMG_CONTENT_WITHOUT_HASH -} from "../../../__tests__/utils/index.js"; -import { Tiptap } from "../tiptap.js"; +} from "../../../__tests__/utils/index.ts"; +import { Tiptap } from "../tiptap.ts"; import { test, expect } from "vitest"; test("img src is empty after extract attachments", async () => { diff --git a/packages/core/src/utils/__tests__/html-diff.test.js b/packages/core/src/utils/__tests__/html-diff.test.js index 9b6803e1e..9e3c39c52 100644 --- a/packages/core/src/utils/__tests__/html-diff.test.js +++ b/packages/core/src/utils/__tests__/html-diff.test.js @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -import { isHTMLEqual } from "../html-diff.js"; +import { isHTMLEqual } from "../html-diff.ts"; import { test, expect, describe } from "vitest"; const equalPairs = [ diff --git a/packages/core/src/utils/__tests__/set.test.js b/packages/core/src/utils/__tests__/set.test.js index 67b764c57..7c6a1e32f 100644 --- a/packages/core/src/utils/__tests__/set.test.js +++ b/packages/core/src/utils/__tests__/set.test.js @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -import { set } from "../set.js"; +import { set } from "../set.ts"; import { test, expect } from "vitest"; test("union", () => { diff --git a/packages/core/src/utils/__tests__/title-format.test.js b/packages/core/src/utils/__tests__/title-format.test.js index df227961b..75de04e4e 100644 --- a/packages/core/src/utils/__tests__/title-format.test.js +++ b/packages/core/src/utils/__tests__/title-format.test.js @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -import { formatTitle } from "../title-format.js"; +import { formatTitle } from "../title-format.ts"; import MockDate from "mockdate"; import { test, expect, describe, beforeAll, afterAll } from "vitest";