Skip to content

Commit

Permalink
Make temporal personae an object instead of array (+ add test)
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvinqian00 committed Dec 20, 2023
1 parent 33b2325 commit 54eaf0d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 17 deletions.
24 changes: 11 additions & 13 deletions dev-resources/personae/temporal.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
[
{
"name": "Singleton Group",
"objectType": "Group",
"member": [
{
"name": "Lain Iwakura",
"mbox": "mailto:[email protected]",
"role": "God of the Wired"
}
]
}
]
{
"name": "Singleton Group",
"objectType": "Group",
"member": [
{
"name": "Lain Iwakura",
"mbox": "mailto:[email protected]",
"role": "God of the Wired"
}
]
}
4 changes: 4 additions & 0 deletions src/cli/com/yetanalytics/datasim/cli/input.clj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
(def validated-input-desc
"The location of the validated input to be produced. If not provided, the validated input will be printed to stdout instead.")

;; TODO: Update `:profiles` input to accept both single objects and arrays.
;; TODO: Update `:personae-array` input to accept both single objects and arrays
;; (and rename to just `:personaes`).

;; NOTE: For the `validate-input` subcommand, we skip tools.cli validation and
;; do more in-depth validation involving combined inputs.
(def validate-input-options
Expand Down
6 changes: 5 additions & 1 deletion src/test/com/yetanalytics/datasim/input/personae_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@
(def tc3-personae
(dio/read-json-location const/tc3-personae-filepath))

(def temporal-personae
(dio/read-json-location const/temporal-personae-filepath))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Tests
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(deftest personae-test
(testing "personae without roles"
(is (nil? (personae/validate-personae simple-personae)))
(is (nil? (personae/validate-personae tc3-personae))))
(is (nil? (personae/validate-personae tc3-personae)))
(is (nil? (personae/validate-personae temporal-personae))))
(testing "personae with roles"
(is (nil? (-> simple-personae
(assoc-in [:member 0 :role] "Lead Developer")
Expand Down
6 changes: 3 additions & 3 deletions src/test/com/yetanalytics/datasim/test_constants.clj
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@
(def tc3-personae
(input/from-location :personae :json tc3-personae-filepath))

(def temporal-personaes
(input/from-location :personae-array :json temporal-personae-filepath))
(def temporal-personae
(input/from-location :personae :json temporal-personae-filepath))

;; Models

Expand Down Expand Up @@ -166,7 +166,7 @@
(zipmap temporal-models-filepath-coll*
(map (fn [temporal-model]
{:profiles [temporal-profile]
:personae-array temporal-personaes
:personae-array [temporal-personae]
:parameters temporal-parameters
:models temporal-model})
temporal-models-coll)))

0 comments on commit 54eaf0d

Please sign in to comment.