Skip to content

Commit

Permalink
feat: add unit test for CLASS term
Browse files Browse the repository at this point in the history
  • Loading branch information
cybersiddhu committed Sep 10, 2018
1 parent cc25566 commit 75b2799
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions graph/graph_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,58 @@ func getReader() (io.Reader, error) {
)
}

func TestGraphClassTerm(t *testing.T) {
r, err := getReader()
if err != nil {
t.Fatal(err)
}
g, err := BuildGraph(r)
if err != nil {
t.Fatal(err)
}
term := "SO_0000340"
if !g.ExistsTerm(NodeID(term)) {
t.Fatalf("unable to find term %s", term)
}
cht := g.GetTerm(NodeID(term))
if cht.ID() != NodeID(term) {
t.Fatalf("did not match term %s with id %s", term, cht.ID())
}
if cht.Label() != "chromosome" {
t.Fatalf("expected label chromosome does not match %s", cht.Label())
}
if cht.RdfType() != "CLASS" {
t.Fatalf("expected type CLASS does not match %s", cht.RdfType())
}
if cht.IRI() != "http://purl.obolibrary.org/obo/SO_0000340" {
t.Fatalf("did not match term %s with iri %s", term, cht.IRI())
}
s := cht.Meta().Subsets()
if len(s) < 1 {
t.Fatal("expected subset metadata is absent")
}
if m, _ := regexp.MatchString("SOFA", s[0]); !m {
t.Fatalf("expected subset does not match %s", s[0])
}
p := cht.Meta().BasicPropertyValues()
if len(p) < 1 {
t.Fatal("expected basic propertyvalue metadata is absent")
}
if p[0].Value() != "sequence" {
t.Fatalf("expected basic propertyvalue of sequence does not match %s", p[0].Value())
}
if cht.Meta().Namespace() != "sequence" {
t.Fatalf("expected namespace of sequence does not match %s", cht.Meta().Namespace())
}
cm := cht.Meta().Comments()
if len(cm) < 1 {
t.Fatal("expected comment is absent")
}
if m, _ := regexp.MatchString("MGED", cm[0]); !m {
t.Fatalf("expected comment does not match %s", cm[0])
}
}

func TestGraphPropertyTerm(t *testing.T) {
r, err := getReader()
if err != nil {
Expand Down

0 comments on commit 75b2799

Please sign in to comment.