mirror of
https://github.com/penpot/penpot.git
synced 2026-11-07 10:30:40 +00:00
Preserve explicit quick-check options and read PENPOT_GEN_NUM and PENPOT_GEN_SEED when callers leave them unset. Print the final shrunk counterexample in full so failures can be replayed. The new regressions failed before the fix and now pass on the JVM. Common lint and the full JVM/JS suites pass. Format checks pass for these files; the in-progress Phase 4 harness remains outside this commit. AI-assisted-by: GPT-6
32 lines
1.1 KiB
Clojure
32 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 SUBSIDIARY SL
|
|
|
|
(ns common-tests.schema-check-test
|
|
(:require
|
|
[app.common.schema.test :as smt]
|
|
[clojure.string :as str]
|
|
[clojure.test :as t]
|
|
[clojure.test.check.generators :as gen]))
|
|
|
|
(t/deftest check-preserves-size-and-seed
|
|
(let [seen (atom [])
|
|
property (smt/for [size (gen/sized gen/return)]
|
|
(swap! seen conj size)
|
|
true)
|
|
run (fn []
|
|
(reset! seen [])
|
|
(smt/check! property :num 4 :max-size 1 :seed 712)
|
|
@seen)]
|
|
(t/is (= (run) (run)))
|
|
(t/is (every? zero? @seen))))
|
|
|
|
(t/deftest failure-reports-the-shrunk-case
|
|
(let [output (with-out-str
|
|
(smt/default-reporter-fn
|
|
{:type :shrunk :seed 712 :shrunk {:smallest [10]}}))]
|
|
(t/is (str/includes? output "712"))
|
|
(t/is (str/includes? output ":smallest [10]"))))
|