core: fix imports in tests

This commit is contained in:
Abdullah Atta
2024-09-23 15:27:51 +05:00
parent ecc9736b90
commit 19c2d2007f
24 changed files with 39 additions and 35 deletions

View File

@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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";

View File

@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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 () => {

View File

@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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) => {

View File

@@ -17,11 +17,11 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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";

View File

@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { databaseTest } from "../__tests__/utils/index.js";
import { databaseTest } from "../__tests__/utils/index.ts";
import { login } from "./utils.js";
import { test, expect } from "vitest";

View File

@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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";

View File

@@ -17,7 +17,12 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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", () =>

View File

@@ -17,9 +17,9 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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) => {

View File

@@ -23,7 +23,7 @@ import {
notebookTest,
TEST_NOTEBOOK2,
databaseTest
} from "./utils/index.js";
} from "./utils/index.ts";
import { test, expect } from "vitest";
const content = {

View File

@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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) {

View File

@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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", () =>

View File

@@ -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";

View File

@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { databaseTest } from "./utils/index.js";
import { databaseTest } from "./utils/index.ts";
import { test, expect } from "vitest";
test("save group options", () =>

View File

@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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", () =>

View File

@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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 () => {

View File

@@ -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";

View File

@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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", () =>

View File

@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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);

View File

@@ -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", () =>

View File

@@ -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", () =>

View File

@@ -20,8 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
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 () => {

View File

@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { isHTMLEqual } from "../html-diff.js";
import { isHTMLEqual } from "../html-diff.ts";
import { test, expect, describe } from "vitest";
const equalPairs = [

View File

@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { set } from "../set.js";
import { set } from "../set.ts";
import { test, expect } from "vitest";
test("union", () => {

View File

@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { formatTitle } from "../title-format.js";
import { formatTitle } from "../title-format.ts";
import MockDate from "mockdate";
import { test, expect, describe, beforeAll, afterAll } from "vitest";