@haskou/value-objects 1.1.0 → 1.1.2
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/dist/src/value-objects/ids/index.d.ts +3 -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} +2 -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 +6 -2
- 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,383 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TimestampInterval,
|
|
3
|
-
Timestamp,
|
|
4
|
-
PrimitiveOf,
|
|
5
|
-
InvalidTimestampIntervalError,
|
|
6
|
-
Duration,
|
|
7
|
-
DayOfWeek,
|
|
8
|
-
} from '../../../src';
|
|
9
|
-
|
|
10
|
-
describe('TimestampInterval', () => {
|
|
11
|
-
let timestampInterval: TimestampInterval;
|
|
12
|
-
let startTimestamp: Timestamp;
|
|
13
|
-
let endTimestamp: Timestamp;
|
|
14
|
-
let primitives: PrimitiveOf<TimestampInterval>;
|
|
15
|
-
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
startTimestamp = new Timestamp(1721606400000);
|
|
18
|
-
endTimestamp = new Timestamp(1722124800000);
|
|
19
|
-
timestampInterval = new TimestampInterval(startTimestamp, endTimestamp);
|
|
20
|
-
primitives = {
|
|
21
|
-
start: startTimestamp.valueOf(),
|
|
22
|
-
end: endTimestamp.valueOf(),
|
|
23
|
-
};
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
describe('constructor', () => {
|
|
27
|
-
it('should create a TimestampInterval instance', () => {
|
|
28
|
-
expect(timestampInterval).toMatchObject({
|
|
29
|
-
start: startTimestamp,
|
|
30
|
-
end: endTimestamp,
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('should throw error if the start is after the end', () => {
|
|
35
|
-
expect(() => new TimestampInterval(endTimestamp, startTimestamp)).toThrow(
|
|
36
|
-
InvalidTimestampIntervalError,
|
|
37
|
-
);
|
|
38
|
-
});
|
|
39
|
-
it('should not throw error if the start and end are equal', () => {
|
|
40
|
-
expect(
|
|
41
|
-
() => new TimestampInterval(startTimestamp, startTimestamp),
|
|
42
|
-
).not.toThrow(InvalidTimestampIntervalError);
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
describe('fromPrimitives', () => {
|
|
47
|
-
it('should create a TimestampInterval instance from primitives', () => {
|
|
48
|
-
const newTimestampInterval = TimestampInterval.fromPrimitives(primitives);
|
|
49
|
-
expect(newTimestampInterval).toEqual(timestampInterval);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
describe('toPrimitives', () => {
|
|
54
|
-
it('should return the correct primitives', () => {
|
|
55
|
-
expect(timestampInterval.toPrimitives()).toEqual(primitives);
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
describe('getStart', () => {
|
|
60
|
-
it('should return the correct start timestamp', () => {
|
|
61
|
-
expect(timestampInterval.getStart()).toEqual(startTimestamp);
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
describe('getEnd', () => {
|
|
65
|
-
it('should return the correct end timestamp', () => {
|
|
66
|
-
expect(timestampInterval.getEnd()).toEqual(endTimestamp);
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
describe('getDuration', () => {
|
|
71
|
-
it('should return the correct duration', () => {
|
|
72
|
-
expect(timestampInterval.getDuration()).toEqual(
|
|
73
|
-
Duration.fromMilliseconds(518400000),
|
|
74
|
-
);
|
|
75
|
-
});
|
|
76
|
-
describe('getDuration', () => {
|
|
77
|
-
it('should return duration 0 when the start and end are equal', () => {
|
|
78
|
-
const timestampInterval = new TimestampInterval(
|
|
79
|
-
startTimestamp,
|
|
80
|
-
startTimestamp,
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
expect(timestampInterval.getDuration()).toEqual(
|
|
84
|
-
Duration.fromMilliseconds(0),
|
|
85
|
-
);
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
describe('getNumberOfDayOfWeeks', () => {
|
|
91
|
-
it('should return the number of day of weeks if the dayOfWeek is the same day as the starting day', () => {
|
|
92
|
-
const dayOfWeek = DayOfWeek.MONDAY;
|
|
93
|
-
const expectedCount = 1;
|
|
94
|
-
expect(timestampInterval.getTotalDaysOfWeek(dayOfWeek)).toEqual(
|
|
95
|
-
expectedCount,
|
|
96
|
-
);
|
|
97
|
-
});
|
|
98
|
-
it('should return the number of day of weeks if the dayOfWeek is different than the starting day', () => {
|
|
99
|
-
const dayOfWeek = DayOfWeek.SATURDAY;
|
|
100
|
-
const expectedCount = 1;
|
|
101
|
-
expect(timestampInterval.getTotalDaysOfWeek(dayOfWeek)).toEqual(
|
|
102
|
-
expectedCount,
|
|
103
|
-
);
|
|
104
|
-
});
|
|
105
|
-
it('should return the number of day of weeks if there are multiple day of weeks', () => {
|
|
106
|
-
const dayOfWeek = DayOfWeek.TUESDAY;
|
|
107
|
-
const expectedCount = 2;
|
|
108
|
-
timestampInterval = new TimestampInterval(
|
|
109
|
-
startTimestamp,
|
|
110
|
-
new Timestamp(1722384000000),
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
expect(timestampInterval.getTotalDaysOfWeek(dayOfWeek)).toEqual(
|
|
114
|
-
expectedCount,
|
|
115
|
-
);
|
|
116
|
-
});
|
|
117
|
-
it('should return the only one day in one day interval', () => {
|
|
118
|
-
const dayOfWeek = DayOfWeek.WEDNESDAY;
|
|
119
|
-
const expectedCount = 1;
|
|
120
|
-
timestampInterval = new TimestampInterval(
|
|
121
|
-
new Timestamp('2024-07-24T00:00:00.000z'),
|
|
122
|
-
new Timestamp('2024-07-24T23:59:00.000z'),
|
|
123
|
-
);
|
|
124
|
-
|
|
125
|
-
expect(timestampInterval.getTotalDaysOfWeek(dayOfWeek)).toEqual(
|
|
126
|
-
expectedCount,
|
|
127
|
-
);
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
it('should not return the next day in one day interval', () => {
|
|
131
|
-
const dayOfWeek = DayOfWeek.THURSDAY;
|
|
132
|
-
const expectedCount = 0;
|
|
133
|
-
timestampInterval = new TimestampInterval(
|
|
134
|
-
new Timestamp('2024-07-24T00:00:00.000z'),
|
|
135
|
-
new Timestamp('2024-07-24T23:59:00.000z'),
|
|
136
|
-
);
|
|
137
|
-
|
|
138
|
-
expect(timestampInterval.getTotalDaysOfWeek(dayOfWeek)).toEqual(
|
|
139
|
-
expectedCount,
|
|
140
|
-
);
|
|
141
|
-
});
|
|
142
|
-
it('should not return the previous day in one day interval', () => {
|
|
143
|
-
const dayOfWeek = DayOfWeek.TUESDAY;
|
|
144
|
-
const expectedCount = 0;
|
|
145
|
-
timestampInterval = new TimestampInterval(
|
|
146
|
-
new Timestamp('2024-07-24T00:00:00.000z'),
|
|
147
|
-
new Timestamp('2024-07-24T23:59:00.000z'),
|
|
148
|
-
);
|
|
149
|
-
|
|
150
|
-
expect(timestampInterval.getTotalDaysOfWeek(dayOfWeek)).toEqual(
|
|
151
|
-
expectedCount,
|
|
152
|
-
);
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
describe('modifyStart', () => {
|
|
156
|
-
it('should modify the start timestamp', () => {
|
|
157
|
-
const newStartTimestamp = new Timestamp(1721606400000);
|
|
158
|
-
timestampInterval.modifyStart(newStartTimestamp);
|
|
159
|
-
expect(timestampInterval).toMatchObject({
|
|
160
|
-
start: newStartTimestamp,
|
|
161
|
-
end: endTimestamp,
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
it('should throw error if the start is after the end', () => {
|
|
166
|
-
const newStartTimestamp = new Timestamp(1722124800000);
|
|
167
|
-
expect(() => timestampInterval.modifyStart(newStartTimestamp)).toThrow(
|
|
168
|
-
InvalidTimestampIntervalError,
|
|
169
|
-
);
|
|
170
|
-
});
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
describe('modifyEnd', () => {
|
|
174
|
-
it('should modify the end timestamp', () => {
|
|
175
|
-
const newEndTimestamp = new Timestamp(1722124800000);
|
|
176
|
-
timestampInterval.modifyEnd(newEndTimestamp);
|
|
177
|
-
expect(timestampInterval).toMatchObject({
|
|
178
|
-
start: startTimestamp,
|
|
179
|
-
end: newEndTimestamp,
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
it('should throw error if the start is after the end', () => {
|
|
184
|
-
const newEndTimestamp = new Timestamp(1721606400000);
|
|
185
|
-
expect(() => timestampInterval.modifyEnd(newEndTimestamp)).toThrow(
|
|
186
|
-
InvalidTimestampIntervalError,
|
|
187
|
-
);
|
|
188
|
-
});
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
describe('getDaysBetweenInterval', () => {
|
|
192
|
-
it('should return an array of dates in ISO format for the given interval', () => {
|
|
193
|
-
const start = new Timestamp('2024-11-18T00:00:00.000Z');
|
|
194
|
-
const end = new Timestamp('2024-11-22T00:00:00.000Z');
|
|
195
|
-
timestampInterval = new TimestampInterval(start, end);
|
|
196
|
-
const days = timestampInterval.getDaysBetweenInterval();
|
|
197
|
-
expect(days).toMatchObject([
|
|
198
|
-
{
|
|
199
|
-
year: 2024,
|
|
200
|
-
month: 11,
|
|
201
|
-
day: 18,
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
year: 2024,
|
|
205
|
-
month: 11,
|
|
206
|
-
day: 19,
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
year: 2024,
|
|
210
|
-
month: 11,
|
|
211
|
-
day: 20,
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
year: 2024,
|
|
215
|
-
month: 11,
|
|
216
|
-
day: 21,
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
year: 2024,
|
|
220
|
-
month: 11,
|
|
221
|
-
day: 22,
|
|
222
|
-
},
|
|
223
|
-
]);
|
|
224
|
-
});
|
|
225
|
-
it('should return a single day if the start and end are the same', () => {
|
|
226
|
-
const start = new Timestamp('2024-11-19T00:00:00.000Z');
|
|
227
|
-
const end = new Timestamp('2024-11-19T00:00:00.000Z');
|
|
228
|
-
timestampInterval = new TimestampInterval(start, end);
|
|
229
|
-
const days = timestampInterval.getDaysBetweenInterval();
|
|
230
|
-
expect(days).toMatchObject([
|
|
231
|
-
{
|
|
232
|
-
year: 2024,
|
|
233
|
-
month: 11,
|
|
234
|
-
day: 19,
|
|
235
|
-
},
|
|
236
|
-
]);
|
|
237
|
-
});
|
|
238
|
-
it('should not modify the original values', () => {
|
|
239
|
-
const primitiveStart = '2024-11-18T00:00:00.000Z';
|
|
240
|
-
const primitiveEnd = '2024-11-22T00:00:00.000Z';
|
|
241
|
-
const start = new Timestamp(primitiveStart);
|
|
242
|
-
const end = new Timestamp(primitiveEnd);
|
|
243
|
-
timestampInterval = new TimestampInterval(start, end);
|
|
244
|
-
const days = timestampInterval.getDaysBetweenInterval();
|
|
245
|
-
expect(days).toMatchObject([
|
|
246
|
-
{
|
|
247
|
-
year: 2024,
|
|
248
|
-
month: 11,
|
|
249
|
-
day: 18,
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
year: 2024,
|
|
253
|
-
month: 11,
|
|
254
|
-
day: 19,
|
|
255
|
-
},
|
|
256
|
-
{
|
|
257
|
-
year: 2024,
|
|
258
|
-
month: 11,
|
|
259
|
-
day: 20,
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
year: 2024,
|
|
263
|
-
month: 11,
|
|
264
|
-
day: 21,
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
year: 2024,
|
|
268
|
-
month: 11,
|
|
269
|
-
day: 22,
|
|
270
|
-
},
|
|
271
|
-
]);
|
|
272
|
-
expect(timestampInterval).toMatchObject({
|
|
273
|
-
start: new Timestamp(primitiveStart),
|
|
274
|
-
end: new Timestamp(primitiveEnd),
|
|
275
|
-
});
|
|
276
|
-
});
|
|
277
|
-
});
|
|
278
|
-
|
|
279
|
-
describe('getOverlappingInterval', () => {
|
|
280
|
-
it('should return the overlapping interval when there is overlap', () => {
|
|
281
|
-
const interval = new TimestampInterval(
|
|
282
|
-
new Timestamp(1721779200000),
|
|
283
|
-
new Timestamp(1722307200000),
|
|
284
|
-
);
|
|
285
|
-
|
|
286
|
-
const result = timestampInterval.getOverlappingInterval(interval);
|
|
287
|
-
|
|
288
|
-
expect(result).toEqual(
|
|
289
|
-
new TimestampInterval(
|
|
290
|
-
new Timestamp(1721779200000),
|
|
291
|
-
new Timestamp(1722124800000),
|
|
292
|
-
),
|
|
293
|
-
);
|
|
294
|
-
});
|
|
295
|
-
|
|
296
|
-
it('should return the same overlapping interval when there is overlap if the variables are reversed', () => {
|
|
297
|
-
const interval = new TimestampInterval(
|
|
298
|
-
new Timestamp(1721779200000),
|
|
299
|
-
new Timestamp(1722307200000),
|
|
300
|
-
);
|
|
301
|
-
|
|
302
|
-
const result = interval.getOverlappingInterval(timestampInterval);
|
|
303
|
-
|
|
304
|
-
expect(result).toEqual(
|
|
305
|
-
new TimestampInterval(
|
|
306
|
-
new Timestamp(1721779200000),
|
|
307
|
-
new Timestamp(1722124800000),
|
|
308
|
-
),
|
|
309
|
-
);
|
|
310
|
-
});
|
|
311
|
-
|
|
312
|
-
it('should return null when there is no overlap', () => {
|
|
313
|
-
const interval = new TimestampInterval(
|
|
314
|
-
new Timestamp(1722307200000),
|
|
315
|
-
new Timestamp(1722912000000),
|
|
316
|
-
);
|
|
317
|
-
|
|
318
|
-
const result = timestampInterval.getOverlappingInterval(interval);
|
|
319
|
-
|
|
320
|
-
expect(result).toBeNull();
|
|
321
|
-
});
|
|
322
|
-
|
|
323
|
-
it('should return the full interval when one interval is fully contained within another', () => {
|
|
324
|
-
const interval = new TimestampInterval(
|
|
325
|
-
new Timestamp(1721692800000),
|
|
326
|
-
new Timestamp(1722048000000),
|
|
327
|
-
);
|
|
328
|
-
|
|
329
|
-
const result = timestampInterval.getOverlappingInterval(interval);
|
|
330
|
-
|
|
331
|
-
expect(result).toEqual(interval);
|
|
332
|
-
});
|
|
333
|
-
|
|
334
|
-
it('should handle identical intervals correctly', () => {
|
|
335
|
-
const interval = new TimestampInterval(
|
|
336
|
-
new Timestamp(1721606400000),
|
|
337
|
-
new Timestamp(1722124800000),
|
|
338
|
-
);
|
|
339
|
-
|
|
340
|
-
const result = timestampInterval.getOverlappingInterval(interval);
|
|
341
|
-
|
|
342
|
-
expect(result).toEqual(timestampInterval);
|
|
343
|
-
});
|
|
344
|
-
|
|
345
|
-
it('should handle intervals that touch but do not overlap', () => {
|
|
346
|
-
const interval = new TimestampInterval(
|
|
347
|
-
new Timestamp(1722124800000),
|
|
348
|
-
new Timestamp(1722307200000),
|
|
349
|
-
);
|
|
350
|
-
|
|
351
|
-
const result = timestampInterval.getOverlappingInterval(interval);
|
|
352
|
-
|
|
353
|
-
expect(result).toBeNull();
|
|
354
|
-
});
|
|
355
|
-
});
|
|
356
|
-
|
|
357
|
-
describe('includes', () => {
|
|
358
|
-
it('should return true if the timestamp is within the interval', () => {
|
|
359
|
-
const timestamp = new Timestamp(1721692800000);
|
|
360
|
-
expect(timestampInterval.includes(timestamp)).toBeTruthy();
|
|
361
|
-
});
|
|
362
|
-
|
|
363
|
-
it('should return false if the timestamp is before the interval', () => {
|
|
364
|
-
const timestamp = new Timestamp(1721606399999);
|
|
365
|
-
expect(timestampInterval.includes(timestamp)).toBeFalsy();
|
|
366
|
-
});
|
|
367
|
-
|
|
368
|
-
it('should return false if the timestamp is after the interval', () => {
|
|
369
|
-
const timestamp = new Timestamp(1722124800001);
|
|
370
|
-
expect(timestampInterval.includes(timestamp)).toBeFalsy();
|
|
371
|
-
});
|
|
372
|
-
|
|
373
|
-
it('should return true if the timestamp is the same as the start of the interval', () => {
|
|
374
|
-
const timestamp = new Timestamp(1721606400000);
|
|
375
|
-
expect(timestampInterval.includes(timestamp)).toBeTruthy();
|
|
376
|
-
});
|
|
377
|
-
|
|
378
|
-
it('should return true if the timestamp is the same as the end of the interval', () => {
|
|
379
|
-
const timestamp = new Timestamp(1722124800000);
|
|
380
|
-
expect(timestampInterval.includes(timestamp)).toBeTruthy();
|
|
381
|
-
});
|
|
382
|
-
});
|
|
383
|
-
});
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { NullObject, Year } from '../../../src';
|
|
2
|
-
|
|
3
|
-
describe('Year', () => {
|
|
4
|
-
describe('constructor', () => {
|
|
5
|
-
it('should return a NullValueObject when a Nullish is received', () => {
|
|
6
|
-
expect(() => new Year(undefined as unknown as number)).not.toThrow();
|
|
7
|
-
expect(
|
|
8
|
-
NullObject.isNullObject(new Year(undefined as unknown as number)),
|
|
9
|
-
).toBeTrue();
|
|
10
|
-
expect(
|
|
11
|
-
NullObject.isNullObject(new Year(null as unknown as number)),
|
|
12
|
-
).toBeTrue();
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
describe('isLeapYear', () => {
|
|
16
|
-
it('should return true for a leap year divisible by 4 but not by 100', () => {
|
|
17
|
-
const year = new Year(2024);
|
|
18
|
-
expect(year.isLeapYear()).toBe(true);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('should return false for a non-leap year not divisible by 4', () => {
|
|
22
|
-
const year = new Year(2023);
|
|
23
|
-
expect(year.isLeapYear()).toBe(false);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('should return false for a year divisible by 100 but not by 400', () => {
|
|
27
|
-
const year = new Year(1900);
|
|
28
|
-
expect(year.isLeapYear()).toBe(false);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('should return true for a year divisible by 400', () => {
|
|
32
|
-
const year = new Year(2000);
|
|
33
|
-
expect(year.isLeapYear()).toBe(true);
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
describe('getNumberOfDays', () => {
|
|
38
|
-
it('should return 366 for a leap year', () => {
|
|
39
|
-
const year = new Year(2024);
|
|
40
|
-
expect(year.getNumberOfDays()).toBe(366);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('should return 365 for a non-leap year', () => {
|
|
44
|
-
const year = new Year(2023);
|
|
45
|
-
expect(year.getNumberOfDays()).toBe(365);
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
});
|
package/tsconfig.jest.json
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"typeAcquisition": {
|
|
4
|
-
"include": [
|
|
5
|
-
"jest",
|
|
6
|
-
"jest-extended"
|
|
7
|
-
]
|
|
8
|
-
},
|
|
9
|
-
"compilerOptions": {
|
|
10
|
-
"sourceMap": true,
|
|
11
|
-
"esModuleInterop": true,
|
|
12
|
-
"types": [
|
|
13
|
-
"node",
|
|
14
|
-
"jest",
|
|
15
|
-
"jest-extended"
|
|
16
|
-
],
|
|
17
|
-
"baseUrl": "./",
|
|
18
|
-
},
|
|
19
|
-
"include": [
|
|
20
|
-
"src/**/*",
|
|
21
|
-
"tests/**/*",
|
|
22
|
-
"config/**/*",
|
|
23
|
-
"jest.config.ts"
|
|
24
|
-
],
|
|
25
|
-
"files": [
|
|
26
|
-
"global.d.ts"
|
|
27
|
-
],
|
|
28
|
-
"jest": {
|
|
29
|
-
"setupFilesAfterEnv": [
|
|
30
|
-
"jest-extended/all"
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"module": "commonjs",
|
|
4
|
-
"target": "ESNext",
|
|
5
|
-
"strict": true,
|
|
6
|
-
"allowJs": false,
|
|
7
|
-
"esModuleInterop": true,
|
|
8
|
-
"resolveJsonModule": true,
|
|
9
|
-
"noImplicitAny": true,
|
|
10
|
-
"moduleResolution": "node",
|
|
11
|
-
"importHelpers": true,
|
|
12
|
-
"allowSyntheticDefaultImports": true,
|
|
13
|
-
"emitDecoratorMetadata": true,
|
|
14
|
-
"experimentalDecorators": true,
|
|
15
|
-
"strictNullChecks": true,
|
|
16
|
-
"preserveConstEnums": true,
|
|
17
|
-
"lib": [
|
|
18
|
-
"ESNext",
|
|
19
|
-
],
|
|
20
|
-
"types": [
|
|
21
|
-
"node",
|
|
22
|
-
"jest",
|
|
23
|
-
],
|
|
24
|
-
"typeRoots": [
|
|
25
|
-
"node_modules/@types",
|
|
26
|
-
],
|
|
27
|
-
"outDir": "dist",
|
|
28
|
-
"rootDir": "./",
|
|
29
|
-
"sourceMap": true,
|
|
30
|
-
"declaration": true,
|
|
31
|
-
"declarationMap": true,
|
|
32
|
-
},
|
|
33
|
-
"include": [
|
|
34
|
-
"src/**/*",
|
|
35
|
-
"tests/**/*",
|
|
36
|
-
"config/**/*",
|
|
37
|
-
],
|
|
38
|
-
"exclude": [
|
|
39
|
-
"node_modules",
|
|
40
|
-
"dist"
|
|
41
|
-
],
|
|
42
|
-
}
|