mirror of
https://github.com/penpot/penpot.git
synced 2026-09-16 17:06:17 +00:00
* ✨ Add expires-in option to create-demo-profile Allow passing an optional expires-in duration when creating a demo profile so its purge is scheduled sooner than the global deletion delay. Values below 5 minutes or above the global delay are rejected with an invalid-expires-in validation error, resolved before any profile is created. Closes #11573 AI-assisted-by: muse-spark-1.3-contributor * 🐛 Make duration schema decoding total instead of throwing parse-duration returned by the duration schema decoder threw DateTimeParseException on invalid strings, escaping params validation as a raw error. It now returns the input unchanged so invalid values fail the duration predicate with a clean params-validation error. Closes #11573 AI-assisted-by: muse-spark-1.3-contributor * 📎 Fix doc version for expires-in change entry The expires-in change entry was documented under 2.20 but the current version is 2.18. AI-assisted-by: muse-spark-1.3-contributor
31 lines
1.1 KiB
Clojure
31 lines
1.1 KiB
Clojure
;; This Source Code Form is subject to the terms of the Mozilla Public
|
|
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
;;
|
|
;; Copyright (c) KALEIDOS INC Sucursal en España SL
|
|
|
|
(ns common-tests.time-test
|
|
(:require
|
|
[app.common.time :as dt]
|
|
[clojure.test :as t]))
|
|
|
|
(t/deftest compare-time
|
|
(let [dta (dt/inst 10000)
|
|
dtb (dt/inst 20000)]
|
|
(t/is (false? (dt/is-after? dta dtb)))
|
|
(t/is (true? (dt/is-before? dta dtb)))))
|
|
|
|
#?(:clj
|
|
(t/deftest parse-duration-test
|
|
(t/is (dt/duration? (dt/parse-duration "10m")))
|
|
(t/is (= (dt/duration "10m") (dt/parse-duration "10m")))
|
|
(t/is (= (dt/duration "1h") (dt/parse-duration "1h")))
|
|
|
|
;; Invalid values are returned unchanged instead of throwing, so
|
|
;; they fail the `duration?` schema predicate with a clean
|
|
;; validation error downstream.
|
|
(t/is (= "yes" (dt/parse-duration "yes")))
|
|
(t/is (not (dt/duration? (dt/parse-duration "yes"))))
|
|
(t/is (= true (dt/parse-duration true)))
|
|
(t/is (not (dt/duration? (dt/parse-duration true))))))
|