Skip to content

Commit

Permalink
add unit test for zombie mapping count
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Nov 2, 2024
1 parent 143fa1c commit f523fd5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/models/test_mappings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,21 @@ def self.ontologies_parse
process_rdf: true, extract_metadata: false)
end

def test_mapping_count_delete
assert create_count_mapping > 2, 'Mapping count should exceed the value of 2'

counts = LinkedData::Models::MappingCount.where.include(:ontologies).all.map(&:ontologies)

assert(counts.any? { |x| x.include?(ONT_ACR4) }, 'Mapping count of ONT_ACR4 should exist')

LinkedData::Models::Ontology.find(ONT_ACR4).first.delete

LinkedData::Mappings.create_mapping_counts(Logger.new(TestLogFile.new))

counts = LinkedData::Models::MappingCount.where.include(:ontologies).all.map(&:ontologies)
refute(counts.any? { |x| x.include?(ONT_ACR4) }, 'Mapping count of deleted ontologies should not exist anymore')
end

def test_mapping_count_models
LinkedData::Models::MappingCount.where.all(&:delete)

Expand Down

0 comments on commit f523fd5

Please sign in to comment.