diff src/layout/ViewConfig.test.ts @ 106:2468f2227d22

make src/layout/ and src/render/ separation
author drewp@bigasterisk.com
date Sun, 13 Mar 2022 22:00:30 -0700
parents src/ViewConfig.test.ts@ab7dca42afbd
children 2e8fa3fec0c8
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/layout/ViewConfig.test.ts	Sun Mar 13 22:00:30 2022 -0700
@@ -0,0 +1,25 @@
+import { Util } from "n3";
+import { ViewConfig } from "./ViewConfig";
+
+describe("ViewModel", () => {
+  it("gets a table description", async () => {
+    const vc = new ViewConfig();
+
+    await vc.readFromGraph(`
+        @prefix ex: <http://example.com/> .
+        @prefix demo: <http://example.com/demo/> .
+        @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+        @prefix : <http://bigasterisk.com/netRoutes/ns#> .
+
+        <> a ex:View ; rdfs:label "repos" .
+        <> ex:table demo:table1 .
+        demo:table1 
+        ex:primaryType :FilteredNic;
+        ex:joinType :Traffic .
+        `);
+    const NET = Util.prefix("http://bigasterisk.com/netRoutes/ns#");
+
+    expect(vc.tables[0].primary).toEqual(NET("FilteredNic"));
+    expect(vc.tables[0].joins).toEqual([NET("Traffic")]);
+  });
+});