summaryrefslogtreecommitdiff
path: root/models/fertilizer-product.rkt
diff options
context:
space:
mode:
Diffstat (limited to 'models/fertilizer-product.rkt')
-rw-r--r--models/fertilizer-product.rkt35
1 files changed, 17 insertions, 18 deletions
diff --git a/models/fertilizer-product.rkt b/models/fertilizer-product.rkt
index 652b3c4..5d81681 100644
--- a/models/fertilizer-product.rkt
+++ b/models/fertilizer-product.rkt
@@ -189,41 +189,41 @@
"../db/migrations.rkt"
"../models/nutrient.rkt")
- (define canonical-product-name "MasterBlend 4-20")
+ (define canonical-product-name "ExampleBlend 4-20")
(run-tests
(test-suite "Fertilizer product model"
#:before (λ ()
(connect! #:path 'memory)
(migrate-all!)
- (create-nutrient! "Nitrogen" "Azote" "N")
- (create-nutrient! "Phosphorus" "Phosphore" "P")
- (create-nutrient! "Potassium" "Potassium" "K"))
+ (create-nutrient! "Examplium" "Examplium" "Ex")
+ (create-nutrient! "Ignorium" "Ignorium" "Ig")
+ (create-nutrient! "Testium" "Testium" "Ts"))
#:after (λ () (disconnect!))
(test-case "Create product with name, brand, and values"
- (define nitrogen (get-nutrient #:name "Nitrogen"))
- (define phosphorus (get-nutrient #:name "Phosphorus"))
+ (define examplium (get-nutrient #:name "Examplium"))
+ (define ignorium (get-nutrient #:name "Ignorium"))
(create-fertilizer-product! canonical-product-name
- "MasterBlend"
- (hash nitrogen 40 phosphorus 200))
+ "ExampleBrand"
+ (hash examplium 40 ignorium 200))
(check-equal? (length (get-fertilizer-products)) 1)
(define fp (get-fertilizer-product #:canonical-name canonical-product-name))
(check-true (fertilizer-product? fp))
(check-equal? (fertilizer-product-canonical-name fp) canonical-product-name)
- (check-equal? (fertilizer-product-brand-name fp) "MasterBlend"))
+ (check-equal? (fertilizer-product-brand-name fp) "ExampleBrand"))
(test-case "Check all product values"
- (define nitrogen (get-nutrient #:name "Nitrogen"))
- (define phosphorus (get-nutrient #:name "Phosphorus"))
+ (define examplium (get-nutrient #:name "Examplium"))
+ (define ignorium (get-nutrient #:name "Ignorium"))
(define fp (get-fertilizer-product #:canonical-name canonical-product-name))
- (check-= (get-fertilizer-product-value fp nitrogen) 40 0)
- (check-= (get-fertilizer-product-value fp phosphorus) 200 0)
+ (check-= (get-fertilizer-product-value fp examplium) 40 0)
+ (check-= (get-fertilizer-product-value fp ignorium) 200 0)
(define fpv (fertilizer-product-nutrient-values fp))
@@ -240,13 +240,13 @@
(check-equal? fp fp-by-id))
(test-case "Handle missing nutrient in product"
- (define potassium (get-nutrient #:name "Potassium"))
+ (define testium (get-nutrient #:name "Testium"))
(define fp (get-fertilizer-product #:canonical-name canonical-product-name))
- (check-false (get-fertilizer-product-value fp potassium)))
+ (check-false (get-fertilizer-product-value fp testium)))
(test-case "Custom write property formatting"
- (define nitrogen (get-nutrient #:name "Nitrogen"))
- (define fp (create-fertilizer-product! "Test Fertilizer" "TestBrand" (hash nitrogen 50)))
+ (define examplium (get-nutrient #:name "Examplium"))
+ (define fp (create-fertilizer-product! "Test Fertilizer" "TestBrand" (hash examplium 50)))
(define output (open-output-string))
(write fp output)
@@ -255,7 +255,6 @@
(check-true (string-contains? result "Fertilizer #"))
(check-true (string-contains? result "Test Fertilizer"))
(check-true (string-contains? result "TestBrand")))
-
(test-case "Delete product and cascade to product values"
(define fp (get-fertilizer-product #:canonical-name canonical-product-name))
(delete-fertilizer-product! fp)
Copyright 2019--2026 Marius PETER