Skip to content

Commit

Permalink
Fix test cases to handle nilable source and presence of source-date
Browse files Browse the repository at this point in the history
  • Loading branch information
egli committed Jan 29, 2025
1 parent 28e0372 commit e9d0e51
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
6 changes: 3 additions & 3 deletions test/clj/daisyproducer2/test/abacus_import/core_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
production-series-number reihe aufwand daisy-producer])
(defrecord Imported [product-number product-type
title author publisher date source language
source-publisher source-edition
source-publisher source-edition source-date
production-series production-series-number production-source
daisyproducer?])

Expand Down Expand Up @@ -45,7 +45,7 @@

(testing "Read XML"
(let [document (->Imported "EB11111" :ebook "Eine für de Thesi" "Gwerder, Anna" "SBS Schweizerische Bibliothek für Blinde, Seh- und Lesebehinderte"
(time/local-date "2011-12-23") "" "de" "DVA" "1. / 2011" "" "" "" false)]
(time/local-date "2011-12-23") nil "de" "DVA" "1. / 2011" (time/local-date 2011) "" "" "" false)]
(are [expected actual] (= (into {} expected) (read-xml (xml/sexp-as-element (xml-sample actual))))
document (->Raw "EB11111" "Eine für de Thesi" "Gwerder, Anna" "de" "" "2011-12-23" "DVA" "1. / 2011" 0 "" "" "nein")
(assoc document :daisyproducer? true) (->Raw "EB11111" "Eine für de Thesi" "Gwerder, Anna" "de" "" "2011-12-23" "DVA" "1. / 2011" 0 "" "" "ja")
Expand All @@ -68,7 +68,7 @@
(testing "Read a file"
(let [sample (io/file (io/resource "SN_Alfresco_EB11111.xml"))]
(is (= (into {} (->Imported "EB11111" :ebook "Eine für de Thesi" "Gwerder, Anna" "SBS Schweizerische Bibliothek für Blinde, Seh- und Lesebehinderte"
(time/local-date "2011-12-23") "" "de" "DVA" "1. / 2011" "" "" "electronicData" true))
(time/local-date "2011-12-23") nil "de" "DVA" "1. / 2011" (time/local-date 2011) "" "" "electronicData" true))
(read-file sample)))))))

(deftest abacus-import-document
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
[sample import-gen]
(let [input (apply ->Raw sample)
imported (read-xml (xml/sexp-as-element (xml-sample input)))]
(is (:source imported))
(is (#{:braille :large-print :ebook :etext} (:product-type imported)))
(is (#{"" "PPP" "SJW"} (:production-series imported)))
(is (#{"de" "de-CH" "it" "rm-sursilv"} (:language imported)))
Expand Down

0 comments on commit e9d0e51

Please sign in to comment.