diff --git a/src/test/clj/org/domaindrivenarchitecture/activity_pub_poc/parser_test.clj b/src/test/clj/org/domaindrivenarchitecture/activity_pub_poc/parser_test.clj new file mode 100644 index 0000000..26f0025 --- /dev/null +++ b/src/test/clj/org/domaindrivenarchitecture/activity_pub_poc/parser_test.clj @@ -0,0 +1,27 @@ +(ns org.domaindrivenarchitecture.activity-pub-poc.parser-test + (:require [clojure.test :refer :all] + [org.domaindrivenarchitecture.activity-pub-poc.parser :as sut])) + + +(def processed (slurp "src/test/resources/deleted_comments_minimal.ttl")) +(def expected-definitions ["@prefix : " + "@prefix as: " + "@prefix owl: " + "@prefix rdf: " + "@prefix xml: " + "@prefix xsd: " + "@prefix rdfs: " + "@base " + " a owl:Ontology ; rdfs:comment \"Extended Activity Streams 2.0 Vocabulary\"@en ; rdfs:label \"Activity Streams 2.0\"@en ; owl:imports " + "rdf:langString a rdfs:Datatype" + "xsd:duration a rdfs:Datatype"]) + +(deftest remove-comments-test + (is + (= processed + (sut/delete-comments-and-newlines "src/test/resources/minimal.ttl")))) + +((deftest find-definitions-test + (testing "Finding definitons" + (is (= expected-definitions + (sut/find-definitions processed)))))) \ No newline at end of file diff --git a/src/test/resources/deleted_comments_minimal.ttl b/src/test/resources/deleted_comments_minimal.ttl new file mode 100644 index 0000000..664788a --- /dev/null +++ b/src/test/resources/deleted_comments_minimal.ttl @@ -0,0 +1 @@ +@prefix : .@prefix as: .@prefix owl: .@prefix rdf: .@prefix xml: .@prefix xsd: .@prefix rdfs: .@base . a owl:Ontology ; rdfs:comment "Extended Activity Streams 2.0 Vocabulary"@en ; rdfs:label "Activity Streams 2.0"@en ; owl:imports .rdf:langString a rdfs:Datatype .xsd:duration a rdfs:Datatype . \ No newline at end of file diff --git a/src/test/resources/minimal.ttl b/src/test/resources/minimal.ttl new file mode 100644 index 0000000..583aaee --- /dev/null +++ b/src/test/resources/minimal.ttl @@ -0,0 +1,30 @@ +# Downloaded from https://www.w3.org/ns/activitystreams-owl + +@prefix : . +@prefix as: . +@prefix owl: . +@prefix rdf: . +@prefix xml: . +@prefix xsd: . +@prefix rdfs: . +@base . + + a owl:Ontology ; + rdfs:comment "Extended Activity Streams 2.0 Vocabulary"@en ; + rdfs:label "Activity Streams 2.0"@en ; + owl:imports . + +################################################################# +# +# Datatypes +# +################################################################# + +rdf:langString a rdfs:Datatype . +xsd:duration a rdfs:Datatype . + +################################################################# +# +# Object Properties +# +################################################################# \ No newline at end of file