@bgord/tools 1.3.24 → 1.4.0
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/age-years.vo.d.ts +11 -0
- package/dist/src/age-years.vo.js +6 -0
- package/dist/{age.vo.js → src/age.vo.js} +2 -1
- package/dist/src/api-key.vo.d.ts +7 -0
- package/dist/src/api-key.vo.js +7 -0
- package/dist/src/basename.vo.d.ts +12 -0
- package/dist/src/basename.vo.js +22 -0
- package/dist/src/day-iso-id.vo.d.ts +9 -0
- package/dist/{day-iso-id.vo.js → src/day-iso-id.vo.js} +4 -8
- package/dist/{day.vo.js → src/day.vo.js} +7 -6
- package/dist/src/directory-path-absolute.vo.d.ts +12 -0
- package/dist/{directory-path-absolute.vo.js → src/directory-path-absolute.vo.js} +5 -12
- package/dist/src/directory-path-relative.vo.d.ts +12 -0
- package/dist/{directory-path-relative.vo.js → src/directory-path-relative.vo.js} +5 -12
- package/dist/src/distance-value.vo.d.ts +7 -0
- package/dist/src/distance-value.vo.js +5 -0
- package/dist/{distance.vo.js → src/distance.vo.js} +7 -6
- package/dist/src/division-factor.vo.d.ts +7 -0
- package/dist/src/division-factor.vo.js +5 -0
- package/dist/src/duration-ms.vo.d.ts +6 -0
- package/dist/src/duration-ms.vo.js +5 -0
- package/dist/{duration.service.js → src/duration.service.js} +2 -1
- package/dist/src/email.vo.d.ts +6 -0
- package/dist/src/email.vo.js +4 -0
- package/dist/{etags.vo.js → src/etags.vo.js} +3 -2
- package/dist/src/extension.vo.d.ts +9 -0
- package/dist/src/extension.vo.js +15 -0
- package/dist/src/feature-flag-value.vo.d.ts +10 -0
- package/dist/{feature-flag-value.vo.js → src/feature-flag-value.vo.js} +2 -2
- package/dist/src/file-path-absolute-schema.vo.d.ts +17 -0
- package/dist/{file-path-absolute-schema.vo.js → src/file-path-absolute-schema.vo.js} +6 -13
- package/dist/src/file-path-relative-schema.vo.d.ts +17 -0
- package/dist/{file-path-relative-schema.vo.js → src/file-path-relative-schema.vo.js} +6 -13
- package/dist/{file-path.vo.js → src/file-path.vo.js} +5 -4
- package/dist/src/filename-affix.vo.d.ts +13 -0
- package/dist/{filename-affix.vo.js → src/filename-affix.vo.js} +4 -9
- package/dist/src/filename-from-string.vo.d.ts +10 -0
- package/dist/{filename-from-string.vo.js → src/filename-from-string.vo.js} +5 -8
- package/dist/{filename.vo.js → src/filename.vo.js} +8 -7
- package/dist/src/height-milimiters.vo.d.ts +7 -0
- package/dist/src/height-milimiters.vo.js +8 -0
- package/dist/{height.vo.js → src/height.vo.js} +4 -3
- package/dist/src/hour-value.vo.d.ts +7 -0
- package/dist/src/hour-value.vo.js +5 -0
- package/dist/{hour.vo.js → src/hour.vo.js} +3 -2
- package/dist/src/iban-schema.vo.d.ts +7 -0
- package/dist/src/iban-schema.vo.js +7 -0
- package/dist/{iban.vo.js → src/iban.vo.js} +2 -1
- package/dist/src/image.vo.d.ts +13 -0
- package/dist/src/image.vo.js +10 -0
- package/dist/src/integer-non-negative.vo.d.ts +7 -0
- package/dist/src/integer-non-negative.vo.js +8 -0
- package/dist/src/integer-positive.vo.d.ts +7 -0
- package/dist/src/integer-positive.vo.js +5 -0
- package/dist/src/integer.vo.d.ts +6 -0
- package/dist/src/integer.vo.js +4 -0
- package/dist/src/language.vo.d.ts +7 -0
- package/dist/{language.vo.js → src/language.vo.js} +2 -2
- package/dist/src/mime-value.vo.d.ts +7 -0
- package/dist/{mime-value.vo.js → src/mime-value.vo.js} +4 -7
- package/dist/{mime.vo.js → src/mime.vo.js} +2 -1
- package/dist/src/mimes.js +19 -0
- package/dist/src/minute-value.vo.d.ts +7 -0
- package/dist/src/minute-value.vo.js +5 -0
- package/dist/{minute.vo.js → src/minute.vo.js} +3 -2
- package/dist/src/money-amount.vo.d.ts +7 -0
- package/dist/src/money-amount.vo.js +5 -0
- package/dist/{money.vo.js → src/money.vo.js} +7 -6
- package/dist/src/month-iso-id.vo.d.ts +8 -0
- package/dist/{month-iso-id.vo.js → src/month-iso-id.vo.js} +5 -9
- package/dist/{month.vo.js → src/month.vo.js} +5 -4
- package/dist/src/multiplication-factor.vo.d.ts +7 -0
- package/dist/src/multiplication-factor.vo.js +8 -0
- package/dist/src/object-key.vo.d.ts +11 -0
- package/dist/src/object-key.vo.js +19 -0
- package/dist/src/package-version-schema.vo.d.ts +8 -0
- package/dist/{package-version-schema.vo.js → src/package-version-schema.vo.js} +4 -7
- package/dist/{package-version.vo.js → src/package-version.vo.js} +3 -4
- package/dist/src/pagination-page.vo.d.ts +6 -0
- package/dist/src/pagination-page.vo.js +3 -0
- package/dist/src/pagination-skip.vo.d.ts +7 -0
- package/dist/src/pagination-skip.vo.js +3 -0
- package/dist/src/pagination-take.vo.d.ts +7 -0
- package/dist/src/pagination-take.vo.js +3 -0
- package/dist/{pagination.service.js → src/pagination.service.js} +8 -7
- package/dist/src/quarter-iso-id.vo.d.ts +8 -0
- package/dist/src/quarter-iso-id.vo.js +7 -0
- package/dist/{quarter.vo.js → src/quarter.vo.js} +3 -2
- package/dist/src/reordering-item-position-value.vo.d.ts +6 -0
- package/dist/src/reordering-item-position-value.vo.js +3 -0
- package/dist/{reordering.service.d.ts → src/reordering.service.d.ts} +9 -9
- package/dist/{reordering.service.js → src/reordering.service.js} +7 -7
- package/dist/src/revision-value.vo.d.ts +7 -0
- package/dist/src/revision-value.vo.js +3 -0
- package/dist/{revision.vo.js → src/revision.vo.js} +3 -2
- package/dist/{rounding-decimal.strategy.d.ts → src/rounding-decimal.strategy.d.ts} +2 -2
- package/dist/src/rounding-decimal.strategy.js +14 -0
- package/dist/src/size-bytes.vo.d.ts +6 -0
- package/dist/src/size-bytes.vo.js +5 -0
- package/dist/{size.vo.js → src/size.vo.js} +5 -4
- package/dist/src/time-zone-offset-value.vo.d.ts +8 -0
- package/dist/src/time-zone-offset-value.vo.js +13 -0
- package/dist/src/timestamp-value.vo.d.ts +6 -0
- package/dist/src/timestamp-value.vo.js +5 -0
- package/dist/{timestamp.vo.js → src/timestamp.vo.js} +2 -1
- package/dist/src/timezone.vo.d.ts +9 -0
- package/dist/{timezone.vo.js → src/timezone.vo.js} +7 -10
- package/dist/src/url-with-slash.vo.d.ts +6 -0
- package/dist/src/url-with-slash.vo.js +5 -0
- package/dist/src/url-without-slash.vo.d.ts +6 -0
- package/dist/src/url-without-slash.vo.js +5 -0
- package/dist/src/week-iso-id.vo.d.ts +8 -0
- package/dist/{week-iso-id.vo.js → src/week-iso-id.vo.js} +5 -9
- package/dist/{week.vo.js → src/week.vo.js} +5 -4
- package/dist/src/weekday-iso-id.vo.d.ts +7 -0
- package/dist/src/weekday-iso-id.vo.js +5 -0
- package/dist/{weekday.vo.js → src/weekday.vo.js} +9 -8
- package/dist/src/weight-grams.vo.d.ts +7 -0
- package/dist/src/weight-grams.vo.js +5 -0
- package/dist/{weight.vo.js → src/weight.vo.js} +8 -7
- package/dist/src/year-iso-id.vo.d.ts +7 -0
- package/dist/src/year-iso-id.vo.js +7 -0
- package/dist/{year.vo.js → src/year.vo.js} +6 -5
- package/dist/tests/age-years.vo.test.d.ts +1 -0
- package/dist/tests/age-years.vo.test.js +24 -0
- package/dist/tests/age.vo.test.d.ts +1 -0
- package/dist/tests/age.vo.test.js +106 -0
- package/dist/tests/api-key.vo.test.d.ts +1 -0
- package/dist/tests/api-key.vo.test.js +24 -0
- package/dist/tests/basename.vo.test.d.ts +1 -0
- package/dist/tests/basename.vo.test.js +53 -0
- package/dist/tests/batch.test.d.ts +1 -0
- package/dist/tests/batch.test.js +24 -0
- package/dist/tests/date-calculator.service.test.d.ts +1 -0
- package/dist/tests/date-calculator.service.test.js +32 -0
- package/dist/tests/date-formatter.service.test.d.ts +1 -0
- package/dist/tests/date-formatter.service.test.js +22 -0
- package/dist/tests/date-range.vo.test.d.ts +1 -0
- package/dist/tests/date-range.vo.test.js +49 -0
- package/dist/tests/day-iso-id.vo.test.d.ts +1 -0
- package/dist/tests/day-iso-id.vo.test.js +36 -0
- package/dist/tests/day.vo.test.d.ts +1 -0
- package/dist/tests/day.vo.test.js +68 -0
- package/dist/tests/directory-path-absolute.vo.test.d.ts +1 -0
- package/dist/tests/directory-path-absolute.vo.test.js +47 -0
- package/dist/tests/directory-path-relative.vo.test.d.ts +1 -0
- package/dist/tests/directory-path-relative.vo.test.js +44 -0
- package/dist/tests/distance-value.vo.test.d.ts +1 -0
- package/dist/tests/distance-value.vo.test.js +21 -0
- package/dist/tests/distance.vo.test.d.ts +1 -0
- package/dist/tests/distance.vo.test.js +74 -0
- package/dist/tests/division-factor.vo.test.d.ts +1 -0
- package/dist/tests/division-factor.vo.test.js +21 -0
- package/dist/tests/dll.service.test.d.ts +1 -0
- package/dist/tests/dll.service.test.js +381 -0
- package/dist/tests/duration-ms.vo.test.d.ts +1 -0
- package/dist/tests/duration-ms.vo.test.js +18 -0
- package/dist/tests/duration.service.test.d.ts +1 -0
- package/dist/tests/duration.service.test.js +126 -0
- package/dist/tests/email-mask.service.test.d.ts +1 -0
- package/dist/tests/email-mask.service.test.js +15 -0
- package/dist/tests/email.vo.test.d.ts +1 -0
- package/dist/tests/email.vo.test.js +17 -0
- package/dist/tests/etags.vo.test.d.ts +1 -0
- package/dist/tests/etags.vo.test.js +54 -0
- package/dist/tests/extension.vo.test.d.ts +1 -0
- package/dist/tests/extension.vo.test.js +51 -0
- package/dist/tests/feature-flag-value.vo.test.d.ts +1 -0
- package/dist/tests/feature-flag-value.vo.test.js +12 -0
- package/dist/tests/feature-flag.vo.test.d.ts +1 -0
- package/dist/tests/feature-flag.vo.test.js +13 -0
- package/dist/tests/file-path-absolute-schema.vo.test.d.ts +1 -0
- package/dist/tests/file-path-absolute-schema.vo.test.js +53 -0
- package/dist/tests/file-path-relative-schema.vo.test.d.ts +1 -0
- package/dist/tests/file-path-relative-schema.vo.test.js +52 -0
- package/dist/tests/file-path.vo.test.d.ts +1 -0
- package/dist/tests/file-path.vo.test.js +74 -0
- package/dist/tests/filename-affix.vo.test.d.ts +1 -0
- package/dist/tests/filename-affix.vo.test.js +30 -0
- package/dist/tests/filename-from-string.vo.test.d.ts +1 -0
- package/dist/tests/filename-from-string.vo.test.js +37 -0
- package/dist/tests/filename.vo.test.d.ts +1 -0
- package/dist/tests/filename.vo.test.js +93 -0
- package/dist/tests/height-milimiters.vo.test.d.ts +1 -0
- package/dist/tests/height-milimiters.vo.test.js +21 -0
- package/dist/tests/height.vo.test.d.ts +1 -0
- package/dist/tests/height.vo.test.js +64 -0
- package/dist/tests/hour-value.vo.test.d.ts +1 -0
- package/dist/tests/hour-value.vo.test.js +24 -0
- package/dist/tests/hour.vo.test.d.ts +1 -0
- package/dist/tests/hour.vo.test.js +64 -0
- package/dist/tests/iban-mask.service.test.d.ts +1 -0
- package/dist/tests/iban-mask.service.test.js +13 -0
- package/dist/tests/iban-schema.vo.test.d.ts +1 -0
- package/dist/tests/iban-schema.vo.test.js +43 -0
- package/dist/tests/iban.vo.test.d.ts +1 -0
- package/dist/tests/iban.vo.test.js +46 -0
- package/dist/tests/image.vo.test.d.ts +1 -0
- package/dist/tests/image.vo.test.js +41 -0
- package/dist/tests/integer-non-negative.vo.test.d.ts +1 -0
- package/dist/tests/integer-non-negative.vo.test.js +22 -0
- package/dist/tests/integer-positive.vo.test.d.ts +1 -0
- package/dist/tests/integer-positive.vo.test.js +21 -0
- package/dist/tests/integer.vo.test.d.ts +1 -0
- package/dist/tests/integer.vo.test.js +21 -0
- package/dist/tests/language.vo.test.d.ts +1 -0
- package/dist/tests/language.vo.test.js +28 -0
- package/dist/tests/linear-regression.service.test.d.ts +1 -0
- package/dist/tests/linear-regression.service.test.js +111 -0
- package/dist/tests/mean.service.test.d.ts +1 -0
- package/dist/tests/mean.service.test.js +23 -0
- package/dist/tests/mime-registry-entry.vo.test.d.ts +1 -0
- package/dist/tests/mime-registry-entry.vo.test.js +15 -0
- package/dist/tests/mime-registry.service.test.d.ts +1 -0
- package/dist/tests/mime-registry.service.test.js +45 -0
- package/dist/tests/mime-value.vo.test.d.ts +1 -0
- package/dist/tests/mime-value.vo.test.js +49 -0
- package/dist/tests/mime.vo.test.d.ts +1 -0
- package/dist/tests/mime.vo.test.js +53 -0
- package/dist/tests/mimes.test.d.ts +1 -0
- package/dist/tests/mimes.test.js +28 -0
- package/dist/tests/min-max-scaler.service.test.d.ts +1 -0
- package/dist/tests/min-max-scaler.service.test.js +116 -0
- package/dist/tests/minute-value.vo.test.d.ts +1 -0
- package/dist/tests/minute-value.vo.test.js +24 -0
- package/dist/tests/minute.vo.test.d.ts +1 -0
- package/dist/tests/minute.vo.test.js +64 -0
- package/dist/tests/mocks.d.ts +6 -0
- package/dist/tests/mocks.js +7 -0
- package/dist/tests/money-amount.vo.test.d.ts +1 -0
- package/dist/tests/money-amount.vo.test.js +21 -0
- package/dist/tests/money.vo.test.d.ts +1 -0
- package/dist/tests/money.vo.test.js +90 -0
- package/dist/tests/month-iso-id.vo.test.d.ts +1 -0
- package/dist/tests/month-iso-id.vo.test.js +36 -0
- package/dist/tests/month.vo.test.d.ts +1 -0
- package/dist/tests/month.vo.test.js +65 -0
- package/dist/tests/multiplication-factor.vo.test.d.ts +1 -0
- package/dist/tests/multiplication-factor.vo.test.js +19 -0
- package/dist/tests/noop.test.d.ts +1 -0
- package/dist/tests/noop.test.js +12 -0
- package/dist/tests/object-key.vo.test.d.ts +1 -0
- package/dist/tests/object-key.vo.test.js +56 -0
- package/dist/tests/outlier-detector.service.test.d.ts +1 -0
- package/dist/tests/outlier-detector.service.test.js +35 -0
- package/dist/tests/package-version-schema.vo.test.d.ts +1 -0
- package/dist/tests/package-version-schema.vo.test.js +32 -0
- package/dist/tests/package-version.vo.test.d.ts +1 -0
- package/dist/tests/package-version.vo.test.js +138 -0
- package/dist/tests/pagination-page.vo.test.d.ts +1 -0
- package/dist/tests/pagination-page.vo.test.js +26 -0
- package/dist/tests/pagination-skip.vo.test.d.ts +1 -0
- package/dist/tests/pagination-skip.vo.test.js +23 -0
- package/dist/tests/pagination-take.vo.test.d.ts +1 -0
- package/dist/tests/pagination-take.vo.test.js +25 -0
- package/dist/tests/pagination.service.test.d.ts +1 -0
- package/dist/tests/pagination.service.test.js +92 -0
- package/dist/tests/percentage.service.test.d.ts +1 -0
- package/dist/tests/percentage.service.test.js +16 -0
- package/dist/tests/population-standard-deviation.service.test.d.ts +1 -0
- package/dist/tests/population-standard-deviation.service.test.js +20 -0
- package/dist/tests/quarter-iso-id.vo.test.d.ts +1 -0
- package/dist/tests/quarter-iso-id.vo.test.js +30 -0
- package/dist/tests/quarter.vo.test.d.ts +1 -0
- package/dist/tests/quarter.vo.test.js +54 -0
- package/dist/tests/random.service.test.d.ts +1 -0
- package/dist/tests/random.service.test.js +93 -0
- package/dist/tests/rate-limiter.service.test.d.ts +1 -0
- package/dist/tests/rate-limiter.service.test.js +39 -0
- package/dist/tests/relative-date.vo.test.d.ts +1 -0
- package/dist/tests/relative-date.vo.test.js +22 -0
- package/dist/tests/reordering-item-position-value.vo.test.d.ts +1 -0
- package/dist/tests/reordering-item-position-value.vo.test.js +21 -0
- package/dist/tests/reordering.service.test.d.ts +1 -0
- package/dist/tests/reordering.service.test.js +76 -0
- package/dist/tests/repeat.test.d.ts +1 -0
- package/dist/tests/repeat.test.js +8 -0
- package/dist/tests/revision-value.vo.test.d.ts +1 -0
- package/dist/tests/revision-value.vo.test.js +21 -0
- package/dist/tests/revision.vo.test.d.ts +1 -0
- package/dist/tests/revision.vo.test.js +52 -0
- package/dist/tests/rounding-decimal.strategy.test.d.ts +1 -0
- package/dist/tests/rounding-decimal.strategy.test.js +17 -0
- package/dist/tests/rounding-down.strategy.test.d.ts +1 -0
- package/dist/tests/rounding-down.strategy.test.js +9 -0
- package/dist/tests/rounding-to-nearest.strategy.test.d.ts +1 -0
- package/dist/tests/rounding-to-nearest.strategy.test.js +9 -0
- package/dist/tests/rounding-up.strategy.test.d.ts +1 -0
- package/dist/tests/rounding-up.strategy.test.js +9 -0
- package/dist/tests/size-bytes.vo.test.d.ts +1 -0
- package/dist/tests/size-bytes.vo.test.js +21 -0
- package/dist/tests/size.vo.test.d.ts +1 -0
- package/dist/tests/size.vo.test.js +93 -0
- package/dist/tests/slug.service.test.d.ts +1 -0
- package/dist/tests/slug.service.test.js +45 -0
- package/dist/tests/sum.service.test.d.ts +1 -0
- package/dist/tests/sum.service.test.js +22 -0
- package/dist/tests/thousands-separator.service.test.d.ts +1 -0
- package/dist/tests/thousands-separator.service.test.js +27 -0
- package/dist/tests/time-zone-offset-value.test.d.ts +1 -0
- package/dist/tests/time-zone-offset-value.test.js +27 -0
- package/dist/tests/timestamp-value.vo.test.d.ts +1 -0
- package/dist/tests/timestamp-value.vo.test.js +21 -0
- package/dist/tests/timestamp.vo.test.d.ts +1 -0
- package/dist/tests/timestamp.vo.test.js +73 -0
- package/dist/tests/timezone.vo.test.d.ts +1 -0
- package/dist/tests/timezone.vo.test.js +29 -0
- package/dist/tests/url-with-slash.vo.test.d.ts +1 -0
- package/dist/tests/url-with-slash.vo.test.js +24 -0
- package/dist/tests/url-without-slash.vo.test.d.ts +1 -0
- package/dist/tests/url-without-slash.vo.test.js +25 -0
- package/dist/tests/visually-unambiguous-characters-generator.service.test.d.ts +1 -0
- package/dist/tests/visually-unambiguous-characters-generator.service.test.js +89 -0
- package/dist/tests/week-iso-id.vo.test.d.ts +1 -0
- package/dist/tests/week-iso-id.vo.test.js +37 -0
- package/dist/tests/week.vo.test.d.ts +1 -0
- package/dist/tests/week.vo.test.js +64 -0
- package/dist/tests/weekday-iso-id.vo.test.d.ts +1 -0
- package/dist/tests/weekday-iso-id.vo.test.js +24 -0
- package/dist/tests/weekday.vo.test.d.ts +1 -0
- package/dist/tests/weekday.vo.test.js +51 -0
- package/dist/tests/weight-grams.vo.test.d.ts +1 -0
- package/dist/tests/weight-grams.vo.test.js +21 -0
- package/dist/tests/weight.vo.test.d.ts +1 -0
- package/dist/tests/weight.vo.test.js +66 -0
- package/dist/tests/year-iso-id.vo.test.d.ts +1 -0
- package/dist/tests/year-iso-id.vo.test.js +23 -0
- package/dist/tests/year.vo.test.d.ts +1 -0
- package/dist/tests/year.vo.test.js +79 -0
- package/dist/tests/z-score.service.test.d.ts +1 -0
- package/dist/tests/z-score.service.test.js +26 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -12
- package/dist/age-years.vo.d.ts +0 -11
- package/dist/age-years.vo.js +0 -11
- package/dist/api-key.vo.d.ts +0 -8
- package/dist/api-key.vo.js +0 -11
- package/dist/basename.vo.d.ts +0 -12
- package/dist/basename.vo.js +0 -27
- package/dist/day-iso-id.vo.d.ts +0 -9
- package/dist/directory-path-absolute.vo.d.ts +0 -12
- package/dist/directory-path-relative.vo.d.ts +0 -12
- package/dist/distance-value.vo.d.ts +0 -7
- package/dist/distance-value.vo.js +0 -9
- package/dist/division-factor.vo.d.ts +0 -7
- package/dist/division-factor.vo.js +0 -8
- package/dist/duration-ms.vo.d.ts +0 -6
- package/dist/duration-ms.vo.js +0 -4
- package/dist/email.vo.d.ts +0 -6
- package/dist/email.vo.js +0 -4
- package/dist/extension.vo.d.ts +0 -9
- package/dist/extension.vo.js +0 -21
- package/dist/feature-flag-value.vo.d.ts +0 -10
- package/dist/file-path-absolute-schema.vo.d.ts +0 -14
- package/dist/file-path-relative-schema.vo.d.ts +0 -14
- package/dist/filename-affix.vo.d.ts +0 -13
- package/dist/filename-from-string.vo.d.ts +0 -10
- package/dist/height-milimiters.vo.d.ts +0 -7
- package/dist/height-milimiters.vo.js +0 -12
- package/dist/hour-value.vo.d.ts +0 -7
- package/dist/hour-value.vo.js +0 -10
- package/dist/iban-schema.vo.d.ts +0 -7
- package/dist/iban-schema.vo.js +0 -12
- package/dist/image.vo.d.ts +0 -13
- package/dist/image.vo.js +0 -20
- package/dist/integer-non-negative.vo.d.ts +0 -7
- package/dist/integer-non-negative.vo.js +0 -12
- package/dist/integer-positive.vo.d.ts +0 -7
- package/dist/integer-positive.vo.js +0 -9
- package/dist/integer.vo.d.ts +0 -6
- package/dist/integer.vo.js +0 -4
- package/dist/language.vo.d.ts +0 -7
- package/dist/mime-value.vo.d.ts +0 -6
- package/dist/mimes.js +0 -18
- package/dist/minute-value.vo.d.ts +0 -7
- package/dist/minute-value.vo.js +0 -10
- package/dist/money-amount.vo.d.ts +0 -7
- package/dist/money-amount.vo.js +0 -9
- package/dist/month-iso-id.vo.d.ts +0 -8
- package/dist/multiplication-factor.vo.d.ts +0 -7
- package/dist/multiplication-factor.vo.js +0 -11
- package/dist/object-key.vo.d.ts +0 -11
- package/dist/object-key.vo.js +0 -24
- package/dist/package-version-schema.vo.d.ts +0 -8
- package/dist/pagination-page.vo.d.ts +0 -6
- package/dist/pagination-page.vo.js +0 -7
- package/dist/pagination-skip.vo.d.ts +0 -7
- package/dist/pagination-skip.vo.js +0 -6
- package/dist/pagination-take.vo.d.ts +0 -7
- package/dist/pagination-take.vo.js +0 -6
- package/dist/quarter-iso-id.vo.d.ts +0 -7
- package/dist/quarter-iso-id.vo.js +0 -11
- package/dist/reordering-item-position-value.vo.d.ts +0 -6
- package/dist/reordering-item-position-value.vo.js +0 -6
- package/dist/revision-value.vo.d.ts +0 -7
- package/dist/revision-value.vo.js +0 -6
- package/dist/rounding-decimal.strategy.js +0 -19
- package/dist/size-bytes.vo.d.ts +0 -6
- package/dist/size-bytes.vo.js +0 -9
- package/dist/time-zone-offset-value.vo.d.ts +0 -8
- package/dist/time-zone-offset-value.vo.js +0 -17
- package/dist/timestamp-value.vo.d.ts +0 -6
- package/dist/timestamp-value.vo.js +0 -9
- package/dist/timezone.vo.d.ts +0 -9
- package/dist/url-with-slash.vo.d.ts +0 -6
- package/dist/url-with-slash.vo.js +0 -8
- package/dist/url-without-slash.vo.d.ts +0 -6
- package/dist/url-without-slash.vo.js +0 -8
- package/dist/week-iso-id.vo.d.ts +0 -8
- package/dist/weekday-iso-id.vo.d.ts +0 -7
- package/dist/weekday-iso-id.vo.js +0 -10
- package/dist/weight-grams.vo.d.ts +0 -7
- package/dist/weight-grams.vo.js +0 -9
- package/dist/year-iso-id.vo.d.ts +0 -7
- package/dist/year-iso-id.vo.js +0 -10
- package/dist/{age.vo.d.ts → src/age.vo.d.ts} +0 -0
- package/dist/{batch.d.ts → src/batch.d.ts} +0 -0
- package/dist/{batch.js → src/batch.js} +0 -0
- package/dist/{date-calculator.service.d.ts → src/date-calculator.service.d.ts} +0 -0
- package/dist/{date-calculator.service.js → src/date-calculator.service.js} +0 -0
- package/dist/{date-formatter.service.d.ts → src/date-formatter.service.d.ts} +0 -0
- package/dist/{date-formatter.service.js → src/date-formatter.service.js} +0 -0
- package/dist/{date-range.vo.d.ts → src/date-range.vo.d.ts} +0 -0
- package/dist/{date-range.vo.js → src/date-range.vo.js} +0 -0
- package/dist/{day.vo.d.ts → src/day.vo.d.ts} +1 -1
- /package/dist/{distance.vo.d.ts → src/distance.vo.d.ts} +0 -0
- /package/dist/{dll.service.d.ts → src/dll.service.d.ts} +0 -0
- /package/dist/{dll.service.js → src/dll.service.js} +0 -0
- /package/dist/{duration.service.d.ts → src/duration.service.d.ts} +0 -0
- /package/dist/{email-mask.service.d.ts → src/email-mask.service.d.ts} +0 -0
- /package/dist/{email-mask.service.js → src/email-mask.service.js} +0 -0
- /package/dist/{etags.vo.d.ts → src/etags.vo.d.ts} +0 -0
- /package/dist/{feature-flag.vo.d.ts → src/feature-flag.vo.d.ts} +0 -0
- /package/dist/{feature-flag.vo.js → src/feature-flag.vo.js} +0 -0
- /package/dist/{file-path.vo.d.ts → src/file-path.vo.d.ts} +0 -0
- /package/dist/{filename.vo.d.ts → src/filename.vo.d.ts} +0 -0
- /package/dist/{height.vo.d.ts → src/height.vo.d.ts} +0 -0
- /package/dist/{hour.vo.d.ts → src/hour.vo.d.ts} +0 -0
- /package/dist/{iban-mask.service.d.ts → src/iban-mask.service.d.ts} +0 -0
- /package/dist/{iban-mask.service.js → src/iban-mask.service.js} +0 -0
- /package/dist/{iban.vo.d.ts → src/iban.vo.d.ts} +0 -0
- /package/dist/{index.d.ts → src/index.d.ts} +0 -0
- /package/dist/{index.js → src/index.js} +0 -0
- /package/dist/{linear-regression.service.d.ts → src/linear-regression.service.d.ts} +0 -0
- /package/dist/{linear-regression.service.js → src/linear-regression.service.js} +0 -0
- /package/dist/{mean.service.d.ts → src/mean.service.d.ts} +0 -0
- /package/dist/{mean.service.js → src/mean.service.js} +0 -0
- /package/dist/{mime-registry-entry.vo.d.ts → src/mime-registry-entry.vo.d.ts} +0 -0
- /package/dist/{mime-registry-entry.vo.js → src/mime-registry-entry.vo.js} +0 -0
- /package/dist/{mime-registry.service.d.ts → src/mime-registry.service.d.ts} +0 -0
- /package/dist/{mime-registry.service.js → src/mime-registry.service.js} +0 -0
- /package/dist/{mime.vo.d.ts → src/mime.vo.d.ts} +0 -0
- /package/dist/{mimes.d.ts → src/mimes.d.ts} +0 -0
- /package/dist/{min-max-scaler.service.d.ts → src/min-max-scaler.service.d.ts} +0 -0
- /package/dist/{min-max-scaler.service.js → src/min-max-scaler.service.js} +0 -0
- /package/dist/{minute.vo.d.ts → src/minute.vo.d.ts} +0 -0
- /package/dist/{money.vo.d.ts → src/money.vo.d.ts} +0 -0
- /package/dist/{month.vo.d.ts → src/month.vo.d.ts} +0 -0
- /package/dist/{noop.service.d.ts → src/noop.service.d.ts} +0 -0
- /package/dist/{noop.service.js → src/noop.service.js} +0 -0
- /package/dist/{outlier-detector.service.d.ts → src/outlier-detector.service.d.ts} +0 -0
- /package/dist/{outlier-detector.service.js → src/outlier-detector.service.js} +0 -0
- /package/dist/{package-version.vo.d.ts → src/package-version.vo.d.ts} +0 -0
- /package/dist/{pagination.service.d.ts → src/pagination.service.d.ts} +0 -0
- /package/dist/{percentage.service.d.ts → src/percentage.service.d.ts} +0 -0
- /package/dist/{percentage.service.js → src/percentage.service.js} +0 -0
- /package/dist/{population-standard-deviation.service.d.ts → src/population-standard-deviation.service.d.ts} +0 -0
- /package/dist/{population-standard-deviation.service.js → src/population-standard-deviation.service.js} +0 -0
- /package/dist/{quarter.vo.d.ts → src/quarter.vo.d.ts} +0 -0
- /package/dist/{random.service.d.ts → src/random.service.d.ts} +0 -0
- /package/dist/{random.service.js → src/random.service.js} +0 -0
- /package/dist/{rate-limiter.service.d.ts → src/rate-limiter.service.d.ts} +0 -0
- /package/dist/{rate-limiter.service.js → src/rate-limiter.service.js} +0 -0
- /package/dist/{relative-date.vo.d.ts → src/relative-date.vo.d.ts} +0 -0
- /package/dist/{relative-date.vo.js → src/relative-date.vo.js} +0 -0
- /package/dist/{repeat.d.ts → src/repeat.d.ts} +0 -0
- /package/dist/{repeat.js → src/repeat.js} +0 -0
- /package/dist/{revision.vo.d.ts → src/revision.vo.d.ts} +0 -0
- /package/dist/{rounding-down.strategy.d.ts → src/rounding-down.strategy.d.ts} +0 -0
- /package/dist/{rounding-down.strategy.js → src/rounding-down.strategy.js} +0 -0
- /package/dist/{rounding-to-nearest.strategy.d.ts → src/rounding-to-nearest.strategy.d.ts} +0 -0
- /package/dist/{rounding-to-nearest.strategy.js → src/rounding-to-nearest.strategy.js} +0 -0
- /package/dist/{rounding-up.strategy.d.ts → src/rounding-up.strategy.d.ts} +0 -0
- /package/dist/{rounding-up.strategy.js → src/rounding-up.strategy.js} +0 -0
- /package/dist/{rounding.strategy.d.ts → src/rounding.strategy.d.ts} +0 -0
- /package/dist/{rounding.strategy.js → src/rounding.strategy.js} +0 -0
- /package/dist/{size.vo.d.ts → src/size.vo.d.ts} +0 -0
- /package/dist/{slug.service.d.ts → src/slug.service.d.ts} +0 -0
- /package/dist/{slug.service.js → src/slug.service.js} +0 -0
- /package/dist/{sum.service.d.ts → src/sum.service.d.ts} +0 -0
- /package/dist/{sum.service.js → src/sum.service.js} +0 -0
- /package/dist/{thousands-separator.service.d.ts → src/thousands-separator.service.d.ts} +0 -0
- /package/dist/{thousands-separator.service.js → src/thousands-separator.service.js} +0 -0
- /package/dist/{timestamp.vo.d.ts → src/timestamp.vo.d.ts} +0 -0
- /package/dist/{ts-utils.d.ts → src/ts-utils.d.ts} +0 -0
- /package/dist/{ts-utils.js → src/ts-utils.js} +0 -0
- /package/dist/{visually-unambiguous-characters-generator.service.d.ts → src/visually-unambiguous-characters-generator.service.d.ts} +0 -0
- /package/dist/{visually-unambiguous-characters-generator.service.js → src/visually-unambiguous-characters-generator.service.js} +0 -0
- /package/dist/{week.vo.d.ts → src/week.vo.d.ts} +0 -0
- /package/dist/{weekday.vo.d.ts → src/weekday.vo.d.ts} +0 -0
- /package/dist/{weight.vo.d.ts → src/weight.vo.d.ts} +0 -0
- /package/dist/{year.vo.d.ts → src/year.vo.d.ts} +0 -0
- /package/dist/{z-score.service.d.ts → src/z-score.service.d.ts} +0 -0
- /package/dist/{z-score.service.js → src/z-score.service.js} +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { Duration } from "../src/duration.service";
|
|
3
|
+
import { RateLimiter } from "../src/rate-limiter.service";
|
|
4
|
+
import { Timestamp } from "../src/timestamp.vo";
|
|
5
|
+
import * as mocks from "./mocks";
|
|
6
|
+
const duration = Duration.Ms(1000);
|
|
7
|
+
const currentTimestampMs = Timestamp.fromNumber(0);
|
|
8
|
+
describe("RateLimiter", () => {
|
|
9
|
+
test("first invocation", () => {
|
|
10
|
+
expect(new RateLimiter(duration).verify(currentTimestampMs).allowed).toEqual(true);
|
|
11
|
+
});
|
|
12
|
+
test("rejects invocations within the rate limit", () => {
|
|
13
|
+
const rateLimiter = new RateLimiter(duration);
|
|
14
|
+
const first = rateLimiter.verify(currentTimestampMs);
|
|
15
|
+
expect(first.allowed).toEqual(true);
|
|
16
|
+
const second = rateLimiter.verify(currentTimestampMs.add(duration).subtract(mocks.epsilon));
|
|
17
|
+
expect(second.allowed).toEqual(false);
|
|
18
|
+
// @ts-expect-error
|
|
19
|
+
expect(second.remaining).toEqual(mocks.epsilon);
|
|
20
|
+
});
|
|
21
|
+
test("allows invocations at the limit boundary", () => {
|
|
22
|
+
const rateLimiter = new RateLimiter(duration);
|
|
23
|
+
const first = rateLimiter.verify(currentTimestampMs);
|
|
24
|
+
expect(first.allowed).toEqual(true);
|
|
25
|
+
const second = rateLimiter.verify(currentTimestampMs.add(duration));
|
|
26
|
+
expect(second.allowed).toEqual(true);
|
|
27
|
+
});
|
|
28
|
+
test("rejects invocations around the boundaries", () => {
|
|
29
|
+
const rateLimiter = new RateLimiter(duration);
|
|
30
|
+
const first = rateLimiter.verify(currentTimestampMs);
|
|
31
|
+
expect(first.allowed).toEqual(true);
|
|
32
|
+
const second = rateLimiter.verify(currentTimestampMs.add(duration));
|
|
33
|
+
expect(second.allowed).toEqual(true);
|
|
34
|
+
const third = rateLimiter.verify(currentTimestampMs.add(duration).add(mocks.epsilon));
|
|
35
|
+
expect(third.allowed).toEqual(false);
|
|
36
|
+
const fourth = rateLimiter.verify(currentTimestampMs.add(duration).add(Duration.Ms(2)));
|
|
37
|
+
expect(fourth.allowed).toEqual(false);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, jest, test } from "bun:test";
|
|
2
|
+
import { RelativeDate } from "../src/relative-date.vo";
|
|
3
|
+
import { Timestamp } from "../src/timestamp.vo";
|
|
4
|
+
describe("RelativeDate", () => {
|
|
5
|
+
const timestamp = Timestamp.fromNumber(new Date("2024-06-01T12:00:00Z").getTime());
|
|
6
|
+
beforeEach(() => jest.setSystemTime(new Date("2024-06-01T12:05:00Z")));
|
|
7
|
+
afterEach(() => jest.setSystemTime());
|
|
8
|
+
describe("truthy", () => {
|
|
9
|
+
test("formats a timestamp into relative format", () => {
|
|
10
|
+
expect(RelativeDate.truthy(timestamp)).toEqual({ raw: timestamp.ms, relative: "5 minutes ago" });
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
describe("falsy", () => {
|
|
14
|
+
test("returns null for falsy value", () => {
|
|
15
|
+
expect(RelativeDate.falsy(undefined)).toEqual(null);
|
|
16
|
+
expect(RelativeDate.falsy(null)).toEqual(null);
|
|
17
|
+
});
|
|
18
|
+
test("formats a valid timestamp", () => {
|
|
19
|
+
expect(RelativeDate.falsy(timestamp)).toEqual({ raw: timestamp.ms, relative: "5 minutes ago" });
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import * as v from "valibot";
|
|
3
|
+
import { ReorderingItemPositionValue } from "../src/reordering-item-position-value.vo";
|
|
4
|
+
describe("ReorderingItemPositionValue", () => {
|
|
5
|
+
test("happy path", () => {
|
|
6
|
+
expect(v.safeParse(ReorderingItemPositionValue, 0).success).toEqual(true);
|
|
7
|
+
expect(v.safeParse(ReorderingItemPositionValue, 1).success).toEqual(true);
|
|
8
|
+
});
|
|
9
|
+
test("rejects non-number - null", () => {
|
|
10
|
+
expect(() => v.parse(ReorderingItemPositionValue, null)).toThrow("reordering.position.type");
|
|
11
|
+
});
|
|
12
|
+
test("rejects non-number - string", () => {
|
|
13
|
+
expect(() => v.parse(ReorderingItemPositionValue, "123")).toThrow("reordering.position.type");
|
|
14
|
+
});
|
|
15
|
+
test("rejects negative numbers", () => {
|
|
16
|
+
expect(() => v.parse(ReorderingItemPositionValue, -1)).toThrow("reordering.position.type");
|
|
17
|
+
});
|
|
18
|
+
test("rejects fractions", () => {
|
|
19
|
+
expect(() => v.parse(ReorderingItemPositionValue, 1.5)).toThrow("reordering.position.type");
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { ReorderingCalculator, ReorderingTransfer } from "../src/reordering.service";
|
|
3
|
+
describe("Reordering", () => {
|
|
4
|
+
test("add", () => {
|
|
5
|
+
const calculator = new ReorderingCalculator();
|
|
6
|
+
for (const id of ["a", "b", "c"])
|
|
7
|
+
calculator.add(id);
|
|
8
|
+
calculator.transfer(new ReorderingTransfer({ id: "c", to: 1 }));
|
|
9
|
+
expect(calculator.read().ids).toEqual(["a", "c", "b"]);
|
|
10
|
+
});
|
|
11
|
+
test("delete", () => {
|
|
12
|
+
const calculator = ReorderingCalculator.fromArray(["a", "b", "c"]);
|
|
13
|
+
calculator.delete("b");
|
|
14
|
+
expect(calculator.read().ids).toEqual(["a", "c"]);
|
|
15
|
+
});
|
|
16
|
+
test("delete - throws when item is not found", () => {
|
|
17
|
+
expect(() => ReorderingCalculator.fromArray(["a", "b", "c"]).delete("d")).toThrow("reordering.cannot.find.item");
|
|
18
|
+
});
|
|
19
|
+
test("transfer - noop", () => {
|
|
20
|
+
const calculator = ReorderingCalculator.fromArray(["aaa", "bbb", "ccc"]);
|
|
21
|
+
calculator.transfer(new ReorderingTransfer({ id: "ccc", to: 2 }));
|
|
22
|
+
expect(calculator.read().ids).toEqual(["aaa", "bbb", "ccc"]);
|
|
23
|
+
});
|
|
24
|
+
test("transfer - from end to middle", () => {
|
|
25
|
+
const calculator = ReorderingCalculator.fromArray(["aaa", "bbb", "ccc"]);
|
|
26
|
+
calculator.transfer(new ReorderingTransfer({ id: "ccc", to: 1 }));
|
|
27
|
+
expect(calculator.read().ids).toEqual(["aaa", "ccc", "bbb"]);
|
|
28
|
+
});
|
|
29
|
+
test("transfer - from end to start", () => {
|
|
30
|
+
const calculator = ReorderingCalculator.fromArray(["aaa", "bbb", "ccc"]);
|
|
31
|
+
calculator.transfer(new ReorderingTransfer({ id: "ccc", to: 0 }));
|
|
32
|
+
expect(calculator.read().ids).toEqual(["ccc", "aaa", "bbb"]);
|
|
33
|
+
});
|
|
34
|
+
test("transfer - from middle to start", () => {
|
|
35
|
+
const calculator = ReorderingCalculator.fromArray(["aaa", "bbb", "ccc"]);
|
|
36
|
+
calculator.transfer(new ReorderingTransfer({ id: "bbb", to: 0 }));
|
|
37
|
+
expect(calculator.read().ids).toEqual(["bbb", "aaa", "ccc"]);
|
|
38
|
+
});
|
|
39
|
+
test("transfer - from middle to end", () => {
|
|
40
|
+
const calculator = ReorderingCalculator.fromArray(["aaa", "bbb", "ccc"]);
|
|
41
|
+
calculator.transfer(new ReorderingTransfer({ id: "bbb", to: 2 }));
|
|
42
|
+
expect(calculator.read().ids).toEqual(["aaa", "ccc", "bbb"]);
|
|
43
|
+
});
|
|
44
|
+
test("transfer - from start to middle", () => {
|
|
45
|
+
const calculator = ReorderingCalculator.fromArray(["aaa", "bbb", "ccc"]);
|
|
46
|
+
calculator.transfer(new ReorderingTransfer({ id: "aaa", to: 1 }));
|
|
47
|
+
expect(calculator.read().ids).toEqual(["bbb", "aaa", "ccc"]);
|
|
48
|
+
});
|
|
49
|
+
test("transfer - from start to end", () => {
|
|
50
|
+
const calculator = ReorderingCalculator.fromArray(["aaa", "bbb", "ccc"]);
|
|
51
|
+
calculator.transfer(new ReorderingTransfer({ id: "aaa", to: 2 }));
|
|
52
|
+
expect(calculator.read().ids).toEqual(["bbb", "ccc", "aaa"]);
|
|
53
|
+
});
|
|
54
|
+
test("transfer - to back and to start", () => {
|
|
55
|
+
const toEnd = new ReorderingTransfer({ id: "aaa", to: 2 });
|
|
56
|
+
const toStart = new ReorderingTransfer({ id: "aaa", to: 0 });
|
|
57
|
+
const calculator = ReorderingCalculator.fromArray(["aaa", "bbb", "ccc"]);
|
|
58
|
+
calculator.transfer(toEnd);
|
|
59
|
+
expect(calculator.read().ids).toEqual(["bbb", "ccc", "aaa"]);
|
|
60
|
+
calculator.transfer(toStart);
|
|
61
|
+
expect(calculator.read().ids).toEqual(["aaa", "bbb", "ccc"]);
|
|
62
|
+
});
|
|
63
|
+
test("transfer - error - cannot find current", () => {
|
|
64
|
+
const calculator = ReorderingCalculator.fromArray(["aaa", "bbb", "ccc"]);
|
|
65
|
+
expect(() => calculator.transfer(new ReorderingTransfer({ id: "ddd", to: 1 }))).toThrow("reordering.cannot.find.current");
|
|
66
|
+
});
|
|
67
|
+
test("transfer - error - cannot find target", () => {
|
|
68
|
+
const calculator = ReorderingCalculator.fromArray(["aaa", "bbb", "ccc"]);
|
|
69
|
+
expect(() => calculator.transfer(new ReorderingTransfer({ id: "ccc", to: 4 }))).toThrow("reordering.cannot.find.target");
|
|
70
|
+
});
|
|
71
|
+
test("transfer - 10 elements", () => {
|
|
72
|
+
const calculator = ReorderingCalculator.fromArray(["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]);
|
|
73
|
+
calculator.transfer(new ReorderingTransfer({ id: "h", to: 1 }));
|
|
74
|
+
expect(calculator.read().ids).toEqual(["a", "h", "b", "c", "d", "e", "f", "g", "i", "j"]);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import * as v from "valibot";
|
|
3
|
+
import { RevisionValue } from "../src/revision-value.vo";
|
|
4
|
+
describe("RevisionValue", () => {
|
|
5
|
+
test("happy path", () => {
|
|
6
|
+
expect(v.safeParse(RevisionValue, 0).success).toEqual(true);
|
|
7
|
+
expect(v.safeParse(RevisionValue, 1).success).toEqual(true);
|
|
8
|
+
});
|
|
9
|
+
test("rejects non-number - null", () => {
|
|
10
|
+
expect(() => v.parse(RevisionValue, null)).toThrow("revision.value.type");
|
|
11
|
+
});
|
|
12
|
+
test("rejects non-number - string", () => {
|
|
13
|
+
expect(() => v.parse(RevisionValue, "123")).toThrow("revision.value.type");
|
|
14
|
+
});
|
|
15
|
+
test("rejects fractions", () => {
|
|
16
|
+
expect(() => v.parse(RevisionValue, 1.5)).toThrow("revision.value.type");
|
|
17
|
+
});
|
|
18
|
+
test("rejects negative numbers", () => {
|
|
19
|
+
expect(() => v.parse(RevisionValue, -1)).toThrow("revision.value.invalid");
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import * as v from "valibot";
|
|
3
|
+
import { ETag, WeakETag } from "../src/etags.vo";
|
|
4
|
+
import { Revision } from "../src/revision.vo";
|
|
5
|
+
import { RevisionValue } from "../src/revision-value.vo";
|
|
6
|
+
describe("Revision", () => {
|
|
7
|
+
test("happy path", () => {
|
|
8
|
+
const value = v.parse(RevisionValue, 0);
|
|
9
|
+
const revision = new Revision(value);
|
|
10
|
+
expect(revision.value).toEqual(value);
|
|
11
|
+
});
|
|
12
|
+
test("throws for invalid input", () => {
|
|
13
|
+
expect(() => new Revision("invalid")).toThrow("revision.value.type");
|
|
14
|
+
});
|
|
15
|
+
test("fromETag", () => {
|
|
16
|
+
const etag = ETag.fromHeader("123");
|
|
17
|
+
const revision = Revision.fromETag(etag);
|
|
18
|
+
expect(revision.value).toEqual(v.parse(RevisionValue, 123));
|
|
19
|
+
});
|
|
20
|
+
test("fromETag - throws for null", () => {
|
|
21
|
+
expect(() => Revision.fromETag(null)).toThrow("revision.missing");
|
|
22
|
+
});
|
|
23
|
+
test("fromWeakETag", () => {
|
|
24
|
+
const weak = WeakETag.fromHeader("W/123");
|
|
25
|
+
const revision = Revision.fromWeakETag(weak);
|
|
26
|
+
expect(revision.value).toEqual(v.parse(RevisionValue, 123));
|
|
27
|
+
});
|
|
28
|
+
test("fromWeakETag - throws for null", () => {
|
|
29
|
+
expect(() => Revision.fromWeakETag(null)).toThrow("revision.missing");
|
|
30
|
+
});
|
|
31
|
+
test("equals", () => {
|
|
32
|
+
expect(new Revision(123).equals(new Revision(123).value)).toEqual(true);
|
|
33
|
+
expect(new Revision(123).equals(new Revision(456).value)).toEqual(false);
|
|
34
|
+
});
|
|
35
|
+
test("validate success", () => {
|
|
36
|
+
expect(() => new Revision(123).validate(new Revision(123).value)).not.toThrow();
|
|
37
|
+
});
|
|
38
|
+
test("validate - throws mismatch", () => {
|
|
39
|
+
expect(() => new Revision(123).validate(new Revision(456).value)).toThrow("revision.mismatch");
|
|
40
|
+
});
|
|
41
|
+
test("next - returns a new revision with incremented value", () => {
|
|
42
|
+
const revision = new Revision(123);
|
|
43
|
+
const incremented = revision.next();
|
|
44
|
+
expect(incremented.value).toEqual(v.parse(RevisionValue, revision.value + 1));
|
|
45
|
+
});
|
|
46
|
+
test("toString", () => {
|
|
47
|
+
expect(new Revision(1).toString()).toEqual("1");
|
|
48
|
+
});
|
|
49
|
+
test("toJSON", () => {
|
|
50
|
+
expect(new Revision(1).toJSON()).toEqual(1);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { RoundingDecimalStrategy } from "../src/rounding-decimal.strategy";
|
|
3
|
+
describe("RoundingDecimalStrategy", () => {
|
|
4
|
+
test("happy path", () => {
|
|
5
|
+
const rounding = new RoundingDecimalStrategy(2);
|
|
6
|
+
expect(rounding.round(5.678)).toEqual(5.68);
|
|
7
|
+
expect(rounding.round(3.245)).toEqual(3.25);
|
|
8
|
+
});
|
|
9
|
+
test("invalid", () => {
|
|
10
|
+
// @ts-expect-error
|
|
11
|
+
expect(() => new RoundingDecimalStrategy("")).toThrow("rounding.decimal.type");
|
|
12
|
+
expect(() => new RoundingDecimalStrategy(-1)).toThrow("rounding.decimal.invalid");
|
|
13
|
+
expect(() => new RoundingDecimalStrategy(0)).toThrow("rounding.decimal.invalid");
|
|
14
|
+
expect(() => new RoundingDecimalStrategy(1.5)).toThrow("rounding.decimal.invalid");
|
|
15
|
+
expect(() => new RoundingDecimalStrategy(101)).toThrow("rounding.decimal.invalid");
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { RoundingDownStrategy } from "../src/rounding-down.strategy";
|
|
3
|
+
describe("RoundingDownStrategy", () => {
|
|
4
|
+
test("happy path", () => {
|
|
5
|
+
const rounding = new RoundingDownStrategy();
|
|
6
|
+
expect(rounding.round(5.6)).toEqual(5);
|
|
7
|
+
expect(rounding.round(3.2)).toEqual(3);
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { RoundingToNearestStrategy } from "../src/rounding-to-nearest.strategy";
|
|
3
|
+
describe("RoundingToNearestStrategy", () => {
|
|
4
|
+
test("happy path", () => {
|
|
5
|
+
const rounding = new RoundingToNearestStrategy();
|
|
6
|
+
expect(rounding.round(5.6)).toEqual(6);
|
|
7
|
+
expect(rounding.round(3.2)).toEqual(3);
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { RoundingUpStrategy } from "../src/rounding-up.strategy";
|
|
3
|
+
describe("RoundingUpStrategy", () => {
|
|
4
|
+
test("happy path", () => {
|
|
5
|
+
const rounding = new RoundingUpStrategy();
|
|
6
|
+
expect(rounding.round(5.6)).toEqual(6);
|
|
7
|
+
expect(rounding.round(3.2)).toEqual(4);
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import * as v from "valibot";
|
|
3
|
+
import { SizeBytes } from "../src/size-bytes.vo";
|
|
4
|
+
describe("SizeBytes", () => {
|
|
5
|
+
test("happy path", () => {
|
|
6
|
+
expect(v.safeParse(SizeBytes, 0).success).toEqual(true);
|
|
7
|
+
expect(v.safeParse(SizeBytes, 123).success).toEqual(true);
|
|
8
|
+
});
|
|
9
|
+
test("rejects non-number - null", () => {
|
|
10
|
+
expect(() => v.parse(SizeBytes, null)).toThrow("size.bytes.invalid");
|
|
11
|
+
});
|
|
12
|
+
test("rejects non-number - string", () => {
|
|
13
|
+
expect(() => v.parse(SizeBytes, "123")).toThrow("size.bytes.invalid");
|
|
14
|
+
});
|
|
15
|
+
test("rejects negative numbers", () => {
|
|
16
|
+
expect(() => v.parse(SizeBytes, -1)).toThrow("size.bytes.invalid");
|
|
17
|
+
});
|
|
18
|
+
test("rejects fractions", () => {
|
|
19
|
+
expect(() => v.parse(SizeBytes, 1.5)).toThrow("size.bytes.invalid");
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import * as v from "valibot";
|
|
3
|
+
import { Size } from "../src/size.vo";
|
|
4
|
+
import { SizeBytes } from "../src/size-bytes.vo";
|
|
5
|
+
describe("Size", () => {
|
|
6
|
+
test("happy path", () => {
|
|
7
|
+
expect(Size.fromBytes(500).toString()).toEqual("500 b");
|
|
8
|
+
expect(Size.fromKb(500).toString()).toEqual("500 kB");
|
|
9
|
+
expect(Size.fromMB(2).toString()).toEqual("2 MB");
|
|
10
|
+
expect(Size.fromGB(2).toString()).toEqual("2 GB");
|
|
11
|
+
});
|
|
12
|
+
test("rejects invalid values", () => {
|
|
13
|
+
expect(() => Size.fromKb(1.555)).toThrow("size.bytes.invalid");
|
|
14
|
+
});
|
|
15
|
+
test("convert - bytes to bytes", () => {
|
|
16
|
+
expect(Size.fromBytes(4096).toBytes()).toEqual(v.parse(SizeBytes, 4096));
|
|
17
|
+
});
|
|
18
|
+
test("convert - kB to bytes", () => {
|
|
19
|
+
expect(Size.fromKb(512).toBytes()).toEqual(v.parse(SizeBytes, 524288));
|
|
20
|
+
});
|
|
21
|
+
test("convert - MB to bytes", () => {
|
|
22
|
+
expect(Size.fromMB(1.5).toBytes()).toEqual(v.parse(SizeBytes, 1572864));
|
|
23
|
+
});
|
|
24
|
+
test("convert - GB to bytes", () => {
|
|
25
|
+
expect(Size.fromGB(1.5).toBytes()).toEqual(v.parse(SizeBytes, 1610612736));
|
|
26
|
+
});
|
|
27
|
+
test("tokB", () => {
|
|
28
|
+
expect(Size.fromBytes(1023).tokB()).toEqual(1);
|
|
29
|
+
expect(Size.fromBytes(1024).tokB()).toEqual(1);
|
|
30
|
+
expect(Size.fromBytes(1025).tokB()).toEqual(2);
|
|
31
|
+
});
|
|
32
|
+
test("toMB", () => {
|
|
33
|
+
expect(Size.fromKb(1023).toMB()).toEqual(1);
|
|
34
|
+
expect(Size.fromKb(1024).toMB()).toEqual(1);
|
|
35
|
+
expect(Size.fromKb(1025).toMB()).toEqual(2);
|
|
36
|
+
});
|
|
37
|
+
test("toGB", () => {
|
|
38
|
+
expect(Size.fromMB(1023).toGB()).toEqual(1);
|
|
39
|
+
expect(Size.fromMB(1024).toGB()).toEqual(1);
|
|
40
|
+
expect(Size.fromMB(1025).toGB()).toEqual(2);
|
|
41
|
+
});
|
|
42
|
+
test("equals", () => {
|
|
43
|
+
expect(Size.fromGB(1).equals(Size.fromGB(1))).toEqual(true);
|
|
44
|
+
expect(Size.fromMB(1).equals(Size.fromMB(2))).toEqual(false);
|
|
45
|
+
});
|
|
46
|
+
test("isSmallerThan", () => {
|
|
47
|
+
expect(Size.fromMB(1).isSmallerThan(Size.fromGB(1))).toEqual(true);
|
|
48
|
+
expect(Size.fromMB(1).isSmallerThan(Size.fromMB(1))).toEqual(false);
|
|
49
|
+
expect(Size.fromGB(2).isSmallerThan(Size.fromGB(1))).toEqual(false);
|
|
50
|
+
});
|
|
51
|
+
test("isGreaterThan", () => {
|
|
52
|
+
expect(Size.fromGB(1).isGreaterThan(Size.fromMB(1))).toEqual(true);
|
|
53
|
+
expect(Size.fromMB(1).isGreaterThan(Size.fromMB(1))).toEqual(false);
|
|
54
|
+
expect(Size.fromMB(1).isGreaterThan(Size.fromMB(2))).toEqual(false);
|
|
55
|
+
});
|
|
56
|
+
test("format - bytes source", () => {
|
|
57
|
+
const value = Size.fromBytes(1024);
|
|
58
|
+
expect(value.format(Size.unit.b)).toEqual("1024 b");
|
|
59
|
+
expect(value.format(Size.unit.kB)).toEqual("1 kB");
|
|
60
|
+
expect(value.format(Size.unit.MB)).toEqual("0 MB");
|
|
61
|
+
expect(value.format(Size.unit.GB)).toEqual("0 GB");
|
|
62
|
+
});
|
|
63
|
+
test("format - kB source", () => {
|
|
64
|
+
const value = Size.fromKb(512);
|
|
65
|
+
expect(value.format(Size.unit.b)).toEqual("524288 b");
|
|
66
|
+
expect(value.format(Size.unit.kB)).toEqual("512 kB");
|
|
67
|
+
expect(value.format(Size.unit.MB)).toEqual("0.5 MB");
|
|
68
|
+
expect(value.format(Size.unit.GB)).toEqual("0 GB");
|
|
69
|
+
});
|
|
70
|
+
test("format - MB source", () => {
|
|
71
|
+
const value = Size.fromMB(128);
|
|
72
|
+
expect(value.format(Size.unit.b)).toEqual("134217728 b");
|
|
73
|
+
expect(value.format(Size.unit.kB)).toEqual("131072 kB");
|
|
74
|
+
expect(value.format(Size.unit.MB)).toEqual("128 MB");
|
|
75
|
+
expect(value.format(Size.unit.GB)).toEqual("0.13 GB");
|
|
76
|
+
});
|
|
77
|
+
test("format - GB source", () => {
|
|
78
|
+
const value = Size.fromGB(2);
|
|
79
|
+
expect(value.format(Size.unit.b)).toEqual("2147483648 b");
|
|
80
|
+
expect(value.format(Size.unit.kB)).toEqual("2097152 kB");
|
|
81
|
+
expect(value.format(Size.unit.MB)).toEqual("2048 MB");
|
|
82
|
+
expect(value.format(Size.unit.GB)).toEqual("2 GB");
|
|
83
|
+
});
|
|
84
|
+
test("toBytes", () => {
|
|
85
|
+
expect(Size.toBytes({ unit: Size.unit.GB, value: 1 })).toEqual(v.parse(SizeBytes, 1073741824));
|
|
86
|
+
});
|
|
87
|
+
test("toString", () => {
|
|
88
|
+
expect(Size.fromGB(1).toString()).toEqual("1 GB");
|
|
89
|
+
});
|
|
90
|
+
test("toJSON", () => {
|
|
91
|
+
expect(Size.fromGB(1).toJSON()).toEqual({ bytes: 1073741824 });
|
|
92
|
+
});
|
|
93
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { Slug } from "../src/slug.service";
|
|
3
|
+
describe("Slug", () => {
|
|
4
|
+
test("happy path", () => {
|
|
5
|
+
expect(Slug.generate("input")).toEqual("input");
|
|
6
|
+
expect(Slug.generate("file123")).toEqual("file123");
|
|
7
|
+
});
|
|
8
|
+
test("spaces and punctuation", () => {
|
|
9
|
+
expect(Slug.generate("happy path")).toEqual("happy-path");
|
|
10
|
+
expect(Slug.generate("hello, world!")).toEqual("hello-world");
|
|
11
|
+
expect(Slug.generate("don't stop")).toEqual("don-t-stop");
|
|
12
|
+
expect(Slug.generate("price: $100")).toEqual("price-100");
|
|
13
|
+
expect(Slug.generate("Product: Foo Bar™ (v2.0)")).toEqual("product-foo-bar-v2-0");
|
|
14
|
+
expect(Slug.generate("Hello... World???")).toEqual("hello-world");
|
|
15
|
+
expect(Slug.generate("__private__field__")).toEqual("private-field");
|
|
16
|
+
});
|
|
17
|
+
test("collapses multiple consecutive separators", () => {
|
|
18
|
+
expect(Slug.generate("hello!!world")).toEqual("hello-world");
|
|
19
|
+
expect(Slug.generate("a b c")).toEqual("a-b-c");
|
|
20
|
+
expect(Slug.generate("x---y----z")).toEqual("x-y-z");
|
|
21
|
+
});
|
|
22
|
+
test("trims leading and trailing separators", () => {
|
|
23
|
+
expect(Slug.generate("-input")).toEqual("input");
|
|
24
|
+
expect(Slug.generate("input-")).toEqual("input");
|
|
25
|
+
expect(Slug.generate("--input--")).toEqual("input");
|
|
26
|
+
expect(Slug.generate("!!!input!!!")).toEqual("input");
|
|
27
|
+
});
|
|
28
|
+
test("various letters", () => {
|
|
29
|
+
expect(Slug.generate("bądź sobą")).toEqual("bądź-sobą");
|
|
30
|
+
expect(Slug.generate("你好世界")).toEqual("你好世界");
|
|
31
|
+
expect(Slug.generate("مرحبا بالعالم")).toEqual("مرحبا-بالعالم");
|
|
32
|
+
expect(Slug.generate("Αγία Σοφία")).toEqual("αγία-σοφία");
|
|
33
|
+
expect(Slug.generate("Café au lait")).toEqual("café-au-lait");
|
|
34
|
+
});
|
|
35
|
+
test("custom separators", () => {
|
|
36
|
+
expect(Slug.generate("hello world", "_")).toEqual("hello_world");
|
|
37
|
+
expect(Slug.generate("a b c", "+")).toEqual("a+b+c");
|
|
38
|
+
});
|
|
39
|
+
test("empty cases", () => {
|
|
40
|
+
expect(Slug.generate("")).toEqual("");
|
|
41
|
+
expect(Slug.generate("!!!")).toEqual("");
|
|
42
|
+
expect(Slug.generate("---")).toEqual("");
|
|
43
|
+
expect(Slug.generate(" ")).toEqual("");
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { Sum } from "../src/sum.service";
|
|
3
|
+
describe("Sum", () => {
|
|
4
|
+
describe("naive", () => {
|
|
5
|
+
expect(Sum.of([1])).toEqual(1);
|
|
6
|
+
expect(Sum.of([1, 2])).toEqual(3);
|
|
7
|
+
expect(Sum.of([1, 3, 6])).toEqual(10);
|
|
8
|
+
expect(Sum.of([0, 0, 0])).toEqual(0);
|
|
9
|
+
expect(Sum.of([])).toEqual(0);
|
|
10
|
+
expect(Sum.of([5, -2, -3])).toEqual(0);
|
|
11
|
+
expect(Sum.of([0.1, 0.2])).toBeCloseTo(0.3, 12);
|
|
12
|
+
});
|
|
13
|
+
test("precise", () => {
|
|
14
|
+
const values = [1e12, ...Array.from({ length: 1000 }, () => 1e-3)];
|
|
15
|
+
const naive = Sum.of(values);
|
|
16
|
+
const expected = 1e12 + 1;
|
|
17
|
+
const precise = Sum.precise(values);
|
|
18
|
+
expect(precise).toBeCloseTo(expected, 9);
|
|
19
|
+
expect(naive).toBeCloseTo(expected, 1);
|
|
20
|
+
expect(Math.abs(precise - expected)).toBeLessThanOrEqual(Math.abs(naive - expected));
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { ThousandsSeparator } from "../src/thousands-separator.service";
|
|
3
|
+
describe("ThousandsSeparator", () => {
|
|
4
|
+
test("default separator", () => {
|
|
5
|
+
const cases = [
|
|
6
|
+
[999, "999"],
|
|
7
|
+
[999.5, "999.5"],
|
|
8
|
+
[1000, "1 000"],
|
|
9
|
+
[1000.99, "1 000.99"],
|
|
10
|
+
[15000, "15 000"],
|
|
11
|
+
[15000.5, "15 000.5"],
|
|
12
|
+
[150000, "150 000"],
|
|
13
|
+
[150000.99, "150 000.99"],
|
|
14
|
+
[1500000, "1 500 000"],
|
|
15
|
+
[1500000.99, "1 500 000.99"],
|
|
16
|
+
[-1000, "-1 000"],
|
|
17
|
+
[-1500000.5, "-1 500 000.5"],
|
|
18
|
+
];
|
|
19
|
+
for (const [value, expected] of cases) {
|
|
20
|
+
expect(ThousandsSeparator.format(value)).toEqual(expected);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
test("custom separator", () => {
|
|
24
|
+
expect(ThousandsSeparator.format(150000.99, "_")).toEqual("150_000.99");
|
|
25
|
+
expect(ThousandsSeparator.format(-1234567.89, ",")).toEqual("-1,234,567.89");
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import * as v from "valibot";
|
|
3
|
+
import { TimeZoneOffsetValue } from "../src/time-zone-offset-value.vo";
|
|
4
|
+
describe("TimeZoneOffsetValue", () => {
|
|
5
|
+
test("happy path", () => {
|
|
6
|
+
expect(v.safeParse(TimeZoneOffsetValue, "720").success).toEqual(true);
|
|
7
|
+
expect(v.safeParse(TimeZoneOffsetValue, "-840").success).toEqual(true);
|
|
8
|
+
expect(v.safeParse(TimeZoneOffsetValue, "0").success).toEqual(true);
|
|
9
|
+
});
|
|
10
|
+
test("rejects - fractions", () => {
|
|
11
|
+
expect(() => v.parse(TimeZoneOffsetValue, "2.5")).toThrow("time.zone.offset.value.type");
|
|
12
|
+
});
|
|
13
|
+
test("rejects - min", () => {
|
|
14
|
+
expect(() => v.parse(TimeZoneOffsetValue, "-841")).toThrow("time.zone.offset.value.min");
|
|
15
|
+
});
|
|
16
|
+
test("rejects - max", () => {
|
|
17
|
+
expect(() => v.parse(TimeZoneOffsetValue, "721")).toThrow("time.zone.offset.value.max");
|
|
18
|
+
});
|
|
19
|
+
test("transforms invalid values to 0", () => {
|
|
20
|
+
// @ts-expect-error Value comparison
|
|
21
|
+
expect(v.parse(TimeZoneOffsetValue, undefined)).toEqual(0);
|
|
22
|
+
// @ts-expect-error Value comparison
|
|
23
|
+
expect(v.parse(TimeZoneOffsetValue, null)).toEqual(0);
|
|
24
|
+
// @ts-expect-error Value comparison
|
|
25
|
+
expect(v.parse(TimeZoneOffsetValue, "")).toEqual(0);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import * as v from "valibot";
|
|
3
|
+
import { TimestampValue } from "../src/timestamp-value.vo";
|
|
4
|
+
describe("TimestampValue", () => {
|
|
5
|
+
test("happy path", () => {
|
|
6
|
+
expect(v.safeParse(TimestampValue, 0).success).toEqual(true);
|
|
7
|
+
expect(v.safeParse(TimestampValue, Date.now()).success).toEqual(true);
|
|
8
|
+
});
|
|
9
|
+
test("rejects non-number - null", () => {
|
|
10
|
+
expect(() => v.parse(TimestampValue, null)).toThrow("timestamp.invalid");
|
|
11
|
+
});
|
|
12
|
+
test("rejects non-number - string", () => {
|
|
13
|
+
expect(() => v.parse(TimestampValue, "123")).toThrow("timestamp.invalid");
|
|
14
|
+
});
|
|
15
|
+
test("rejects negative numbers", () => {
|
|
16
|
+
expect(() => v.parse(TimestampValue, -1)).toThrow("timestamp.invalid");
|
|
17
|
+
});
|
|
18
|
+
test("rejects fractions", () => {
|
|
19
|
+
expect(() => v.parse(TimestampValue, 1.5)).toThrow("timestamp.invalid");
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|