diff --git a/packages/core/tests/common/TestFactory.ts b/packages/core/tests/common/TestFactory.ts index 4eaca3d4b..a7eabca7a 100644 --- a/packages/core/tests/common/TestFactory.ts +++ b/packages/core/tests/common/TestFactory.ts @@ -1,9 +1,6 @@ -import Types from "../../src/utilities/impl/Types"; -import ValidationEngine from "../../src/validation"; -import ValidationHandlerMock, { - IMock, - buildIOName, -} from "./ValidationHandlerMock"; +import { Types } from "../../src/utilities"; +import { Form } from "../../src/validation"; +import ValidationHandlerMock, { IMock, buildIOName } from "./ValidationHandlerMock"; export type StandardTestProps = { Model: Types.Class>; @@ -20,7 +17,7 @@ export function standardTest({ errorData, type, }: StandardTestProps) { - const handler = new ValidationEngine.ValidationEngine(Model as any); + const handler = new Form(Model as any); const expectService = new ValidationHandlerMock(handler as any); describe(buildIOName(identifier, true, type), () => { diff --git a/packages/core/tests/common/ValidationHandlerMock.ts b/packages/core/tests/common/ValidationHandlerMock.ts index 165fa089b..17fd7a3dd 100644 --- a/packages/core/tests/common/ValidationHandlerMock.ts +++ b/packages/core/tests/common/ValidationHandlerMock.ts @@ -1,4 +1,4 @@ -import ValidationEngine from "../../src/validation"; +import { Form } from "../../src/validation"; export interface IMock { value: T; @@ -13,10 +13,10 @@ function buildItMessage(valid: boolean, value: any) { } export default class ValidationHandlerMock { - constructor(private handler: ValidationEngine.ValidationEngine>) {} + constructor(private handler: Form>) {} expect(data: T[], valid: boolean) { - data.forEach((value) => { + data.forEach(value => { it(buildItMessage(valid, value), () => { const state: any = { value }; const res = this.handler.validate(state); diff --git a/packages/core/tests/impl/any/Required.test.ts b/packages/core/tests/impl/any/Required.test.ts index 055ac37b7..16d501579 100644 --- a/packages/core/tests/impl/any/Required.test.ts +++ b/packages/core/tests/impl/any/Required.test.ts @@ -1,7 +1,7 @@ -import { Required } from "../../../collection/any/Required"; -import Objects from "../../../src/utilities/impl/Objects"; +import * as Objects from "../../../src/utilities/impl/Objects"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; +import { Required } from "./../../../src/decorators"; /*** Data ***/ type Type = Objects.Optional; diff --git a/packages/core/tests/impl/any/attribute.test.ts b/packages/core/tests/impl/any/attribute.test.ts index 04b1bdbd8..51a962b23 100644 --- a/packages/core/tests/impl/any/attribute.test.ts +++ b/packages/core/tests/impl/any/attribute.test.ts @@ -1,6 +1,4 @@ -import collection from "../../../collection"; -import { attribute } from "../../../collection/class/attribute"; -import $ from "../../../index"; +import $, { attribute, Decorators } from "../../../index"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; @@ -32,10 +30,10 @@ const errorData: Type[] = [ ]; class NestedModel { - @collection.string.Required() + @Decorators.Required() stringValue!: string; - @collection.number.Integer() + @Decorators.Integer() numberValue!: number; } diff --git a/packages/core/tests/impl/array/ArrayContains.test.ts b/packages/core/tests/impl/array/ArrayContains.test.ts index c30c3327c..34fc88caf 100644 --- a/packages/core/tests/impl/array/ArrayContains.test.ts +++ b/packages/core/tests/impl/array/ArrayContains.test.ts @@ -1,6 +1,6 @@ import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; -import { ArrayContains } from "./../../../collection/array/ArrayContains"; +import { ArrayContains } from "./../../../src/decorators"; const SEARCH_ITEM = 7; const NON_SEARCH_ITEM_STRING = "X"; diff --git a/packages/core/tests/impl/array/ArrayEmpty.test.ts b/packages/core/tests/impl/array/ArrayEmpty.test.ts index eb0aeaa61..2565f6bbc 100644 --- a/packages/core/tests/impl/array/ArrayEmpty.test.ts +++ b/packages/core/tests/impl/array/ArrayEmpty.test.ts @@ -1,4 +1,4 @@ -import { ArrayEmpty } from "../../../collection/array/ArrayEmpty"; +import { ArrayEmpty } from "../../../src/decorators"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; diff --git a/packages/core/tests/impl/array/ArrayEvery.test.ts b/packages/core/tests/impl/array/ArrayEvery.test.ts index 7639ee12b..7a74419fc 100644 --- a/packages/core/tests/impl/array/ArrayEvery.test.ts +++ b/packages/core/tests/impl/array/ArrayEvery.test.ts @@ -1,6 +1,6 @@ -import { ArrayEvery } from "../../../collection/array/ArrayEvery"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; +import { ArrayEvery } from "./../../../src/decorators"; /*** Data ***/ type Type = string[]; diff --git a/packages/core/tests/impl/array/ArrayNone.test.ts b/packages/core/tests/impl/array/ArrayNone.test.ts index 9b765a237..bb6fa89b0 100644 --- a/packages/core/tests/impl/array/ArrayNone.test.ts +++ b/packages/core/tests/impl/array/ArrayNone.test.ts @@ -1,6 +1,6 @@ -import { ArrayNone } from "../../../collection/array/ArrayNone"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; +import { ArrayNone } from "./../../../src/decorators"; /*** Data ***/ type Type = string[]; diff --git a/packages/core/tests/impl/array/ArrayOne.test.ts b/packages/core/tests/impl/array/ArrayOne.test.ts index 506ba1a17..cbaf789c4 100644 --- a/packages/core/tests/impl/array/ArrayOne.test.ts +++ b/packages/core/tests/impl/array/ArrayOne.test.ts @@ -1,6 +1,6 @@ -import { ArrayOne } from "../../../collection/array/ArrayOne"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; +import { ArrayOne } from "./../../../src/decorators"; /*** Data ***/ type Type = string[]; diff --git a/packages/core/tests/impl/array/ArraySizeExact.test.ts b/packages/core/tests/impl/array/ArraySizeExact.test.ts index df525248e..3a4bc28e8 100644 --- a/packages/core/tests/impl/array/ArraySizeExact.test.ts +++ b/packages/core/tests/impl/array/ArraySizeExact.test.ts @@ -1,6 +1,6 @@ -import { ArraySizeExact } from "../../../collection/array/ArraySizeExact"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; +import { ArraySizeExact } from "./../../../src/decorators"; /*** Data ***/ type Type = string[]; diff --git a/packages/core/tests/impl/array/ArraySizeMax.test.ts b/packages/core/tests/impl/array/ArraySizeMax.test.ts index 0976586e0..5ab775392 100644 --- a/packages/core/tests/impl/array/ArraySizeMax.test.ts +++ b/packages/core/tests/impl/array/ArraySizeMax.test.ts @@ -1,6 +1,6 @@ -import { ArraySizeMax } from "../../../collection/array/ArraySizeMax"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; +import { ArraySizeMax } from "./../../../src/decorators"; /*** Data ***/ type Type = string[]; diff --git a/packages/core/tests/impl/array/ArraySizeMin.test.ts b/packages/core/tests/impl/array/ArraySizeMin.test.ts index 961e4f3ad..ac85c6be7 100644 --- a/packages/core/tests/impl/array/ArraySizeMin.test.ts +++ b/packages/core/tests/impl/array/ArraySizeMin.test.ts @@ -1,6 +1,6 @@ -import { ArraySizeMin } from "../../../collection/array/ArraySizeMin"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; +import { ArraySizeMin } from "./../../../src/decorators"; /*** Data ***/ type Type = string[]; diff --git a/packages/core/tests/impl/array/ArraySizeRange.test.ts b/packages/core/tests/impl/array/ArraySizeRange.test.ts index cbef22b1b..7c81fa431 100644 --- a/packages/core/tests/impl/array/ArraySizeRange.test.ts +++ b/packages/core/tests/impl/array/ArraySizeRange.test.ts @@ -1,6 +1,6 @@ -import { ArraySizeRange } from "../../../collection/array/ArraySizeRange"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; +import { ArraySizeRange } from "./../../../src/decorators"; /*** Data ***/ type Type = string[]; diff --git a/packages/core/tests/impl/array/ArraySome.test.ts b/packages/core/tests/impl/array/ArraySome.test.ts index 98e7dacf7..9869e10b6 100644 --- a/packages/core/tests/impl/array/ArraySome.test.ts +++ b/packages/core/tests/impl/array/ArraySome.test.ts @@ -1,6 +1,6 @@ -import { ArraySome } from "../../../collection/array/ArraySome"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; +import { ArraySome } from "./../../../src/decorators"; /*** Data ***/ type Type = string[]; diff --git a/packages/core/tests/impl/array/ArrayUnique.test.ts b/packages/core/tests/impl/array/ArrayUnique.test.ts index 41cb52765..485ca348b 100644 --- a/packages/core/tests/impl/array/ArrayUnique.test.ts +++ b/packages/core/tests/impl/array/ArrayUnique.test.ts @@ -1,6 +1,6 @@ -import { ArrayUnique } from "../../../collection/array/ArrayUnique"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; +import { ArrayUnique } from "./../../../src/decorators"; /*** Data ***/ type Type = string[]; diff --git a/packages/core/tests/impl/array/foreach.test.ts b/packages/core/tests/impl/array/foreach.test.ts index 0f6ddd5c6..d1df35a53 100644 --- a/packages/core/tests/impl/array/foreach.test.ts +++ b/packages/core/tests/impl/array/foreach.test.ts @@ -1,7 +1,7 @@ -import { Required } from "../../../collection/any/Required"; -import { foreach } from "../../../collection/array/foreach"; +import { Required } from "../../../src/decorators"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; +import { foreach } from "./../../../src/decorators"; /*** Data ***/ type Type = string[]; diff --git a/packages/core/tests/impl/boolean/AssertFalse.test.ts b/packages/core/tests/impl/boolean/AssertFalse.test.ts index 9beea0da8..459b5e55e 100644 --- a/packages/core/tests/impl/boolean/AssertFalse.test.ts +++ b/packages/core/tests/impl/boolean/AssertFalse.test.ts @@ -1,4 +1,4 @@ -import { AssertFalse } from "../../../collection/boolean/AssertFalse"; +import { AssertFalse } from "../../../src/decorators"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; diff --git a/packages/core/tests/impl/boolean/AssertTrue.test.ts b/packages/core/tests/impl/boolean/AssertTrue.test.ts index fb717eb96..c60af2493 100644 --- a/packages/core/tests/impl/boolean/AssertTrue.test.ts +++ b/packages/core/tests/impl/boolean/AssertTrue.test.ts @@ -1,4 +1,4 @@ -import { AssertTrue } from "../../../collection/boolean/AssertTrue"; +import { AssertTrue } from "../../../src/decorators"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; diff --git a/packages/core/tests/impl/date/FutureDate.test.ts b/packages/core/tests/impl/date/FutureDate.test.ts index a3ba52bf2..45f04ffe6 100644 --- a/packages/core/tests/impl/date/FutureDate.test.ts +++ b/packages/core/tests/impl/date/FutureDate.test.ts @@ -1,5 +1,5 @@ -import { FutureDate } from "../../../collection/date/FutureDate"; import $ from "../../../index"; +import { FutureDate } from "../../../src/decorators"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; diff --git a/packages/core/tests/impl/date/PastDate.test.ts b/packages/core/tests/impl/date/PastDate.test.ts index 676416e0d..a8bb5bad3 100644 --- a/packages/core/tests/impl/date/PastDate.test.ts +++ b/packages/core/tests/impl/date/PastDate.test.ts @@ -1,5 +1,5 @@ -import { PastDate } from "../../../collection/date/PastDate"; import $ from "../../../index"; +import { PastDate } from "../../../src/decorators"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; diff --git a/packages/core/tests/impl/date/TodayDate.test.ts b/packages/core/tests/impl/date/TodayDate.test.ts index df5a425eb..cc5a57348 100644 --- a/packages/core/tests/impl/date/TodayDate.test.ts +++ b/packages/core/tests/impl/date/TodayDate.test.ts @@ -1,5 +1,5 @@ -import { TodayDate } from "../../../collection/date/TodayDate"; import $ from "../../../index"; +import { TodayDate } from "../../../src/decorators"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; diff --git a/packages/core/tests/impl/number/Decimal.test.ts b/packages/core/tests/impl/number/Decimal.test.ts index 83512f7c5..76e559dd9 100644 --- a/packages/core/tests/impl/number/Decimal.test.ts +++ b/packages/core/tests/impl/number/Decimal.test.ts @@ -1,5 +1,5 @@ -import { Decimal } from "../../../collection/number/Decimal"; import $ from "../../../index"; +import { Decimal } from "../../../src/decorators"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; diff --git a/packages/core/tests/impl/number/Digits.test.ts b/packages/core/tests/impl/number/Digits.test.ts index 2a0f9caed..3a8fb7712 100644 --- a/packages/core/tests/impl/number/Digits.test.ts +++ b/packages/core/tests/impl/number/Digits.test.ts @@ -1,5 +1,5 @@ -import { Digits } from "../../../collection/number/Digits"; import $ from "../../../index"; +import { Digits } from "../../../src/decorators"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; diff --git a/packages/core/tests/impl/number/Integer.test.ts b/packages/core/tests/impl/number/Integer.test.ts index f24b12a9d..6545f577f 100644 --- a/packages/core/tests/impl/number/Integer.test.ts +++ b/packages/core/tests/impl/number/Integer.test.ts @@ -1,5 +1,5 @@ -import { Integer } from "../../../collection/number/Integer"; import $ from "../../../index"; +import { Integer } from "../../../src/decorators"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; diff --git a/packages/core/tests/impl/number/Negative.test.ts b/packages/core/tests/impl/number/Negative.test.ts index 88d6fa3f5..0233b267d 100644 --- a/packages/core/tests/impl/number/Negative.test.ts +++ b/packages/core/tests/impl/number/Negative.test.ts @@ -1,5 +1,5 @@ -import { Negative } from "../../../collection/number/Negative"; import $ from "../../../index"; +import { Negative } from "../../../src/decorators"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; diff --git a/packages/core/tests/impl/number/NonNegative.test.ts b/packages/core/tests/impl/number/NonNegative.test.ts index 7ea391807..8bfdd5eaa 100644 --- a/packages/core/tests/impl/number/NonNegative.test.ts +++ b/packages/core/tests/impl/number/NonNegative.test.ts @@ -1,5 +1,5 @@ -import { NonNegative } from "../../../collection/number/NonNegative"; import $ from "../../../index"; +import { NonNegative } from "../../../src/decorators"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; diff --git a/packages/core/tests/impl/number/NonPositive.test.ts b/packages/core/tests/impl/number/NonPositive.test.ts index 0ef058ad3..7d65a7d40 100644 --- a/packages/core/tests/impl/number/NonPositive.test.ts +++ b/packages/core/tests/impl/number/NonPositive.test.ts @@ -1,5 +1,5 @@ -import { NonPositive } from "../../../collection/number/NonPositive"; import $ from "../../../index"; +import { NonPositive } from "../../../src/decorators"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; diff --git a/packages/core/tests/impl/number/Positive.test.ts b/packages/core/tests/impl/number/Positive.test.ts index 6f450534c..d5f36dea0 100644 --- a/packages/core/tests/impl/number/Positive.test.ts +++ b/packages/core/tests/impl/number/Positive.test.ts @@ -1,5 +1,5 @@ -import { Positive } from "../../../collection/number/Positive"; import $ from "../../../index"; +import { Positive } from "../../../src/decorators"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; diff --git a/packages/core/tests/impl/number/ValueMax.test.ts b/packages/core/tests/impl/number/ValueMax.test.ts index 1ac37f812..145fbebf1 100644 --- a/packages/core/tests/impl/number/ValueMax.test.ts +++ b/packages/core/tests/impl/number/ValueMax.test.ts @@ -1,5 +1,5 @@ -import { ValueMax } from "../../../collection/number/ValueMax"; import $ from "../../../index"; +import { ValueMax } from "../../../src/decorators"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; diff --git a/packages/core/tests/impl/number/ValueMin.test.ts b/packages/core/tests/impl/number/ValueMin.test.ts index 85780b94e..8bcda85df 100644 --- a/packages/core/tests/impl/number/ValueMin.test.ts +++ b/packages/core/tests/impl/number/ValueMin.test.ts @@ -1,5 +1,5 @@ -import { ValueMin } from "../../../collection/number/ValueMin"; import $ from "../../../index"; +import { ValueMin } from "../../../src/decorators"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; diff --git a/packages/core/tests/impl/number/ValueRange.test.ts b/packages/core/tests/impl/number/ValueRange.test.ts index dd4918665..8244c3917 100644 --- a/packages/core/tests/impl/number/ValueRange.test.ts +++ b/packages/core/tests/impl/number/ValueRange.test.ts @@ -1,5 +1,5 @@ -import { ValueRange } from "../../../collection/number/ValueRange"; import $ from "../../../index"; +import { ValueRange } from "../../../src/decorators"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; diff --git a/packages/core/tests/impl/string/ExactLength.test.ts b/packages/core/tests/impl/string/ExactLength.test.ts index b4f3782ac..14a9cd01c 100644 --- a/packages/core/tests/impl/string/ExactLength.test.ts +++ b/packages/core/tests/impl/string/ExactLength.test.ts @@ -1,5 +1,5 @@ -import { ExactLength } from "../../../collection/string/ExactLength"; import $ from "../../../index"; +import { ExactLength } from "../../../src/decorators"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; diff --git a/packages/core/tests/impl/string/MaxLength.test.ts b/packages/core/tests/impl/string/MaxLength.test.ts index 707f22209..c0331a6b9 100644 --- a/packages/core/tests/impl/string/MaxLength.test.ts +++ b/packages/core/tests/impl/string/MaxLength.test.ts @@ -1,5 +1,5 @@ -import { MaxLength } from "../../../collection/string/MaxLength"; import $ from "../../../index"; +import { MaxLength } from "../../../src/decorators"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; diff --git a/packages/core/tests/impl/string/MinLength.test.ts b/packages/core/tests/impl/string/MinLength.test.ts index e762cc80e..5a83bdc96 100644 --- a/packages/core/tests/impl/string/MinLength.test.ts +++ b/packages/core/tests/impl/string/MinLength.test.ts @@ -1,5 +1,5 @@ -import { MinLength } from "../../../collection/string/MinLength"; import $ from "../../../index"; +import { MinLength } from "../../../src/decorators"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; diff --git a/packages/core/tests/impl/string/Password.test.ts b/packages/core/tests/impl/string/Password.test.ts index f3213583b..a9b1d7430 100644 --- a/packages/core/tests/impl/string/Password.test.ts +++ b/packages/core/tests/impl/string/Password.test.ts @@ -1,5 +1,5 @@ -import { Password } from "../../../collection/string/Password"; import $ from "../../../index"; +import { Password } from "../../../src/decorators"; import { standardTest } from "../../common/TestFactory"; import { IMock } from "../../common/ValidationHandlerMock"; diff --git a/packages/core/tests/impl/string/regex/Pattern.test.ts b/packages/core/tests/impl/string/regex/Pattern.test.ts index 5c2b20c3e..24d945bf1 100644 --- a/packages/core/tests/impl/string/regex/Pattern.test.ts +++ b/packages/core/tests/impl/string/regex/Pattern.test.ts @@ -1,8 +1,8 @@ -import { Pattern } from "../../../../collection/string/regex/Pattern"; -import RegexConst from "../../../../collection/string/regex/shared/regex.constants"; import $ from "../../../../index"; +import RegexConst from "../../../../src/decorators/data/validators/string/regex/shared/regex.constants"; import { standardTest } from "../../../common/TestFactory"; import { IMock } from "../../../common/ValidationHandlerMock"; +import { Pattern } from "./../../../../src/decorators"; /*** Data ***/ type Type = $.Utilities.Objects.Optional; diff --git a/packages/core/tests/impl/string/regex/impl/Alpha.test.ts b/packages/core/tests/impl/string/regex/impl/Alpha.test.ts index a967e6b11..3e6b39c10 100644 --- a/packages/core/tests/impl/string/regex/impl/Alpha.test.ts +++ b/packages/core/tests/impl/string/regex/impl/Alpha.test.ts @@ -1,5 +1,5 @@ -import { Alpha } from "../../../../../collection/string/regex/impl/Alpha"; import $ from "../../../../../index"; +import { Alpha } from "../../../../../src/decorators"; import { standardTest } from "../../../../common/TestFactory"; import { IMock } from "../../../../common/ValidationHandlerMock"; diff --git a/packages/core/tests/impl/string/regex/impl/Alphanumeric.test.ts b/packages/core/tests/impl/string/regex/impl/Alphanumeric.test.ts index cf0a5ba78..c1bf9d4e1 100644 --- a/packages/core/tests/impl/string/regex/impl/Alphanumeric.test.ts +++ b/packages/core/tests/impl/string/regex/impl/Alphanumeric.test.ts @@ -1,5 +1,5 @@ -import { Alphanumeric } from "../../../../../collection/string/regex/impl/Alphanumeric"; -import Objects from "../../../../../src/utilities/impl/Objects"; +import { Alphanumeric } from "../../../../../src/decorators"; +import { Objects } from "../../../../../src/utilities"; import { standardTest } from "../../../../common/TestFactory"; import { IMock } from "../../../../common/ValidationHandlerMock"; diff --git a/packages/core/tests/impl/string/regex/impl/Email.test.ts b/packages/core/tests/impl/string/regex/impl/Email.test.ts index d473aea08..821f081e4 100644 --- a/packages/core/tests/impl/string/regex/impl/Email.test.ts +++ b/packages/core/tests/impl/string/regex/impl/Email.test.ts @@ -1,5 +1,5 @@ -import { Email } from "../../../../../collection/string/regex/impl/Email"; import $ from "../../../../../index"; +import { Email } from "../../../../../src/decorators"; import { standardTest } from "../../../../common/TestFactory"; import { IMock } from "../../../../common/ValidationHandlerMock"; diff --git a/packages/core/tests/impl/string/regex/impl/IPAddress.test.ts b/packages/core/tests/impl/string/regex/impl/IPAddress.test.ts index b94d8f928..d237a83fe 100644 --- a/packages/core/tests/impl/string/regex/impl/IPAddress.test.ts +++ b/packages/core/tests/impl/string/regex/impl/IPAddress.test.ts @@ -1,5 +1,5 @@ -import { IPAddress } from "../../../../../collection/string/regex/impl/IPAddress"; import $ from "../../../../../index"; +import { IPAddress } from "../../../../../src/decorators"; import { standardTest } from "../../../../common/TestFactory"; import { IMock } from "../../../../common/ValidationHandlerMock"; @@ -8,13 +8,7 @@ type Type = $.Utilities.Objects.Optional; const type = "String"; const identifier = "IPAddress"; const successData: Type[] = ["192.168.1.0", "", null, undefined]; -const errorData: Type[] = [ - "test123", - "192.168", - "@@@", - "gmail.com", - "www.google.hr", -]; +const errorData: Type[] = ["test123", "192.168", "@@@", "gmail.com", "www.google.hr"]; /*** Model ***/ class Model implements IMock { diff --git a/packages/core/tests/impl/string/regex/impl/Lowercase.test.ts b/packages/core/tests/impl/string/regex/impl/Lowercase.test.ts index 5b3e13ea8..bddcfa8aa 100644 --- a/packages/core/tests/impl/string/regex/impl/Lowercase.test.ts +++ b/packages/core/tests/impl/string/regex/impl/Lowercase.test.ts @@ -1,5 +1,5 @@ -import { Lowercase } from "../../../../../collection/string/regex/impl/Lowercase"; import $ from "../../../../../index"; +import { Lowercase } from "../../../../../src/decorators"; import { standardTest } from "../../../../common/TestFactory"; import { IMock } from "../../../../common/ValidationHandlerMock"; diff --git a/packages/core/tests/impl/string/regex/impl/Numeric.test.ts b/packages/core/tests/impl/string/regex/impl/Numeric.test.ts index 0d5b0ca4b..452338f5c 100644 --- a/packages/core/tests/impl/string/regex/impl/Numeric.test.ts +++ b/packages/core/tests/impl/string/regex/impl/Numeric.test.ts @@ -1,5 +1,5 @@ -import { Numeric } from "../../../../../collection/string/regex/impl/Numeric"; import $ from "../../../../../index"; +import { Numeric } from "../../../../../src/decorators"; import { standardTest } from "../../../../common/TestFactory"; import { IMock } from "../../../../common/ValidationHandlerMock"; diff --git a/packages/core/tests/impl/string/regex/impl/URL.test.ts b/packages/core/tests/impl/string/regex/impl/URL.test.ts index 584693abd..185547122 100644 --- a/packages/core/tests/impl/string/regex/impl/URL.test.ts +++ b/packages/core/tests/impl/string/regex/impl/URL.test.ts @@ -1,5 +1,5 @@ -import { URL } from "../../../../../collection/string/regex/impl/URL"; import $ from "../../../../../index"; +import { URL } from "../../../../../src/decorators"; import { standardTest } from "../../../../common/TestFactory"; import { IMock } from "../../../../common/ValidationHandlerMock"; @@ -7,12 +7,7 @@ import { IMock } from "../../../../common/ValidationHandlerMock"; type Type = $.Utilities.Objects.Optional; const type = "String"; const identifier = "URL"; -const successData: Type[] = [ - "www.google.hr", - "https://www.facebook.com/?query=", - null, - undefined, -]; +const successData: Type[] = ["www.google.hr", "https://www.facebook.com/?query=", null, undefined]; const errorData: Type[] = ["/google.com", "test@test"]; /*** Model ***/ diff --git a/packages/core/tests/impl/string/regex/impl/Uppercase.test.ts b/packages/core/tests/impl/string/regex/impl/Uppercase.test.ts index 6beaec39b..df526fdc5 100644 --- a/packages/core/tests/impl/string/regex/impl/Uppercase.test.ts +++ b/packages/core/tests/impl/string/regex/impl/Uppercase.test.ts @@ -1,5 +1,5 @@ -import { Uppercase } from "../../../../../collection/string/regex/impl/Uppercase"; import $ from "../../../../../index"; +import { Uppercase } from "../../../../../src/decorators"; import { standardTest } from "../../../../common/TestFactory"; import { IMock } from "../../../../common/ValidationHandlerMock"; diff --git a/packages/react/tests/impl/useForm/useForm.test.tsx b/packages/react/tests/impl/useForm/useForm.test.tsx index 60cfd8306..d430d535a 100644 --- a/packages/react/tests/impl/useForm/useForm.test.tsx +++ b/packages/react/tests/impl/useForm/useForm.test.tsx @@ -1,11 +1,11 @@ import { renderHook } from "@testing-library/react-hooks"; -import { Required } from "tdv-core/validators"; +import { Decorators } from "tdv-core"; import useValidation from "../../../src/hooks/useValidation"; jest.spyOn(console, "error").mockImplementation(() => {}); class TestForm { - @Required() + @Decorators.Required() username!: string; } diff --git a/packages/react/tests/impl/useValidation/useValidation.test.tsx b/packages/react/tests/impl/useValidation/useValidation.test.tsx index 35846609b..d430d535a 100644 --- a/packages/react/tests/impl/useValidation/useValidation.test.tsx +++ b/packages/react/tests/impl/useValidation/useValidation.test.tsx @@ -1,18 +1,16 @@ import { renderHook } from "@testing-library/react-hooks"; -import { collection } from "tdv-core"; +import { Decorators } from "tdv-core"; import useValidation from "../../../src/hooks/useValidation"; jest.spyOn(console, "error").mockImplementation(() => {}); class TestForm { - @collection.string.Required() + @Decorators.Required() username!: string; } test("first render error, second render success", async () => { - const { result, waitForNextUpdate } = renderHook(() => - useValidation(TestForm) - ); + const { result, waitForNextUpdate } = renderHook(() => useValidation(TestForm)); expect(result.current[2]).toHaveProperty("errors.username"); expect(result.current[2].errors?.username).toHaveLength(1);