From 40fd866f0361900a3a407f891777c26263b787fe Mon Sep 17 00:00:00 2001 From: Robert Kenny Date: Tue, 3 Sep 2024 13:46:06 +0100 Subject: [PATCH] add tests --- .../rules/SierraRulesForRequestingTest.scala | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/common/source_model/src/test/scala/weco/catalogue/source_model/sierra/rules/SierraRulesForRequestingTest.scala b/common/source_model/src/test/scala/weco/catalogue/source_model/sierra/rules/SierraRulesForRequestingTest.scala index 35134be6db..aa1bf26f30 100644 --- a/common/source_model/src/test/scala/weco/catalogue/source_model/sierra/rules/SierraRulesForRequestingTest.scala +++ b/common/source_model/src/test/scala/weco/catalogue/source_model/sierra/rules/SierraRulesForRequestingTest.scala @@ -66,6 +66,22 @@ class SierraRulesForRequestingTest ) } + it("blocks an item if fixed field 108 (status) is n,a,p or u") { + List("n","a","p").map { status => + val item = createSierraItemDataWith( + fixedFields = Map("108" -> FixedField(label = "STATUS", value = status)) + ) + + SierraRulesForRequesting(item) shouldBe a[NotRequestable.NeedsManualRequest] + } + + val item = createSierraItemDataWith( + fixedFields = Map("108" -> FixedField(label = "STATUS", value = "u")) + ) + + SierraRulesForRequesting(item) shouldBe a[NotRequestable.ItemUnavailable] + } + it("does not block an item if fixed field 87 (loan rule) is zero") { val item = createSierraItemDataWith( fixedFields = Map("87" -> FixedField(label = "LOANRULE", value = "0"))