diff src/layout/ViewConfig.test.ts @ 122:2e8fa3fec0c8

support joining subjects into wider rows
author drewp@bigasterisk.com
date Sun, 20 Mar 2022 14:12:03 -0700
parents 2468f2227d22
children
line wrap: on
line diff
--- a/src/layout/ViewConfig.test.ts	Sun Mar 20 14:10:56 2022 -0700
+++ b/src/layout/ViewConfig.test.ts	Sun Mar 20 14:12:03 2022 -0700
@@ -1,4 +1,5 @@
 import { Util } from "n3";
+import { EX } from "./namespaces";
 import { ViewConfig } from "./ViewConfig";
 
 describe("ViewModel", () => {
@@ -13,7 +14,7 @@
 
         <> a ex:View ; rdfs:label "repos" .
         <> ex:table demo:table1 .
-        demo:table1 
+        demo:table1
         ex:primaryType :FilteredNic;
         ex:joinType :Traffic .
         `);
@@ -22,4 +23,18 @@
     expect(vc.tables[0].primary).toEqual(NET("FilteredNic"));
     expect(vc.tables[0].joins).toEqual([NET("Traffic")]);
   });
+  it("gets pred joins", async () => {
+    const vc = new ViewConfig();
+    await vc.readFromGraph(`
+    @prefix ex: <http://example.com/> .
+    @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+    @prefix : <http://example.com/> .
+
+    <> a :View; :table [
+      :primaryType :T1;
+      :link [:predicate :predLink; :rtype :T2 ] ] .
+  `);
+    expect(vc.tables[0].primary).toEqual(EX("T1"));
+    expect(vc.tables[0].links).toEqual([{ pred: EX("predLink") }]);
+  });
 });