Move tests from form to main

This commit is contained in:
Marcus Kammer 2024-03-30 08:45:53 +01:00
parent 1a75d44062
commit 65ebe60def
2 changed files with 24 additions and 37 deletions

View file

@ -1,44 +1,10 @@
(defpackage dev.metalisp.sbt/tests/form
(:use
:cl
:dev.metalisp.sbt
:rove)
(:import-from
:dev.metalisp.sbt/component/form
:remove-special-chars
:clean-form-str
:build-name-str
:build-value-str
:build-value-prop-str
:ctrl
:combo
:combo-sm
:combo-lg
:search-form
:checkable))
(:use :cl
:dev.metalisp.sbt/component/form
:rove))
(in-package :dev.metalisp.sbt/tests/form)
(deftest test-remove-special-chars
(testing "Removes all special characters from the string STR except numbers and alphabets."
(ok (string= (remove-special-chars "a1b!@#$%^&*()c2") "a1bc2"))))
(deftest test-clean-form-str
(testing "Cleans a form string for use as a name or identifier."
(ok (string= (clean-form-str " hello WORLD") "hello-world"))))
(deftest test-build-name-str
(testing "Builds a standardized string by adding a 'group-' prefix and applying cleaning functions."
(ok (string= (build-name-str "somename") "group-somename"))))
(deftest test-build-value-str
(testing "Trims leading and trailing spaces from the given value string."
(ok (string= (build-value-str " hello-world ") "hello-world"))))
(deftest test-build-value-prop-str
(testing "Builds a value property string by applying various cleaning functions."
(ok (string= (build-value-prop-str " hello world ") "hello-world"))))
(deftest test-ctrl-number
(let ((result (spinneret:with-html-string (ctrl "number" "testform" "Birth Date"))))
(testing "Generates a basic Bootstrap form control with a label."

View file

@ -2,6 +2,7 @@
(:use :cl
:dev.metalisp.sbt
:rove))
(in-package :dev.metalisp.sbt/tests/main)
;; NOTE: To run this test file, execute `(asdf:test-system :dev.metalisp.sbt)' in your Lisp.
@ -13,3 +14,23 @@
(testing "Testing with-page macro"
(ok (search "<title>Example</title>" result))
(ok (search "<h2>Hello World</h2>" result)))))
(deftest test-remove-special-chars
(testing "Removes all special characters from the string STR except numbers and alphabets."
(ok (string= (remove-special-chars "a1b!@#$%^&*()c2") "a1bc2"))))
(deftest test-clean-form-str
(testing "Cleans a form string for use as a name or identifier."
(ok (string= (clean-form-str " hello WORLD") "hello-world"))))
(deftest test-build-name-str
(testing "Builds a standardized string by adding a 'group-' prefix and applying cleaning functions."
(ok (string= (build-name-str "somename") "group-somename"))))
(deftest test-build-value-str
(testing "Trims leading and trailing spaces from the given value string."
(ok (string= (build-value-str " hello-world ") "hello-world"))))
(deftest test-build-value-prop-str
(testing "Builds a value property string by applying various cleaning functions."
(ok (string= (build-value-prop-str " hello world ") "hello-world"))))