From f8acff5f31bc3b215348635d8acf21da64a8755e Mon Sep 17 00:00:00 2001
From: David Gustafsson <david.gustafsson@ub.gu.se>
Date: Wed, 19 Oct 2022 16:11:15 +0200
Subject: [PATCH] Bug 31856: Add test for
 get_description_by_category_and_authorised_value

---
 t/db_dependent/AuthorisedValues.t | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/t/db_dependent/AuthorisedValues.t b/t/db_dependent/AuthorisedValues.t
index 91d3367e18f..2ccbae27723 100755
--- a/t/db_dependent/AuthorisedValues.t
+++ b/t/db_dependent/AuthorisedValues.t
@@ -140,7 +140,7 @@ my @categories = Koha::AuthorisedValues->new->categories;
 is( @categories, @existing_categories+3, 'There should have 3 categories inserted' );
 
 subtest 'search_by_*_field + find_by_koha_field + get_description + authorised_values' => sub {
-    plan tests => 6;
+    plan tests => 7;
 
     my $test_cat = Koha::AuthorisedValueCategories->find('TEST');
     $test_cat->delete if $test_cat;
@@ -248,6 +248,7 @@ subtest 'search_by_*_field + find_by_koha_field + get_description + authorised_v
             ],
         );
     };
+
     subtest 'authorised_values' => sub {
 
         plan tests => 2;
@@ -279,6 +280,23 @@ subtest 'search_by_*_field + find_by_koha_field + get_description + authorised_v
 
         $schema->storage->txn_rollback;
     };
+
+    subtest 'get_description_by_category_and_authorised_value' => sub {
+        plan tests => 1;
+        my $description = Koha::AuthorisedValues->get_description_by_category_and_authorised_value(
+            {
+                category => $av_0->category,,
+                authorised_value => $av_0->authorised_value,
+            }
+        );
+        is_deeply(
+            $description,
+            {
+                lib              => $av_0->lib,
+                opac_description => $av_0->lib_opac
+            }
+        );
+    };
 };
 
 $schema->storage->txn_rollback;
-- 
2.25.1