-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test the applicablePredicates utility function (#455)
- Loading branch information
1 parent
ac9c306
commit ec448ea
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { constant } from 'lodash'; | ||
|
||
import { startStore, endStore } from '../test-util'; | ||
import mockOntology from '../mock-data/mock-ontology'; | ||
|
||
import ldChannel from '../common-rdf/radio'; | ||
import { readit, skos } from '../common-rdf/ns'; | ||
import Node from '../common-rdf/node'; | ||
import Graph from '../common-rdf/graph'; | ||
|
||
import { applicablePredicates } from './relation-utilities'; | ||
|
||
describe('relation utilities', function() { | ||
beforeEach(startStore); | ||
|
||
beforeEach(function() { | ||
const ontology = new Graph(mockOntology); | ||
ldChannel.reply('ontology:graph', constant(ontology)); | ||
}); | ||
|
||
afterEach(function() { | ||
ldChannel.stopReplying('ontology:graph'); | ||
}); | ||
|
||
afterEach(endStore); | ||
|
||
describe('applicablePredicates', function() { | ||
it('returns the predicates applicable to a given class', function() { | ||
const Reader = ldChannel.request('obtain', readit('Reader')); | ||
const predicates = applicablePredicates(Reader); | ||
expect(predicates.length).toBe(2); | ||
expect(predicates.at(0).get(skos.prefLabel)).toBe('description of'); | ||
expect(predicates.at(1).get(skos.prefLabel)).toBe('inverse of description of'); | ||
}); | ||
}); | ||
}); |