From a55eca75d03edfdc69f1771fbf6d51ced979bba9 Mon Sep 17 00:00:00 2001 From: dswbx Date: Fri, 11 Apr 2025 12:02:20 +0200 Subject: [PATCH] fix imports in test files reorganize imports to use "@sinclair/typebox" directly, replacing local utility references, and add missing "override" keywords in test classes. --- app/__test__/core/Registry.spec.ts | 5 ++--- app/__test__/core/object/SchemaObject.spec.ts | 2 +- app/__test__/data/specs/fields/FieldIndex.spec.ts | 2 +- app/__test__/flows/Task.spec.ts | 2 +- app/__test__/flows/inputs.test.ts | 3 ++- app/__test__/flows/workflow-basic.test.ts | 3 ++- app/__test__/modules/Module.spec.ts | 7 ++++--- app/__test__/modules/ModuleManager.spec.ts | 3 ++- 8 files changed, 15 insertions(+), 12 deletions(-) diff --git a/app/__test__/core/Registry.spec.ts b/app/__test__/core/Registry.spec.ts index 637a8361..2a11250b 100644 --- a/app/__test__/core/Registry.spec.ts +++ b/app/__test__/core/Registry.spec.ts @@ -1,7 +1,6 @@ import { describe, expect, test } from "bun:test"; -import type { TObject, TString } from "@sinclair/typebox"; -import { Registry } from "../../src/core/registry/Registry"; -import { type TSchema, Type } from "../../src/core/utils"; +import { type TObject, type TString, Type } from "@sinclair/typebox"; +import { Registry } from "core"; type Constructor = new (...args: any[]) => T; diff --git a/app/__test__/core/object/SchemaObject.spec.ts b/app/__test__/core/object/SchemaObject.spec.ts index 0c745e4e..580ab575 100644 --- a/app/__test__/core/object/SchemaObject.spec.ts +++ b/app/__test__/core/object/SchemaObject.spec.ts @@ -1,6 +1,6 @@ import { describe, expect, test } from "bun:test"; import { SchemaObject } from "../../../src/core"; -import { Type } from "../../../src/core/utils"; +import { Type } from "@sinclair/typebox"; describe("SchemaObject", async () => { test("basic", async () => { diff --git a/app/__test__/data/specs/fields/FieldIndex.spec.ts b/app/__test__/data/specs/fields/FieldIndex.spec.ts index 0dd656cd..1337f631 100644 --- a/app/__test__/data/specs/fields/FieldIndex.spec.ts +++ b/app/__test__/data/specs/fields/FieldIndex.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from "bun:test"; -import { Type } from "../../../../src/core/utils"; +import { Type } from "@sinclair/typebox"; import { Entity, EntityIndex, Field } from "../../../../src/data"; class TestField extends Field { diff --git a/app/__test__/flows/Task.spec.ts b/app/__test__/flows/Task.spec.ts index 20164787..a7da9836 100644 --- a/app/__test__/flows/Task.spec.ts +++ b/app/__test__/flows/Task.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from "bun:test"; -import { Type } from "../../src/core/utils"; +import { Type } from "@sinclair/typebox"; import { Task } from "../../src/flows"; import { dynamic } from "../../src/flows/tasks/Task"; diff --git a/app/__test__/flows/inputs.test.ts b/app/__test__/flows/inputs.test.ts index 25a1c828..d1801f4e 100644 --- a/app/__test__/flows/inputs.test.ts +++ b/app/__test__/flows/inputs.test.ts @@ -1,7 +1,8 @@ import { describe, expect, test } from "bun:test"; import { Hono } from "hono"; import { Event, EventManager } from "../../src/core/events"; -import { type Static, type StaticDecode, Type, parse } from "../../src/core/utils"; +import { parse } from "../../src/core/utils"; +import { type Static, type StaticDecode, Type } from "@sinclair/typebox"; import { EventTrigger, Flow, HttpTrigger, type InputsMap, Task } from "../../src/flows"; import { dynamic } from "../../src/flows/tasks/Task"; diff --git a/app/__test__/flows/workflow-basic.test.ts b/app/__test__/flows/workflow-basic.test.ts index 56579f50..9df12e5e 100644 --- a/app/__test__/flows/workflow-basic.test.ts +++ b/app/__test__/flows/workflow-basic.test.ts @@ -1,7 +1,8 @@ // eslint-disable-next-line import/no-unresolved import { describe, expect, test } from "bun:test"; import { isEqual } from "lodash-es"; -import { type Static, Type, _jsonp, withDisabledConsole } from "../../src/core/utils"; +import { _jsonp, withDisabledConsole } from "../../src/core/utils"; +import { type Static, Type } from "@sinclair/typebox"; import { Condition, ExecutionEvent, FetchTask, Flow, LogTask, Task } from "../../src/flows"; /*beforeAll(disableConsoleLog); diff --git a/app/__test__/modules/Module.spec.ts b/app/__test__/modules/Module.spec.ts index bcb6aa8e..8cca811b 100644 --- a/app/__test__/modules/Module.spec.ts +++ b/app/__test__/modules/Module.spec.ts @@ -1,5 +1,6 @@ import { describe, expect, test } from "bun:test"; -import { type TSchema, Type, stripMark } from "../../src/core/utils"; +import { stripMark } from "../../src/core/utils"; +import { type TSchema, Type } from "@sinclair/typebox"; import { EntityManager, em, entity, index, text } from "../../src/data"; import { DummyConnection } from "../../src/data/connection/DummyConnection"; import { Module } from "../../src/modules/Module"; @@ -9,10 +10,10 @@ function createModule(schema: Schema) { getSchema() { return schema; } - toJSON() { + override toJSON() { return this.config; } - useForceParse() { + override useForceParse() { return true; } } diff --git a/app/__test__/modules/ModuleManager.spec.ts b/app/__test__/modules/ModuleManager.spec.ts index 31b20275..7d320b05 100644 --- a/app/__test__/modules/ModuleManager.spec.ts +++ b/app/__test__/modules/ModuleManager.spec.ts @@ -1,5 +1,6 @@ import { afterEach, beforeEach, describe, expect, mock, test } from "bun:test"; -import { Type, disableConsoleLog, enableConsoleLog, stripMark } from "../../src/core/utils"; +import { disableConsoleLog, enableConsoleLog, stripMark } from "../../src/core/utils"; +import { Type } from "@sinclair/typebox"; import { entity, text } from "../../src/data"; import { Module } from "../../src/modules/Module"; import { ModuleManager, getDefaultConfig } from "../../src/modules/ModuleManager";