From cc39da7a44c59acbe910fb412332c66a98a210da Mon Sep 17 00:00:00 2001 From: Matthew Bernhardt Date: Thu, 9 Jan 2025 13:19:22 -0500 Subject: [PATCH] Add barcode regex to standard identifier This causes one test to need a new count. Fixup standard_identifiers --- app/models/detector/standard_identifiers.rb | 1 + test/models/detector/bulk_checker_test.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/detector/standard_identifiers.rb b/app/models/detector/standard_identifiers.rb index c9b0891..0f5b73a 100644 --- a/app/models/detector/standard_identifiers.rb +++ b/app/models/detector/standard_identifiers.rb @@ -52,6 +52,7 @@ def self.record(term) # patterns are regex patterns to be applied to the basic search box input def patterns { + barcode: /^39080[0-9]{9}$/, isbn: /\b(ISBN-*(1[03])* *(: ){0,1})*(([0-9Xx][- ]*){13}|([0-9Xx][- ]*){10})\b/, issn: /\b[0-9]{4}-[0-9]{3}[0-9xX]\b/, pmid: /\b((pmid|PMID):\s?(\d{7,8}))\b/, diff --git a/test/models/detector/bulk_checker_test.rb b/test/models/detector/bulk_checker_test.rb index e621786..6017336 100644 --- a/test/models/detector/bulk_checker_test.rb +++ b/test/models/detector/bulk_checker_test.rb @@ -25,7 +25,7 @@ class CitationTest < ActiveSupport::TestCase test 'standard_identifier_bulk_checker' do bulk = Detector::StandardIdentifiers.check_all_matches(output: true) - assert_equal(5, bulk.count) + assert_equal(6, bulk.count) end test 'suggested_resources_bulk_checker' do