Skip to content

Commit

Permalink
Removed limit on admissionRequirements
Browse files Browse the repository at this point in the history
  • Loading branch information
mdemare committed Jun 12, 2024
1 parent dc10389 commit 3bf508e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/nl/surf/eduhub_rio_mapper/specs/common.clj
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@
(s/keys :req-un [::LanguageTypedString/language
::LanguageTypedString/value]))

(s/def ::LanguageTypedStringUnlimited
(s/keys :req-un [::LanguageTypedString/language
string?]))

(s/def ::LanguageTypedStringNL/language
#{"nl-NL" "nl-BE"})

Expand Down Expand Up @@ -107,6 +111,10 @@
(s/def ::LanguageTypedStrings
(s/coll-of ::LanguageTypedString))

;; A collection of language typed strings with any set of languages
(s/def ::LanguageTypedStringsUnlimited
(s/coll-of ::LanguageTypedStringUnlimited))

(s/def ::LongLanguageTypedString/language
(re-spec #"^[a-z]{2,4}(-[A-Z][a-z]{3})?(-([A-Z]{2}|[0-9]{3}))?$"))

Expand Down
2 changes: 1 addition & 1 deletion src/nl/surf/eduhub_rio_mapper/specs/program.clj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
(text-spec 1 40))

(s/def ::acceleratedRoute enums/acceleratedRoute)
(s/def ::admissionRequirements ::common/LanguageTypedStrings)
(s/def ::admissionRequirements ::common/LanguageTypedStringsUnlimited)
(s/def ::assessment ::common/LanguageTypedStrings)
(s/def ::children (s/coll-of ::common/uuid))
(s/def ::consentParticipationSTAP enums/consentParticipationSTAP)
Expand Down
5 changes: 5 additions & 0 deletions test/nl/surf/eduhub_rio_mapper/ooapi/program_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@
(let [{::s/keys [problems]} (s/explain-data ::prg/rio-consumer (assoc rio-consumer :educationOffererCode "123B123"))]
(is (= :educationOffererCode (-> problems first :path first)))))

(deftest dont-validate-admission-reqs
(let [{::s/keys [problems]} (s/explain-data ::prg/program (assoc-in program [:admissionRequirements 0 :value]
(apply str (take 1010 (repeatedly #(char (+ (rand-int 26) 97)))))))]
(is (contains? #{nil []} problems))))

(deftest validate-consumers
(let [{::s/keys [problems]} (s/explain-data ::prg/consumers [other-consumer rio-consumer])]
(is (contains? #{nil []} problems))))
Expand Down

0 comments on commit 3bf508e

Please sign in to comment.