Add test for Bonanza Produce invoice 03882095
Validates existing template correctly parses multi-page invoice with: - Invoice number 03882095 - Customer identifier NICK THE GREEK - Account number 600 VISTA WAY - Total of $946.24
This commit is contained in:
BIN
dev-resources/INVOICE - 03882095.pdf
Executable file
BIN
dev-resources/INVOICE - 03882095.pdf
Executable file
Binary file not shown.
@@ -51,3 +51,22 @@
|
||||
(is (= "720.33" (:total (nth results 1))))
|
||||
(is (= "853.16" (:total (nth results 2))))
|
||||
(is (= "1066.60" (:total (nth results 3)))))))
|
||||
|
||||
(deftest parse-bonanza-produce-invoice-03882095
|
||||
(testing "Should parse Bonanza Produce invoice 03882095 with customer identifier including address"
|
||||
(let [pdf-file (io/file "dev-resources/INVOICE - 03882095.pdf")
|
||||
pdf-text (:out (clojure.java.shell/sh "pdftotext" "-layout" (str pdf-file) "-"))
|
||||
results (sut/parse pdf-text)
|
||||
result (first results)]
|
||||
(is (some? results) "parse should return a result")
|
||||
(is (some? result) "Template should match and return a result")
|
||||
(when result
|
||||
(is (= "Bonanza Produce" (:vendor-code result)))
|
||||
(is (= "03882095" (:invoice-number result)))
|
||||
(let [d (:date result)]
|
||||
(is (= 2026 (time/year d)))
|
||||
(is (= 1 (time/month d)))
|
||||
(is (= 23 (time/day d))))
|
||||
(is (= "NICK THE GREEK" (:customer-identifier result)))
|
||||
(is (= "600 VISTA WAY" (str/trim (:account-number result))))
|
||||
(is (= "946.24" (:total result)))))))
|
||||
|
||||
Reference in New Issue
Block a user