@haskou/value-objects 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/errors/BaseError.d.ts +8 -0
- package/dist/src/errors/BaseError.d.ts.map +1 -0
- package/dist/src/errors/BaseError.js +22 -0
- package/dist/src/errors/BaseError.js.map +1 -0
- package/dist/src/errors/DomainError.d.ts +7 -0
- package/dist/src/errors/DomainError.d.ts.map +1 -0
- package/dist/src/errors/DomainError.js +15 -0
- package/dist/src/errors/DomainError.js.map +1 -0
- package/dist/src/errors/InvalidColorError.d.ts +5 -0
- package/dist/src/errors/InvalidColorError.d.ts.map +1 -0
- package/dist/src/errors/InvalidColorError.js +11 -0
- package/dist/src/errors/InvalidColorError.js.map +1 -0
- package/dist/src/errors/InvalidDayError.d.ts +5 -0
- package/dist/src/errors/InvalidDayError.d.ts.map +1 -0
- package/dist/src/errors/InvalidDayError.js +11 -0
- package/dist/src/errors/InvalidDayError.js.map +1 -0
- package/dist/src/errors/InvalidDayFormatError.d.ts +5 -0
- package/dist/src/errors/InvalidDayFormatError.d.ts.map +1 -0
- package/dist/src/errors/InvalidDayFormatError.js +11 -0
- package/dist/src/errors/InvalidDayFormatError.js.map +1 -0
- package/dist/src/errors/InvalidEmailError.d.ts +5 -0
- package/dist/src/errors/InvalidEmailError.d.ts.map +1 -0
- package/dist/src/errors/InvalidEmailError.js +11 -0
- package/dist/src/errors/InvalidEmailError.js.map +1 -0
- package/dist/src/errors/InvalidFormatError.d.ts +5 -0
- package/dist/src/errors/InvalidFormatError.d.ts.map +1 -0
- package/dist/src/errors/InvalidFormatError.js +11 -0
- package/dist/src/errors/InvalidFormatError.js.map +1 -0
- package/dist/src/errors/InvalidHashError.d.ts +5 -0
- package/dist/src/errors/InvalidHashError.d.ts.map +1 -0
- package/dist/src/errors/InvalidHashError.js +11 -0
- package/dist/src/errors/InvalidHashError.js.map +1 -0
- package/dist/src/errors/InvalidHourError.d.ts +5 -0
- package/dist/src/errors/InvalidHourError.d.ts.map +1 -0
- package/dist/src/errors/InvalidHourError.js +11 -0
- package/dist/src/errors/InvalidHourError.js.map +1 -0
- package/dist/src/errors/InvalidIntegerError.d.ts +5 -0
- package/dist/src/errors/InvalidIntegerError.d.ts.map +1 -0
- package/dist/src/errors/InvalidIntegerError.js +11 -0
- package/dist/src/errors/InvalidIntegerError.js.map +1 -0
- package/dist/src/errors/InvalidLatitudeError.d.ts +5 -0
- package/dist/src/errors/InvalidLatitudeError.d.ts.map +1 -0
- package/dist/src/errors/InvalidLatitudeError.js +11 -0
- package/dist/src/errors/InvalidLatitudeError.js.map +1 -0
- package/dist/src/errors/InvalidLengthError.d.ts +5 -0
- package/dist/src/errors/InvalidLengthError.d.ts.map +1 -0
- package/dist/src/errors/InvalidLengthError.js +11 -0
- package/dist/src/errors/InvalidLengthError.js.map +1 -0
- package/dist/src/errors/InvalidLongitudeError.d.ts +5 -0
- package/dist/src/errors/InvalidLongitudeError.d.ts.map +1 -0
- package/dist/src/errors/InvalidLongitudeError.js +11 -0
- package/dist/src/errors/InvalidLongitudeError.js.map +1 -0
- package/dist/src/errors/InvalidMinutesError.d.ts +5 -0
- package/dist/src/errors/InvalidMinutesError.d.ts.map +1 -0
- package/dist/src/errors/InvalidMinutesError.js +11 -0
- package/dist/src/errors/InvalidMinutesError.js.map +1 -0
- package/dist/src/errors/InvalidNumberError.d.ts +5 -0
- package/dist/src/errors/InvalidNumberError.d.ts.map +1 -0
- package/dist/src/errors/InvalidNumberError.js +11 -0
- package/dist/src/errors/InvalidNumberError.js.map +1 -0
- package/dist/src/errors/InvalidPositiveNumberError.d.ts +5 -0
- package/dist/src/errors/InvalidPositiveNumberError.d.ts.map +1 -0
- package/dist/src/errors/InvalidPositiveNumberError.js +11 -0
- package/dist/src/errors/InvalidPositiveNumberError.js.map +1 -0
- package/dist/src/errors/InvalidStringLengthError.d.ts +5 -0
- package/dist/src/errors/InvalidStringLengthError.d.ts.map +1 -0
- package/dist/src/errors/InvalidStringLengthError.js +11 -0
- package/dist/src/errors/InvalidStringLengthError.js.map +1 -0
- package/dist/src/errors/InvalidTimestampIntervalError.d.ts +6 -0
- package/dist/src/errors/InvalidTimestampIntervalError.d.ts.map +1 -0
- package/dist/src/errors/InvalidTimestampIntervalError.js +11 -0
- package/dist/src/errors/InvalidTimestampIntervalError.js.map +1 -0
- package/dist/src/errors/InvalidValueError.d.ts +5 -0
- package/dist/src/errors/InvalidValueError.d.ts.map +1 -0
- package/dist/src/errors/InvalidValueError.js +11 -0
- package/dist/src/errors/InvalidValueError.js.map +1 -0
- package/dist/src/errors/NullObjectError.d.ts +5 -0
- package/dist/src/errors/NullObjectError.d.ts.map +1 -0
- package/dist/src/errors/NullObjectError.js +12 -0
- package/dist/src/errors/NullObjectError.js.map +1 -0
- package/dist/src/errors/ValueNotInEnumError.d.ts +5 -0
- package/dist/src/errors/ValueNotInEnumError.d.ts.map +1 -0
- package/dist/src/errors/ValueNotInEnumError.js +11 -0
- package/dist/src/errors/ValueNotInEnumError.js.map +1 -0
- package/{src/errors/index.ts → dist/src/errors/index.d.ts} +1 -0
- package/dist/src/errors/index.d.ts.map +1 -0
- package/dist/src/errors/index.js +24 -0
- package/dist/src/errors/index.js.map +1 -0
- package/{src/index.ts → dist/src/index.d.ts} +1 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +9 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/interfaces/PrimitiveOf.d.ts +5 -0
- package/dist/src/interfaces/PrimitiveOf.d.ts.map +1 -0
- package/dist/src/interfaces/PrimitiveOf.js +3 -0
- package/dist/src/interfaces/PrimitiveOf.js.map +1 -0
- package/dist/src/interfaces/index.d.ts +2 -0
- package/dist/src/interfaces/index.d.ts.map +1 -0
- package/dist/src/interfaces/index.js +5 -0
- package/dist/src/interfaces/index.js.map +1 -0
- package/dist/src/patterns/Assert.d.ts +5 -0
- package/dist/src/patterns/Assert.d.ts.map +1 -0
- package/dist/src/patterns/Assert.js +11 -0
- package/dist/src/patterns/Assert.js.map +1 -0
- package/dist/src/patterns/index.d.ts +2 -0
- package/dist/src/patterns/index.d.ts.map +1 -0
- package/dist/src/patterns/index.js +5 -0
- package/dist/src/patterns/index.js.map +1 -0
- package/{src/types/Nullish.ts → dist/src/types/Nullish.d.ts} +1 -0
- package/dist/src/types/Nullish.d.ts.map +1 -0
- package/dist/src/types/Nullish.js +3 -0
- package/dist/src/types/Nullish.js.map +1 -0
- package/{src/types/Primitive.ts → dist/src/types/Primitive.d.ts} +1 -0
- package/dist/src/types/Primitive.d.ts.map +1 -0
- package/dist/src/types/Primitive.js +3 -0
- package/dist/src/types/Primitive.js.map +1 -0
- package/{src/types/index.ts → dist/src/types/index.d.ts} +1 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/types/index.js +6 -0
- package/dist/src/types/index.js.map +1 -0
- package/dist/src/value-objects/Color.d.ts +19 -0
- package/dist/src/value-objects/Color.d.ts.map +1 -0
- package/dist/src/value-objects/Color.js +37 -0
- package/dist/src/value-objects/Color.js.map +1 -0
- package/dist/src/value-objects/Email.d.ts +6 -0
- package/dist/src/value-objects/Email.d.ts.map +1 -0
- package/dist/src/value-objects/Email.js +21 -0
- package/dist/src/value-objects/Email.js.map +1 -0
- package/dist/src/value-objects/Enum.d.ts +9 -0
- package/dist/src/value-objects/Enum.d.ts.map +1 -0
- package/dist/src/value-objects/Enum.js +24 -0
- package/dist/src/value-objects/Enum.js.map +1 -0
- package/dist/src/value-objects/Integer.d.ts +6 -0
- package/dist/src/value-objects/Integer.d.ts.map +1 -0
- package/dist/src/value-objects/Integer.js +21 -0
- package/dist/src/value-objects/Integer.js.map +1 -0
- package/dist/src/value-objects/NullObject.d.ts +8 -0
- package/dist/src/value-objects/NullObject.d.ts.map +1 -0
- package/dist/src/value-objects/NullObject.js +43 -0
- package/dist/src/value-objects/NullObject.js.map +1 -0
- package/dist/src/value-objects/NumberValueObject.d.ts +15 -0
- package/dist/src/value-objects/NumberValueObject.d.ts.map +1 -0
- package/dist/src/value-objects/NumberValueObject.js +48 -0
- package/dist/src/value-objects/NumberValueObject.js.map +1 -0
- package/dist/src/value-objects/PositiveNumber.d.ts +6 -0
- package/dist/src/value-objects/PositiveNumber.d.ts.map +1 -0
- package/dist/src/value-objects/PositiveNumber.js +21 -0
- package/dist/src/value-objects/PositiveNumber.js.map +1 -0
- package/dist/src/value-objects/StringValueObject.d.ts +7 -0
- package/dist/src/value-objects/StringValueObject.d.ts.map +1 -0
- package/dist/src/value-objects/StringValueObject.js +24 -0
- package/dist/src/value-objects/StringValueObject.js.map +1 -0
- package/dist/src/value-objects/ValueObject.d.ts +12 -0
- package/dist/src/value-objects/ValueObject.d.ts.map +1 -0
- package/dist/src/value-objects/ValueObject.js +33 -0
- package/dist/src/value-objects/ValueObject.js.map +1 -0
- package/dist/src/value-objects/coordinates/Coordinates.d.ts +12 -0
- package/dist/src/value-objects/coordinates/Coordinates.d.ts.map +1 -0
- package/dist/src/value-objects/coordinates/Coordinates.js +28 -0
- package/dist/src/value-objects/coordinates/Coordinates.js.map +1 -0
- package/dist/src/value-objects/coordinates/Latitude.d.ts +8 -0
- package/dist/src/value-objects/coordinates/Latitude.d.ts.map +1 -0
- package/dist/src/value-objects/coordinates/Latitude.js +21 -0
- package/dist/src/value-objects/coordinates/Latitude.js.map +1 -0
- package/dist/src/value-objects/coordinates/Longitude.d.ts +8 -0
- package/dist/src/value-objects/coordinates/Longitude.d.ts.map +1 -0
- package/dist/src/value-objects/coordinates/Longitude.js +21 -0
- package/dist/src/value-objects/coordinates/Longitude.js.map +1 -0
- package/{src/value-objects/coordinates/index.ts → dist/src/value-objects/coordinates/index.d.ts} +1 -0
- package/dist/src/value-objects/coordinates/index.d.ts.map +1 -0
- package/dist/src/value-objects/coordinates/index.js +7 -0
- package/dist/src/value-objects/coordinates/index.js.map +1 -0
- package/dist/src/value-objects/hashes/Hash.d.ts +7 -0
- package/dist/src/value-objects/hashes/Hash.d.ts.map +1 -0
- package/dist/src/value-objects/hashes/Hash.js +19 -0
- package/dist/src/value-objects/hashes/Hash.js.map +1 -0
- package/dist/src/value-objects/hashes/MD5Hash.d.ts +8 -0
- package/dist/src/value-objects/hashes/MD5Hash.d.ts.map +1 -0
- package/dist/src/value-objects/hashes/MD5Hash.js +26 -0
- package/dist/src/value-objects/hashes/MD5Hash.js.map +1 -0
- package/dist/src/value-objects/hashes/SHA256Hash.d.ts +9 -0
- package/dist/src/value-objects/hashes/SHA256Hash.d.ts.map +1 -0
- package/dist/src/value-objects/hashes/SHA256Hash.js +29 -0
- package/dist/src/value-objects/hashes/SHA256Hash.js.map +1 -0
- package/dist/src/value-objects/hashes/SHA512Hash.d.ts +9 -0
- package/dist/src/value-objects/hashes/SHA512Hash.d.ts.map +1 -0
- package/dist/src/value-objects/hashes/SHA512Hash.js +29 -0
- package/dist/src/value-objects/hashes/SHA512Hash.js.map +1 -0
- package/{src/value-objects/hashes/index.ts → dist/src/value-objects/hashes/index.d.ts} +1 -0
- package/dist/src/value-objects/hashes/index.d.ts.map +1 -0
- package/dist/src/value-objects/hashes/index.js +8 -0
- package/dist/src/value-objects/hashes/index.js.map +1 -0
- package/dist/src/value-objects/ids/ShortId.d.ts +10 -0
- package/dist/src/value-objects/ids/ShortId.d.ts.map +1 -0
- package/dist/src/value-objects/ids/ShortId.js +30 -0
- package/dist/src/value-objects/ids/ShortId.js.map +1 -0
- package/dist/src/value-objects/ids/UUID.d.ts +10 -0
- package/dist/src/value-objects/ids/UUID.d.ts.map +1 -0
- package/dist/src/value-objects/ids/UUID.js +29 -0
- package/dist/src/value-objects/ids/UUID.js.map +1 -0
- package/{src/value-objects/ids/index.ts → dist/src/value-objects/ids/index.d.ts} +1 -0
- package/dist/src/value-objects/ids/index.d.ts.map +1 -0
- package/dist/src/value-objects/ids/index.js +6 -0
- package/dist/src/value-objects/ids/index.js.map +1 -0
- package/{src/value-objects/index.ts → dist/src/value-objects/index.d.ts} +1 -0
- package/dist/src/value-objects/index.d.ts.map +1 -0
- package/dist/src/value-objects/index.js +16 -0
- package/dist/src/value-objects/index.js.map +1 -0
- package/dist/src/value-objects/time/CalendarDay.d.ts +25 -0
- package/dist/src/value-objects/time/CalendarDay.d.ts.map +1 -0
- package/dist/src/value-objects/time/CalendarDay.js +74 -0
- package/dist/src/value-objects/time/CalendarDay.js.map +1 -0
- package/dist/src/value-objects/time/Day.d.ts +7 -0
- package/dist/src/value-objects/time/Day.d.ts.map +1 -0
- package/dist/src/value-objects/time/Day.js +18 -0
- package/dist/src/value-objects/time/Day.js.map +1 -0
- package/dist/src/value-objects/time/DayOfWeek.d.ts +34 -0
- package/dist/src/value-objects/time/DayOfWeek.d.ts.map +1 -0
- package/dist/src/value-objects/time/DayOfWeek.js +52 -0
- package/dist/src/value-objects/time/DayOfWeek.js.map +1 -0
- package/dist/src/value-objects/time/Duration.d.ts +23 -0
- package/dist/src/value-objects/time/Duration.d.ts.map +1 -0
- package/dist/src/value-objects/time/Duration.js +79 -0
- package/dist/src/value-objects/time/Duration.js.map +1 -0
- package/dist/src/value-objects/time/Hour.d.ts +15 -0
- package/dist/src/value-objects/time/Hour.d.ts.map +1 -0
- package/dist/src/value-objects/time/Hour.js +81 -0
- package/dist/src/value-objects/time/Hour.js.map +1 -0
- package/dist/src/value-objects/time/Month.d.ts +18 -0
- package/dist/src/value-objects/time/Month.d.ts.map +1 -0
- package/dist/src/value-objects/time/Month.js +41 -0
- package/dist/src/value-objects/time/Month.js.map +1 -0
- package/dist/src/value-objects/time/MonthOfYear.d.ts +17 -0
- package/dist/src/value-objects/time/MonthOfYear.d.ts.map +1 -0
- package/dist/src/value-objects/time/MonthOfYear.js +45 -0
- package/dist/src/value-objects/time/MonthOfYear.js.map +1 -0
- package/dist/src/value-objects/time/Timestamp.d.ts +51 -0
- package/dist/src/value-objects/time/Timestamp.d.ts.map +1 -0
- package/dist/src/value-objects/time/Timestamp.js +156 -0
- package/dist/src/value-objects/time/Timestamp.js.map +1 -0
- package/dist/src/value-objects/time/TimestampInterval.d.ts +26 -0
- package/dist/src/value-objects/time/TimestampInterval.d.ts.map +1 -0
- package/dist/src/value-objects/time/TimestampInterval.js +88 -0
- package/dist/src/value-objects/time/TimestampInterval.js.map +1 -0
- package/dist/src/value-objects/time/Year.d.ts +10 -0
- package/dist/src/value-objects/time/Year.d.ts.map +1 -0
- package/dist/src/value-objects/time/Year.js +26 -0
- package/dist/src/value-objects/time/Year.js.map +1 -0
- package/{src/value-objects/time/index.ts → dist/src/value-objects/time/index.d.ts} +1 -0
- package/dist/src/value-objects/time/index.d.ts.map +1 -0
- package/dist/src/value-objects/time/index.js +14 -0
- package/dist/src/value-objects/time/index.js.map +1 -0
- package/dist/tests/errors/BaseError.spec.d.ts +2 -0
- package/dist/tests/errors/BaseError.spec.d.ts.map +1 -0
- package/dist/tests/errors/BaseError.spec.js +54 -0
- package/dist/tests/errors/BaseError.spec.js.map +1 -0
- package/dist/tests/errors/DomainError.spec.d.ts +2 -0
- package/dist/tests/errors/DomainError.spec.d.ts.map +1 -0
- package/dist/tests/errors/DomainError.spec.js +47 -0
- package/dist/tests/errors/DomainError.spec.js.map +1 -0
- package/dist/tests/patterns/Assert.spec.d.ts +2 -0
- package/dist/tests/patterns/Assert.spec.d.ts.map +1 -0
- package/dist/tests/patterns/Assert.spec.js +27 -0
- package/dist/tests/patterns/Assert.spec.js.map +1 -0
- package/dist/tests/setup.jest.d.ts +2 -0
- package/dist/tests/setup.jest.d.ts.map +1 -0
- package/dist/tests/setup.jest.js +6 -0
- package/dist/tests/setup.jest.js.map +1 -0
- package/dist/tests/value-objects/Color.spec.d.ts +2 -0
- package/dist/tests/value-objects/Color.spec.d.ts.map +1 -0
- package/dist/tests/value-objects/Color.spec.js +171 -0
- package/dist/tests/value-objects/Color.spec.js.map +1 -0
- package/dist/tests/value-objects/Email.spec.d.ts +2 -0
- package/dist/tests/value-objects/Email.spec.d.ts.map +1 -0
- package/dist/tests/value-objects/Email.spec.js +117 -0
- package/dist/tests/value-objects/Email.spec.js.map +1 -0
- package/dist/tests/value-objects/Enum.spec.d.ts +2 -0
- package/dist/tests/value-objects/Enum.spec.d.ts.map +1 -0
- package/dist/tests/value-objects/Enum.spec.js +233 -0
- package/dist/tests/value-objects/Enum.spec.js.map +1 -0
- package/dist/tests/value-objects/Integer.spec.d.ts +2 -0
- package/dist/tests/value-objects/Integer.spec.d.ts.map +1 -0
- package/dist/tests/value-objects/Integer.spec.js +31 -0
- package/dist/tests/value-objects/Integer.spec.js.map +1 -0
- package/dist/tests/value-objects/NullObject.spec.d.ts +2 -0
- package/dist/tests/value-objects/NullObject.spec.d.ts.map +1 -0
- package/dist/tests/value-objects/NullObject.spec.js +48 -0
- package/dist/tests/value-objects/NullObject.spec.js.map +1 -0
- package/dist/tests/value-objects/NumberValueObject.spec.d.ts +2 -0
- package/dist/tests/value-objects/NumberValueObject.spec.d.ts.map +1 -0
- package/dist/tests/value-objects/NumberValueObject.spec.js +333 -0
- package/dist/tests/value-objects/NumberValueObject.spec.js.map +1 -0
- package/dist/tests/value-objects/PositiveNumber.spec.d.ts +2 -0
- package/dist/tests/value-objects/PositiveNumber.spec.d.ts.map +1 -0
- package/dist/tests/value-objects/PositiveNumber.spec.js +209 -0
- package/dist/tests/value-objects/PositiveNumber.spec.js.map +1 -0
- package/dist/tests/value-objects/StringValueObject.spec.d.ts +2 -0
- package/dist/tests/value-objects/StringValueObject.spec.d.ts.map +1 -0
- package/dist/tests/value-objects/StringValueObject.spec.js +104 -0
- package/dist/tests/value-objects/StringValueObject.spec.js.map +1 -0
- package/dist/tests/value-objects/coordinates/Coordinates.spec.d.ts +2 -0
- package/dist/tests/value-objects/coordinates/Coordinates.spec.d.ts.map +1 -0
- package/dist/tests/value-objects/coordinates/Coordinates.spec.js +76 -0
- package/dist/tests/value-objects/coordinates/Coordinates.spec.js.map +1 -0
- package/dist/tests/value-objects/coordinates/Latitude.spec.d.ts +2 -0
- package/dist/tests/value-objects/coordinates/Latitude.spec.d.ts.map +1 -0
- package/dist/tests/value-objects/coordinates/Latitude.spec.js +23 -0
- package/dist/tests/value-objects/coordinates/Latitude.spec.js.map +1 -0
- package/dist/tests/value-objects/coordinates/Longitude.spec.d.ts +2 -0
- package/dist/tests/value-objects/coordinates/Longitude.spec.d.ts.map +1 -0
- package/dist/tests/value-objects/coordinates/Longitude.spec.js +23 -0
- package/dist/tests/value-objects/coordinates/Longitude.spec.js.map +1 -0
- package/dist/tests/value-objects/hashes/Hashes.spec.d.ts +2 -0
- package/dist/tests/value-objects/hashes/Hashes.spec.d.ts.map +1 -0
- package/dist/tests/value-objects/hashes/Hashes.spec.js +107 -0
- package/dist/tests/value-objects/hashes/Hashes.spec.js.map +1 -0
- package/dist/tests/value-objects/hashes/MD5Hash.spec.d.ts +2 -0
- package/dist/tests/value-objects/hashes/MD5Hash.spec.d.ts.map +1 -0
- package/dist/tests/value-objects/hashes/MD5Hash.spec.js +147 -0
- package/dist/tests/value-objects/hashes/MD5Hash.spec.js.map +1 -0
- package/dist/tests/value-objects/hashes/SHA256Hash.spec.d.ts +2 -0
- package/dist/tests/value-objects/hashes/SHA256Hash.spec.d.ts.map +1 -0
- package/dist/tests/value-objects/hashes/SHA256Hash.spec.js +147 -0
- package/dist/tests/value-objects/hashes/SHA256Hash.spec.js.map +1 -0
- package/dist/tests/value-objects/hashes/SHA512Hash.spec.d.ts +2 -0
- package/dist/tests/value-objects/hashes/SHA512Hash.spec.d.ts.map +1 -0
- package/dist/tests/value-objects/hashes/SHA512Hash.spec.js +147 -0
- package/dist/tests/value-objects/hashes/SHA512Hash.spec.js.map +1 -0
- package/dist/tests/value-objects/ids/ShortId.spec.d.ts +2 -0
- package/dist/tests/value-objects/ids/ShortId.spec.d.ts.map +1 -0
- package/dist/tests/value-objects/ids/ShortId.spec.js +30 -0
- package/dist/tests/value-objects/ids/ShortId.spec.js.map +1 -0
- package/dist/tests/value-objects/ids/UUID.spec.d.ts +2 -0
- package/dist/tests/value-objects/ids/UUID.spec.d.ts.map +1 -0
- package/dist/tests/value-objects/ids/UUID.spec.js +30 -0
- package/dist/tests/value-objects/ids/UUID.spec.js.map +1 -0
- package/dist/tests/value-objects/time/CalendarDay.spec.d.ts +2 -0
- package/dist/tests/value-objects/time/CalendarDay.spec.d.ts.map +1 -0
- package/dist/tests/value-objects/time/CalendarDay.spec.js +149 -0
- package/dist/tests/value-objects/time/CalendarDay.spec.js.map +1 -0
- package/dist/tests/value-objects/time/Day.spec.d.ts +2 -0
- package/dist/tests/value-objects/time/Day.spec.d.ts.map +1 -0
- package/dist/tests/value-objects/time/Day.spec.js +28 -0
- package/dist/tests/value-objects/time/Day.spec.js.map +1 -0
- package/dist/tests/value-objects/time/DayOfWeek.spec.d.ts +2 -0
- package/dist/tests/value-objects/time/DayOfWeek.spec.d.ts.map +1 -0
- package/dist/tests/value-objects/time/DayOfWeek.spec.js +44 -0
- package/dist/tests/value-objects/time/DayOfWeek.spec.js.map +1 -0
- package/dist/tests/value-objects/time/Duration.spec.d.ts +2 -0
- package/dist/tests/value-objects/time/Duration.spec.d.ts.map +1 -0
- package/dist/tests/value-objects/time/Duration.spec.js +255 -0
- package/dist/tests/value-objects/time/Duration.spec.js.map +1 -0
- package/dist/tests/value-objects/time/Hour.spec.d.ts +2 -0
- package/dist/tests/value-objects/time/Hour.spec.d.ts.map +1 -0
- package/dist/tests/value-objects/time/Hour.spec.js +168 -0
- package/dist/tests/value-objects/time/Hour.spec.js.map +1 -0
- package/dist/tests/value-objects/time/MonthOfYear.spec.d.ts +2 -0
- package/dist/tests/value-objects/time/MonthOfYear.spec.d.ts.map +1 -0
- package/dist/tests/value-objects/time/MonthOfYear.spec.js +93 -0
- package/dist/tests/value-objects/time/MonthOfYear.spec.js.map +1 -0
- package/dist/tests/value-objects/time/Timestamp.spec.d.ts +2 -0
- package/dist/tests/value-objects/time/Timestamp.spec.d.ts.map +1 -0
- package/dist/tests/value-objects/time/Timestamp.spec.js +391 -0
- package/dist/tests/value-objects/time/Timestamp.spec.js.map +1 -0
- package/dist/tests/value-objects/time/TimestampInterval.spec.d.ts +2 -0
- package/dist/tests/value-objects/time/TimestampInterval.spec.d.ts.map +1 -0
- package/dist/tests/value-objects/time/TimestampInterval.spec.js +270 -0
- package/dist/tests/value-objects/time/TimestampInterval.spec.js.map +1 -0
- package/dist/tests/value-objects/time/Year.spec.d.ts +2 -0
- package/dist/tests/value-objects/time/Year.spec.d.ts.map +1 -0
- package/dist/tests/value-objects/time/Year.spec.js +41 -0
- package/dist/tests/value-objects/time/Year.spec.js.map +1 -0
- package/package.json +9 -5
- package/.editorconfig +0 -15
- package/.eslintignore +0 -3
- package/.eslintrc.json +0 -218
- package/.prettierrc.json +0 -13
- package/TECHNICAL_DOCUMENTATION.md +0 -1257
- package/jest.config.ts +0 -30
- package/src/errors/BaseError.ts +0 -20
- package/src/errors/DomainError.ts +0 -12
- package/src/errors/InvalidColorError.ts +0 -7
- package/src/errors/InvalidDayError.ts +0 -7
- package/src/errors/InvalidDayFormatError.ts +0 -7
- package/src/errors/InvalidEmailError.ts +0 -7
- package/src/errors/InvalidFormatError.ts +0 -7
- package/src/errors/InvalidHashError.ts +0 -7
- package/src/errors/InvalidHourError.ts +0 -7
- package/src/errors/InvalidIntegerError.ts +0 -7
- package/src/errors/InvalidLatitudeError.ts +0 -7
- package/src/errors/InvalidLengthError.ts +0 -9
- package/src/errors/InvalidLongitudeError.ts +0 -7
- package/src/errors/InvalidMinutesError.ts +0 -7
- package/src/errors/InvalidNumberError.ts +0 -7
- package/src/errors/InvalidPositiveNumberError.ts +0 -7
- package/src/errors/InvalidStringLengthError.ts +0 -9
- package/src/errors/InvalidTimestampIntervalError.ts +0 -10
- package/src/errors/InvalidValueError.ts +0 -7
- package/src/errors/NullObjectError.ts +0 -8
- package/src/errors/ValueNotInEnumError.ts +0 -9
- package/src/interfaces/PrimitiveOf.ts +0 -5
- package/src/interfaces/index.ts +0 -1
- package/src/patterns/Assert.ts +0 -15
- package/src/patterns/index.ts +0 -1
- package/src/value-objects/Color.ts +0 -39
- package/src/value-objects/Email.ts +0 -23
- package/src/value-objects/Enum.ts +0 -31
- package/src/value-objects/Integer.ts +0 -22
- package/src/value-objects/NullObject.ts +0 -60
- package/src/value-objects/NumberValueObject.ts +0 -56
- package/src/value-objects/PositiveNumber.ts +0 -20
- package/src/value-objects/StringValueObject.ts +0 -27
- package/src/value-objects/ValueObject.ts +0 -39
- package/src/value-objects/coordinates/Coordinates.ts +0 -30
- package/src/value-objects/coordinates/Latitude.ts +0 -22
- package/src/value-objects/coordinates/Longitude.ts +0 -25
- package/src/value-objects/hashes/Hash.ts +0 -19
- package/src/value-objects/hashes/MD5Hash.ts +0 -32
- package/src/value-objects/hashes/SHA256Hash.ts +0 -38
- package/src/value-objects/hashes/SHA512Hash.ts +0 -38
- package/src/value-objects/ids/ShortId.ts +0 -34
- package/src/value-objects/ids/UUID.ts +0 -34
- package/src/value-objects/time/CalendarDay.ts +0 -91
- package/src/value-objects/time/Day.ts +0 -17
- package/src/value-objects/time/DayOfWeek.ts +0 -60
- package/src/value-objects/time/Duration.ts +0 -142
- package/src/value-objects/time/Hour.ts +0 -105
- package/src/value-objects/time/Month.ts +0 -39
- package/src/value-objects/time/MonthOfYear.ts +0 -52
- package/src/value-objects/time/Timestamp.ts +0 -208
- package/src/value-objects/time/TimestampInterval.ts +0 -122
- package/src/value-objects/time/Year.ts +0 -27
- package/tests/errors/BaseError.spec.ts +0 -63
- package/tests/errors/DomainError.spec.ts +0 -52
- package/tests/patterns/Assert.spec.ts +0 -29
- package/tests/setup.jest.ts +0 -2
- package/tests/value-objects/Color.spec.ts +0 -214
- package/tests/value-objects/Email.spec.ts +0 -141
- package/tests/value-objects/Enum.spec.ts +0 -293
- package/tests/value-objects/Integer.spec.ts +0 -38
- package/tests/value-objects/NullObject.spec.ts +0 -55
- package/tests/value-objects/NumberValueObject.spec.ts +0 -446
- package/tests/value-objects/PositiveNumber.spec.ts +0 -274
- package/tests/value-objects/StringValueObject.spec.ts +0 -135
- package/tests/value-objects/coordinates/Coordinates.spec.ts +0 -90
- package/tests/value-objects/coordinates/Latitude.spec.ts +0 -24
- package/tests/value-objects/coordinates/Longitude.spec.ts +0 -24
- package/tests/value-objects/hashes/Hashes.spec.ts +0 -139
- package/tests/value-objects/hashes/MD5Hash.spec.ts +0 -187
- package/tests/value-objects/hashes/SHA256Hash.spec.ts +0 -220
- package/tests/value-objects/hashes/SHA512Hash.spec.ts +0 -220
- package/tests/value-objects/ids/ShortId.spec.ts +0 -34
- package/tests/value-objects/ids/UUID.spec.ts +0 -37
- package/tests/value-objects/time/CalendarDay.spec.ts +0 -182
- package/tests/value-objects/time/Day.spec.ts +0 -29
- package/tests/value-objects/time/DayOfWeek.spec.ts +0 -71
- package/tests/value-objects/time/Duration.spec.ts +0 -278
- package/tests/value-objects/time/Hour.spec.ts +0 -197
- package/tests/value-objects/time/MonthOfYear.spec.ts +0 -111
- package/tests/value-objects/time/Timestamp.spec.ts +0 -497
- package/tests/value-objects/time/TimestampInterval.spec.ts +0 -383
- package/tests/value-objects/time/Year.spec.ts +0 -48
- package/tsconfig.jest.json +0 -33
- package/tsconfig.json +0 -42
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
import { Hour, InvalidHourError, InvalidMinutesError } from '../../../src';
|
|
2
|
-
|
|
3
|
-
describe('Hour', () => {
|
|
4
|
-
describe('constructor', () => {
|
|
5
|
-
describe('when value is a string', () => {
|
|
6
|
-
it('should return a Hour instance', () => {
|
|
7
|
-
const hour = new Hour('23:59');
|
|
8
|
-
expect(hour).toBeInstanceOf(Hour);
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it('should throw error if hour is invalid', () => {
|
|
12
|
-
expect(() => new Hour('24:00')).toThrow('Invalid hour');
|
|
13
|
-
expect(() => new Hour('24:00')).toThrow(InvalidHourError);
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it('should throw error if minutes is invalid', () => {
|
|
17
|
-
expect(() => new Hour('23:60')).toThrow('Invalid minutes');
|
|
18
|
-
expect(() => new Hour('23:60')).toThrow(InvalidMinutesError);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('should work with 0 hour', () => {
|
|
22
|
-
expect(new Hour('00:00').toString()).toEqual('00:00');
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
describe('when receives 2 numbers', () => {
|
|
27
|
-
it('should return a Hour instance', () => {
|
|
28
|
-
const hour = new Hour(23, 59);
|
|
29
|
-
expect(hour).toBeInstanceOf(Hour);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('should throw error if hour is invalid', () => {
|
|
33
|
-
expect(() => new Hour(24, 0)).toThrow('Invalid hour');
|
|
34
|
-
expect(() => new Hour(24, 0)).toThrow(InvalidHourError);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('should throw error if minutes is invalid', () => {
|
|
38
|
-
expect(() => new Hour(23, 60)).toThrow('Invalid minutes');
|
|
39
|
-
expect(() => new Hour(23, 60)).toThrow(InvalidMinutesError);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('should work with 0 hour', () => {
|
|
43
|
-
const hour = new Hour(0, 0).toString();
|
|
44
|
-
expect(hour).toEqual('00:00');
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
describe('addMinutes', () => {
|
|
50
|
-
it('should add minutes to hour', () => {
|
|
51
|
-
expect(new Hour('23:59').addMinutes(1).toString()).toEqual('00:00');
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
describe('toString', () => {
|
|
56
|
-
it('should return string value', () => {
|
|
57
|
-
expect(new Hour('23:59').toString()).toEqual('23:59');
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
describe('isEqual', () => {
|
|
62
|
-
it('should return true if value is equal', () => {
|
|
63
|
-
expect(new Hour('23:59').isEqual(new Hour('23:59'))).toBeTrue();
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
it('should return false if value is not equal', () => {
|
|
67
|
-
expect(new Hour('23:59').isEqual(new Hour('00:00'))).toBeFalse();
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
describe('with some values', () => {
|
|
72
|
-
it('should not throw error', () => {
|
|
73
|
-
expect(() => new Hour('23:59')).not.toThrow();
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it('should add trail zero to hours', () => {
|
|
77
|
-
expect(new Hour('1:59').toString()).toEqual('01:59');
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it('should add trail zero to minutes', () => {
|
|
81
|
-
expect(new Hour('23:9').toString()).toEqual('23:09');
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it('should add minutes to hours', () => {
|
|
85
|
-
expect(new Hour('23:59').addMinutes(1).toString()).toEqual('00:00');
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it('should add hours to hours', () => {
|
|
89
|
-
expect(new Hour('23:59').addMinutes(60).toString()).toEqual('00:59');
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it('should subtract hours to hours', () => {
|
|
93
|
-
expect(new Hour('23:59').addMinutes(-60).toString()).toEqual('22:59');
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
it('should subtract minutes to hours', () => {
|
|
97
|
-
expect(new Hour('00:00').addMinutes(-1).toString()).toEqual('23:59');
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
it('should add more than 2 hours', () => {
|
|
101
|
-
expect(new Hour('23:59').addMinutes(120).toString()).toEqual('01:59');
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
describe('diffInMinutes', () => {
|
|
106
|
-
it('should return diff in minutes when jump the hour day', () => {
|
|
107
|
-
expect(new Hour('23:59').diffInMinutes(new Hour('00:00'))).toEqual(1);
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
it('should return diff in minutes in total', () => {
|
|
111
|
-
expect(new Hour('00:00').diffInMinutes(new Hour('23:59'))).toEqual(1439);
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
it('should return 60 minutes when diff is 1 hour', () => {
|
|
115
|
-
expect(new Hour('00:00').diffInMinutes(new Hour('01:00'))).toEqual(60);
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
it('should return 1380 minutes when diff is 23 hours', () => {
|
|
119
|
-
expect(new Hour('01:00').diffInMinutes(new Hour('00:00'))).toEqual(1380);
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
it('should return 1439 minutes when diff is -1 minute from start', () => {
|
|
123
|
-
expect(new Hour('01:05').diffInMinutes(new Hour('01:04'))).toEqual(1439);
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
describe('getMinutes', () => {
|
|
128
|
-
it('should return minutes', () => {
|
|
129
|
-
expect(new Hour('23:59').getMinutes()).toEqual(59);
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
describe('getHours', () => {
|
|
134
|
-
it('should return hours', () => {
|
|
135
|
-
expect(new Hour('23:59').getHours()).toEqual(23);
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
describe('isGreaterThan', () => {
|
|
140
|
-
it('should return true if the hour is greater', () => {
|
|
141
|
-
const hour1 = new Hour('12:30');
|
|
142
|
-
const hour2 = new Hour('10:45');
|
|
143
|
-
expect(hour1.isGreaterThan(hour2)).toBeTrue();
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
it('should return false if the hour is equal', () => {
|
|
147
|
-
const hour1 = new Hour('12:30');
|
|
148
|
-
const hour2 = new Hour('12:30');
|
|
149
|
-
expect(hour1.isGreaterThan(hour2)).toBeFalse();
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
it('should return false if the hour is less', () => {
|
|
153
|
-
const hour1 = new Hour('12:30');
|
|
154
|
-
const hour2 = new Hour('14:45');
|
|
155
|
-
expect(hour1.isGreaterThan(hour2)).toBeFalse();
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
it('should return true if the hour is greater with minutes', () => {
|
|
159
|
-
const hour1 = new Hour('12:30');
|
|
160
|
-
const hour2 = new Hour('12:15');
|
|
161
|
-
expect(hour1.isGreaterThan(hour2)).toBeTrue();
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
it('should return false if the hour is less with minutes', () => {
|
|
165
|
-
const hour1 = new Hour('12:30');
|
|
166
|
-
const hour2 = new Hour('12:45');
|
|
167
|
-
expect(hour1.isGreaterThan(hour2)).toBeFalse();
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
describe('isLessThan', () => {
|
|
171
|
-
it('should return true if the hour is less', () => {
|
|
172
|
-
const hour1 = new Hour('10:45');
|
|
173
|
-
const hour2 = new Hour('12:30');
|
|
174
|
-
expect(hour1.isLessThan(hour2)).toBeTrue();
|
|
175
|
-
});
|
|
176
|
-
it('should return false if the hour is equal', () => {
|
|
177
|
-
const hour1 = new Hour('12:30');
|
|
178
|
-
const hour2 = new Hour('12:30');
|
|
179
|
-
expect(hour1.isLessThan(hour2)).toBeFalse();
|
|
180
|
-
});
|
|
181
|
-
it('should return false if the hour is greater', () => {
|
|
182
|
-
const hour1 = new Hour('14:45');
|
|
183
|
-
const hour2 = new Hour('12:30');
|
|
184
|
-
expect(hour1.isLessThan(hour2)).toBeFalse();
|
|
185
|
-
});
|
|
186
|
-
it('should return true if the hour is less with minutes', () => {
|
|
187
|
-
const hour1 = new Hour('12:15');
|
|
188
|
-
const hour2 = new Hour('12:30');
|
|
189
|
-
expect(hour1.isLessThan(hour2)).toBeTrue();
|
|
190
|
-
});
|
|
191
|
-
it('should return false if the hour is greater with minutes', () => {
|
|
192
|
-
const hour1 = new Hour('12:45');
|
|
193
|
-
const hour2 = new Hour('12:30');
|
|
194
|
-
expect(hour1.isLessThan(hour2)).toBeFalse();
|
|
195
|
-
});
|
|
196
|
-
});
|
|
197
|
-
});
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
MonthOfYear,
|
|
3
|
-
Month,
|
|
4
|
-
Year,
|
|
5
|
-
ValueNotInEnumError,
|
|
6
|
-
InvalidIntegerError,
|
|
7
|
-
} from '../../../src';
|
|
8
|
-
|
|
9
|
-
describe('MonthOfYear', () => {
|
|
10
|
-
describe('constructor', () => {
|
|
11
|
-
it('should create a Month instance', () => {
|
|
12
|
-
const month = new MonthOfYear(1, 2022);
|
|
13
|
-
expect(month).toMatchObject({
|
|
14
|
-
month: Month.JANUARY,
|
|
15
|
-
year: new Year(2022),
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
it('should throw error if the Month is negative', () => {
|
|
19
|
-
expect(() => new MonthOfYear(-1, 2022)).toThrow(ValueNotInEnumError);
|
|
20
|
-
});
|
|
21
|
-
it('should throw error if the Month is not integer', () => {
|
|
22
|
-
expect(() => new MonthOfYear(1.1, 2022)).toThrow(ValueNotInEnumError);
|
|
23
|
-
});
|
|
24
|
-
it('should throw error if the Month is greater than 12', () => {
|
|
25
|
-
expect(() => new MonthOfYear(13, 2022)).toThrow(ValueNotInEnumError);
|
|
26
|
-
});
|
|
27
|
-
it('should throw error if the Year is not integer', () => {
|
|
28
|
-
expect(() => new MonthOfYear(1, 2022.1)).toThrow(InvalidIntegerError);
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
describe('getYear', () => {
|
|
33
|
-
it('should return the year', () => {
|
|
34
|
-
const month = new MonthOfYear(1, 2022);
|
|
35
|
-
expect(month.getYear()).toStrictEqual(new Year(2022));
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
describe('getDays', () => {
|
|
40
|
-
it('should return the number of days in the month', () => {
|
|
41
|
-
const month = new MonthOfYear(1, 2022);
|
|
42
|
-
expect(month.getNumberOfDays()).toBe(31);
|
|
43
|
-
});
|
|
44
|
-
it('should return the correct number of days for February', () => {
|
|
45
|
-
const month = new MonthOfYear(2, 2022);
|
|
46
|
-
expect(month.getNumberOfDays()).toBe(28);
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
describe('getTimestampInterval', () => {
|
|
51
|
-
it('should return the timestamp interval for the month', () => {
|
|
52
|
-
const month = new MonthOfYear(1, 2022);
|
|
53
|
-
const interval = month.getTimestampInterval();
|
|
54
|
-
expect(interval.getStart().valueOf()).toBe(1640995200000);
|
|
55
|
-
expect(interval.getEnd().valueOf()).toBe(1643587200000);
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
describe('getMonth', () => {
|
|
59
|
-
it('should return a Month instance with the correct month value', () => {
|
|
60
|
-
const monthOfYear = new MonthOfYear(5, 2022);
|
|
61
|
-
const month = monthOfYear.getMonth();
|
|
62
|
-
expect(month).toStrictEqual(Month.MAY);
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
describe('fromTimestamp', () => {
|
|
66
|
-
it('should create a MonthOfYear instance from a valid Timestamp', () => {
|
|
67
|
-
const timestamp = { getMonth: () => 5, getYear: () => 2022 } as any;
|
|
68
|
-
const monthOfYear = MonthOfYear.fromTimestamp(timestamp);
|
|
69
|
-
expect(monthOfYear.getMonth().valueOf()).toBe(5);
|
|
70
|
-
expect(monthOfYear.getYear()).toStrictEqual(new Year(2022));
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
it('should throw an error if the Timestamp has an invalid month', () => {
|
|
74
|
-
const timestamp = { getMonth: () => 13, getYear: () => 2022 } as any;
|
|
75
|
-
expect(() => MonthOfYear.fromTimestamp(timestamp)).toThrow(
|
|
76
|
-
ValueNotInEnumError,
|
|
77
|
-
);
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
describe('fromString', () => {
|
|
81
|
-
it('should create a MonthOfYear instance from a valid string', () => {
|
|
82
|
-
const monthOfYear = MonthOfYear.fromString('2022/05');
|
|
83
|
-
expect(monthOfYear.getMonth().valueOf()).toBe(5);
|
|
84
|
-
expect(monthOfYear.getYear()).toStrictEqual(new Year(2022));
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it('should pad single digit months correctly', () => {
|
|
88
|
-
const monthOfYear = MonthOfYear.fromString('2022/1');
|
|
89
|
-
expect(monthOfYear.getMonth().valueOf()).toBe(1);
|
|
90
|
-
expect(monthOfYear.getYear()).toStrictEqual(new Year(2022));
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it('should throw error for invalid month', () => {
|
|
94
|
-
expect(() => MonthOfYear.fromString('2022/13')).toThrow(
|
|
95
|
-
ValueNotInEnumError,
|
|
96
|
-
);
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('should throw error for invalid year', () => {
|
|
100
|
-
expect(() => MonthOfYear.fromString('2022.1/05')).toThrow(
|
|
101
|
-
InvalidIntegerError,
|
|
102
|
-
);
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
it('should throw error for malformed string', () => {
|
|
106
|
-
expect(() => MonthOfYear.fromString('2022')).toThrow();
|
|
107
|
-
expect(() => MonthOfYear.fromString('')).toThrow();
|
|
108
|
-
expect(() => MonthOfYear.fromString('2022/')).toThrow();
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
});
|