Add a couple property generator expansion tests.
authorDave Longley <dlongley@digitalbazaar.com>
Thu, 17 Jan 2013 20:10:11 -0500
changeset 1135 1cab0428b9f0
parent 1134 df7281d842b6
child 1136 9aed4242f72d
Add a couple property generator expansion tests.
test-suite/tests/expand-0049-in.jsonld
test-suite/tests/expand-0049-out.jsonld
test-suite/tests/expand-0050-in.jsonld
test-suite/tests/expand-0050-out.jsonld
test-suite/tests/expand-manifest.jsonld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/expand-0049-in.jsonld	Thu Jan 17 20:10:11 2013 -0500
@@ -0,0 +1,19 @@
+{
+  "@context": {
+    "site": "http://example.com/",
+    "field_tags": {
+      "@id": [ "site:vocab/field_tags", "http://schema.org/about" ]
+    },
+    "field_related": {
+      "@id": [ "site:vocab/field_related", "http://schema.org/about" ]
+    },
+    "value": "site:vocab/value"
+  },
+  "@id": "site:node/1",
+  "field_tags": [
+    { "@id": "site:term/this-is-a-tag", "value": {"@value": "foo"} }
+  ],
+  "field_related": [
+    { "@id": "site:node/this-is-related-news", "value": {"@value": "bar"} }
+  ]
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/expand-0049-out.jsonld	Thu Jan 17 20:10:11 2013 -0500
@@ -0,0 +1,18 @@
+[{
+   "@id": "http://example.com/node/1",
+   "http://example.com/vocab/field_related": [{
+      "@id": "http://example.com/node/this-is-related-news",
+      "http://example.com/vocab/value": [{"@value": "bar"}]
+   }],
+   "http://schema.org/about": [{
+      "@id": "http://example.com/node/this-is-related-news",
+      "http://example.com/vocab/value": [{"@value": "bar"}]
+   }, {
+      "@id": "http://example.com/term/this-is-a-tag",
+      "http://example.com/vocab/value": [{"@value": "foo"}]
+   }],
+   "http://example.com/vocab/field_tags": [{
+      "@id": "http://example.com/term/this-is-a-tag",
+      "http://example.com/vocab/value": [{"@value": "foo"}]
+   }]
+}]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/expand-0050-in.jsonld	Thu Jan 17 20:10:11 2013 -0500
@@ -0,0 +1,20 @@
+{
+  "@context": {
+    "site": "http://example.com/",
+    "field_tags": {
+      "@id": [ "site:vocab/field_tags", "http://schema.org/about" ]
+    },
+    "field_related": {
+      "@id": [ "site:vocab/field_related", "http://schema.org/about" ]
+    }
+  },
+  "@graph": {
+    "@id": "site:node/1",
+    "field_tags": [
+      { "@id": "site:term/this-is-a-tag" }
+    ],
+    "field_related": [
+      { "@id": "site:node/this-is-related-news" }
+    ]
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-suite/tests/expand-0050-out.jsonld	Thu Jan 17 20:10:11 2013 -0500
@@ -0,0 +1,14 @@
+[{
+   "@id": "http://example.com/node/1",
+   "http://example.com/vocab/field_related": [{
+      "@id": "http://example.com/node/this-is-related-news"
+   }],
+   "http://schema.org/about": [{
+      "@id": "http://example.com/node/this-is-related-news"
+   }, {
+      "@id": "http://example.com/term/this-is-a-tag"
+   }],
+   "http://example.com/vocab/field_tags": [{
+      "@id": "http://example.com/term/this-is-a-tag"
+   }]
+}]
--- a/test-suite/tests/expand-manifest.jsonld	Thu Jan 17 11:54:57 2013 -0500
+++ b/test-suite/tests/expand-manifest.jsonld	Thu Jan 17 20:10:11 2013 -0500
@@ -246,6 +246,16 @@
       "name": "Terms are ignored in @id",
       "input": "expand-0048-in.jsonld",
       "expect": "expand-0048-out.jsonld"
+    }, {
+      "@type": ["test:TestCase", "jld:ExpandTest"],
+      "name": "Do not add @id to @value objects when expanding property generators",
+      "input": "expand-0049-in.jsonld",
+      "expect": "expand-0049-out.jsonld"
+    }, {
+      "@type": ["test:TestCase", "jld:ExpandTest"],
+      "name": "Property generator works with @graph key",
+      "input": "expand-0050-in.jsonld",
+      "expect": "expand-0050-out.jsonld"
     }
   ]
 }