diff src/ViewConfig.test.ts @ 102:ab7dca42afbd

rewrite ViewConfig
author drewp@bigasterisk.com
date Fri, 11 Mar 2022 23:19:35 -0800
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ViewConfig.test.ts	Fri Mar 11 23:19:35 2022 -0800
@@ -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")]);
+  });
+});