@saltcorn/builder 0.9.4-beta.0 → 0.9.4-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,6 +18,7 @@ import FontIconPicker from "@fonticonpicker/react-fonticonpicker";
18
18
  import faIcons from "./faicons";
19
19
  import { Columns, ntimes } from "./Columns";
20
20
  import Tippy from "@tippyjs/react";
21
+ import { RelationType } from "@saltcorn/common-code";
21
22
 
22
23
  export const DynamicFontAwesomeIcon = ({ icon, className }) => {
23
24
  if (!icon) return null;
@@ -445,6 +446,10 @@ const fetchPreview = ({ url, body, options, setPreviews, node_id, isView }) => {
445
446
  }
446
447
  const newHtml = $(".preview-scratchpad").html();
447
448
  setPreviews((prevState) => ({ ...prevState, [node_id]: newHtml }));
449
+ })
450
+ .catch((e) => {
451
+ console.log("Unable to fetch the preview:");
452
+ console.log(e);
448
453
  });
449
454
  };
450
455
 
@@ -1245,12 +1250,20 @@ const ButtonOrLinkSettingsRows = ({
1245
1250
  <option value={addBtnClass("btn-secondary")}>Secondary button</option>
1246
1251
  <option value={addBtnClass("btn-success")}>Success button</option>
1247
1252
  <option value={addBtnClass("btn-danger")}>Danger button</option>
1253
+ <option value={addBtnClass("btn-warning")}>Warning button</option>
1254
+ <option value={addBtnClass("btn-info")}>Info button</option>
1248
1255
  <option value={addBtnClass("btn-outline-primary")}>
1249
1256
  Primary outline button
1250
1257
  </option>
1251
1258
  <option value={addBtnClass("btn-outline-secondary")}>
1252
1259
  Secondary outline button
1253
1260
  </option>
1261
+ <option value={addBtnClass("btn-outline-warning")}>
1262
+ Warning outline button
1263
+ </option>{" "}
1264
+ <option value={addBtnClass("btn-outline-info")}>
1265
+ Info outline button
1266
+ </option>
1254
1267
  <option value={addBtnClass("btn-custom-color")}>
1255
1268
  Button custom color
1256
1269
  </option>
@@ -1439,22 +1452,6 @@ const Tooltip = ({ children }) => {
1439
1452
  );
1440
1453
  };
1441
1454
 
1442
- export const buildTableCaches = (allTables) => {
1443
- const tableIdCache = {};
1444
- const tableNameCache = {};
1445
- const fieldCache = {};
1446
- for (const table of allTables) {
1447
- tableIdCache[table.id] = table;
1448
- tableNameCache[table.name] = table;
1449
- for (const field of table.foreign_keys) {
1450
- if (!fieldCache[field.reftable_name])
1451
- fieldCache[field.reftable_name] = [];
1452
- fieldCache[field.reftable_name].push(field);
1453
- }
1454
- }
1455
- return { tableIdCache, tableNameCache, fieldCache };
1456
- };
1457
-
1458
1455
  export const removeWhitespaces = (str) => {
1459
1456
  return str.replace(/\s/g, "X");
1460
1457
  };
@@ -1497,79 +1494,145 @@ export const buildBootstrapOptions = (values) => {
1497
1494
  ));
1498
1495
  };
1499
1496
 
1500
- export const prepCacheAndFinder = ({
1501
- tables,
1502
- views,
1503
- max_relations_layer_depth,
1504
- }) => {
1505
- if (tables && views) {
1506
- const caches = buildTableCaches(tables);
1507
- const finder = new relationHelpers.RelationsFinder(
1508
- caches,
1509
- views,
1510
- max_relations_layer_depth || 6
1511
- );
1512
- return { caches, finder };
1513
- } else return { caches: null, finder: null };
1497
+ export const arrayChunks = (xs, n) => {
1498
+ const arrayOfArrays = [];
1499
+ for (var i = 0; i < bigarray.length; i += n) {
1500
+ arrayOfArrays.push(bigarray.slice(i, i + n));
1501
+ }
1502
+ return arrayOfArrays;
1514
1503
  };
1515
1504
 
1516
1505
  /**
1517
- * @param {string[]} paths
1506
+ * @param {string[]} relations
1518
1507
  * @param {string} sourceTbl name of the topview table
1519
1508
  * @returns either a same table relation, a parent relation, a child relation, or the first relation
1520
1509
  */
1521
- export const initialRelation = (paths, sourceTbl) => {
1510
+ export const initialRelation = (relations) => {
1522
1511
  let sameTblRel = null;
1523
1512
  let parentRel = null;
1524
1513
  let childRel = null;
1525
- for (const path of paths) {
1526
- if (!sameTblRel && path === `.${sourceTbl}`) sameTblRel = path;
1527
- else {
1528
- const tokens = path.split(".");
1529
- if (
1530
- !parentRel &&
1531
- tokens.length === 3 &&
1532
- tokens[1] === sourceTbl &&
1533
- tokens[2].indexOf("$") === -1
1534
- )
1535
- parentRel = path;
1536
- else {
1537
- const lastToken = tokens[tokens.length - 1];
1538
- if (
1539
- lastToken.indexOf("$") > 0 &&
1540
- (!childRel || childRel.split(".").length > tokens.length)
1541
- )
1542
- childRel = path;
1543
- }
1514
+ for (const relation of relations) {
1515
+ switch (relation.type) {
1516
+ case RelationType.OWN:
1517
+ sameTblRel = relation;
1518
+ break;
1519
+ case RelationType.PARENT_SHOW:
1520
+ parentRel = relation;
1521
+ break;
1522
+ case RelationType.CHILD_LIST:
1523
+ case RelationType.ONE_TO_ONE_SHOW:
1524
+ childRel = relation;
1525
+ break;
1544
1526
  }
1545
1527
  }
1546
- return sameTblRel || parentRel || childRel || paths[0];
1528
+ return sameTblRel || parentRel || childRel || relations[0];
1547
1529
  };
1548
1530
 
1549
1531
  /**
1550
- * update the builder wide relations cache relations cache
1551
- * if there is no entry for the given tableName and viewname
1552
- * @param {any} relationsCache cache from the context
1553
- * @param {Function} setRelationsCache set cache in context
1554
- * @param {any} options builder options
1555
- * @param {RelationsFinder} finder
1556
- * @param {string} viewname subview name
1532
+ * builder intern path method
1533
+ * @param path
1534
+ * @param tableNameCache
1535
+ * @returns
1557
1536
  */
1558
- export const updateRelationsCache = (
1559
- relationsCache,
1560
- setRelationsCache,
1561
- options,
1562
- finder,
1563
- viewname
1564
- ) => {
1565
- if (!relationsCache[options.tableName])
1566
- relationsCache[options.tableName] = {};
1567
- if (!relationsCache[options.tableName][viewname]) {
1568
- relationsCache[options.tableName][viewname] = finder.findRelations(
1569
- options.tableName,
1570
- viewname,
1571
- options.excluded_subview_templates
1572
- );
1573
- setRelationsCache({ ...relationsCache });
1537
+ export const buildRelationArray = (path, tableNameCache) => {
1538
+ if (path === ".")
1539
+ return [{ type: "Independent", table: "None (no relation)" }];
1540
+ const tokens = path.split(".");
1541
+ if (tokens.length === 2)
1542
+ return [{ type: "Own", table: `${tokens[1]} (same table)` }];
1543
+ else if (tokens.length >= 3) {
1544
+ const result = [];
1545
+ let currentTbl = tokens[1];
1546
+ for (const relation of tokens.slice(2)) {
1547
+ if (relation.indexOf("$") > 0) {
1548
+ const [inboundTbl, inboundKey] = relation.split("$");
1549
+ result.push({ type: "Inbound", table: inboundTbl, key: inboundKey });
1550
+ currentTbl = inboundTbl;
1551
+ } else {
1552
+ const srcTbl = tableNameCache[currentTbl];
1553
+ const fk = srcTbl.foreign_keys.find((fk) => fk.name === relation);
1554
+ if (fk) {
1555
+ const targetTbl = tableNameCache[fk.reftable_name];
1556
+ result.push({
1557
+ type: "Foreign",
1558
+ table: targetTbl.name,
1559
+ key: relation,
1560
+ });
1561
+ currentTbl = targetTbl.name;
1562
+ }
1563
+ }
1564
+ }
1565
+ return result;
1566
+ }
1567
+ };
1568
+
1569
+ export const buildLayers = (relations, tableName, tableNameCache) => {
1570
+ const result = { table: tableName, inboundKeys: [], fkeys: [] };
1571
+ for (const relation of relations) {
1572
+ const relType = relation.type;
1573
+ let currentLevel = result;
1574
+ if (relType === RelationType.INDEPENDENT) {
1575
+ currentLevel.fkeys.push({
1576
+ name: "none (no relation)",
1577
+ table: "",
1578
+ inboundKeys: [],
1579
+ fkeys: [],
1580
+ relPath: relation.relationString,
1581
+ });
1582
+ } else if (relType === RelationType.OWN) {
1583
+ currentLevel.fkeys.push({
1584
+ name: "same table",
1585
+ table: relation.targetTblName,
1586
+ inboundKeys: [],
1587
+ fkeys: [],
1588
+ relPath: relation.relationString,
1589
+ });
1590
+ } else {
1591
+ let currentTbl = relation.sourceTblName;
1592
+ for (const pathElement of relation.path) {
1593
+ if (pathElement.inboundKey) {
1594
+ currentTbl = pathElement.table;
1595
+ const existing = currentLevel.inboundKeys.find(
1596
+ (key) =>
1597
+ key.name === pathElement.inboundKey && key.table === currentTbl
1598
+ );
1599
+ if (existing) {
1600
+ currentLevel = existing;
1601
+ } else {
1602
+ const nextLevel = {
1603
+ name: pathElement.inboundKey,
1604
+ table: currentTbl,
1605
+ inboundKeys: [],
1606
+ fkeys: [],
1607
+ };
1608
+ currentLevel.inboundKeys.push(nextLevel);
1609
+ currentLevel = nextLevel;
1610
+ }
1611
+ } else if (pathElement.fkey) {
1612
+ const tblObj = tableNameCache[currentTbl];
1613
+ const fkey = tblObj.foreign_keys.find(
1614
+ (key) => key.name === pathElement.fkey
1615
+ );
1616
+ currentTbl = fkey.reftable_name;
1617
+ const existing = currentLevel.fkeys.find(
1618
+ (key) => key.name === pathElement.fkey
1619
+ );
1620
+ if (existing) {
1621
+ currentLevel = existing;
1622
+ } else {
1623
+ const nextLevel = {
1624
+ name: pathElement.fkey,
1625
+ table: currentTbl,
1626
+ inboundKeys: [],
1627
+ fkeys: [],
1628
+ };
1629
+ currentLevel.fkeys.push(nextLevel);
1630
+ currentLevel = nextLevel;
1631
+ }
1632
+ }
1633
+ }
1634
+ }
1635
+ currentLevel.relPath = relation.relationString;
1574
1636
  }
1637
+ return result;
1575
1638
  };
@@ -253,6 +253,7 @@ const layoutToNodes = (layout, query, actions, parent = "ROOT") => {
253
253
  <Tabs
254
254
  key={ix}
255
255
  titles={segment.titles}
256
+ showif={segment.showif}
256
257
  ntabs={segment.ntabs}
257
258
  independent={segment.independent}
258
259
  startClosed={segment.startClosed}
@@ -529,6 +530,7 @@ const craftToSaltcorn = (nodes, startFrom = "ROOT") => {
529
530
  type: "tabs",
530
531
  contents,
531
532
  titles: node.props.titles,
533
+ showif: node.props.showif,
532
534
  tabsStyle: node.props.tabsStyle,
533
535
  field: node.props.field,
534
536
  independent: node.props.independent,
@@ -9,7 +9,16 @@ import {
9
9
  withKeyFromLayerTwo,
10
10
  withKeyFromLayerThree,
11
11
  withSimplePostTopicrelation,
12
- } from "./test_data";
12
+ } from "@saltcorn/common-code/tests/test_data";
13
+
14
+ import {
15
+ expectedOne,
16
+ expectedTwo,
17
+ expectedThree,
18
+ expectedFour,
19
+ expectedFive,
20
+ expectedSix,
21
+ } from "@saltcorn/common-code/tests/expected_relations";
13
22
  import { ViewSettings } from "../src/components/elements/View";
14
23
  import { ViewLinkSettings } from "../src/components/elements/ViewLink";
15
24
 
@@ -60,43 +69,47 @@ const doTest = (
60
69
  renderer.create(<ViewSettings></ViewSettings>);
61
70
  expect(spy).toBeCalled();
62
71
  const vCallArgs = spy.mock.calls[0];
63
- expect(vCallArgs[0].paths).toBeDefined();
64
- expect(vCallArgs[0].paths).toHaveLength(expected.length);
65
- expect(vCallArgs[0].paths).toEqual(expect.arrayContaining(expected));
72
+ expect(vCallArgs[0].relations).toBeDefined();
73
+ expect(vCallArgs[0].relations).toHaveLength(expected.length);
74
+ expect(vCallArgs[0].relations.map((rel) => rel.relationString)).toEqual(
75
+ expect.arrayContaining(expected)
76
+ );
66
77
 
67
78
  renderer.create(<ViewLinkSettings></ViewLinkSettings>);
68
79
  expect(spy.mock.calls).toHaveLength(4);
69
80
  const vLinkcallArgs = spy.mock.calls[2];
70
- expect(vLinkcallArgs[0].paths).toBeDefined();
71
- expect(vLinkcallArgs[0].paths).toHaveLength(expected.length);
72
- expect(vLinkcallArgs[0].paths).toEqual(expect.arrayContaining(expected));
81
+ expect(vLinkcallArgs[0].relations).toBeDefined();
82
+ expect(vLinkcallArgs[0].relations).toHaveLength(expected.length);
83
+ expect(vLinkcallArgs[0].relations.map((rel) => rel.relationString)).toEqual(
84
+ expect.arrayContaining(expected)
85
+ );
73
86
  };
74
87
 
75
88
  describe("relations tests", () => {
76
- beforeAll(() => {
77
- // inject relationHelpers (normally it's a script tag)
78
- global.relationHelpers = {
79
- ...require("../../server/public/relation_helpers.js"),
80
- };
81
- });
82
89
  beforeEach(() => {
83
90
  jest.restoreAllMocks();
84
91
  });
85
92
  describe("single relations", () => {
86
- it("parent relations", async () => {
87
- const { tables, views } = fixturesData();
93
+ it("parent relations", () => {
94
+ const { tables, views } = fixturesData(__dirname);
88
95
  const expected = [".fan_club.artist"];
89
96
  doTest(tables, views, "fan_club", "show_artist", expected);
90
97
  });
91
98
 
92
- it("one to one relations", async () => {
93
- const { tables, views } = fixturesData();
99
+ it("parent relations with layers", () => {
100
+ const { tables, views } = fixturesData(__dirname);
101
+ const expected = [".patients.favbook.publisher"];
102
+ doTest(tables, views, "patients", "show_publisher", expected);
103
+ });
104
+
105
+ it("one to one relations", () => {
106
+ const { tables, views } = fixturesData(__dirname);
94
107
  const expected = [".covers.albums$cover"];
95
108
  doTest(tables, views, "covers", "show_album", expected);
96
109
  });
97
110
 
98
- it("employee department relation", async () => {
99
- const { tables, views } = fixturesData();
111
+ it("employee department relation", () => {
112
+ const { tables, views } = fixturesData(__dirname);
100
113
  const expected = [".employee", ".employee.department.manager"];
101
114
  doTest(tables, views, "employee", "show_manager", expected);
102
115
  });
@@ -104,85 +117,37 @@ describe("relations tests", () => {
104
117
 
105
118
  describe("multi relations", () => {
106
119
  describe("inbound relations", () => {
107
- const expectedOne = [
108
- ".",
109
- ".users.user_interested_in_topic$user.topic.blog_in_topic$topic",
110
- ".users.user_interested_in_topic$user.topic.inbound_inbound$topic.bp_inbound.post.blog_in_topic$post",
111
- ".users.messages$user.room.participants$room.user.user_interested_in_topic$user.topic.blog_in_topic$topic",
112
- ];
113
- it("single keys to source and rel table", async () => {
114
- const { tables, views } = fixturesData();
120
+ it("single keys to source and rel table", () => {
121
+ const { tables, views } = fixturesData(__dirname);
115
122
  doTest(tables, views, "users", "blog_in_topic_feed", expectedOne);
116
123
  });
117
124
 
118
- const expectedTwo = [
119
- ...expectedOne,
120
- ".users.user_interested_in_topic$another_user.topic.blog_in_topic$topic",
121
- ".users.user_interested_in_topic$another_user.topic.inbound_inbound$topic.bp_inbound.post.blog_in_topic$post",
122
- ".users.messages$user.room.participants$room.user.user_interested_in_topic$another_user.topic.blog_in_topic$topic",
123
- ];
124
- it("multiple keys to source and single key to rel table", async () => {
125
- const { tables, views } = withAnotherUserField();
125
+ it("multiple keys to source and single key to rel table", () => {
126
+ const { tables, views } = withAnotherUserField(__dirname);
126
127
  doTest(tables, views, "users", "blog_in_topic_feed", expectedTwo);
127
128
  });
128
129
 
129
- const expectedThree = [
130
- ...expectedTwo,
131
- ".users.user_interested_in_topic$user.topic.blog_in_topic$second_topic",
132
- ".users.user_interested_in_topic$another_user.topic.blog_in_topic$second_topic",
133
- ".users.messages$user.room.participants$room.user.user_interested_in_topic$user.topic.blog_in_topic$second_topic",
134
- ".users.messages$user.room.participants$room.user.user_interested_in_topic$another_user.topic.blog_in_topic$second_topic",
135
- ];
136
- it("multiple keys to source and rel table", async () => {
137
- const { tables, views } = withSecondTopicField();
130
+ it("multiple keys to source and rel table", () => {
131
+ const { tables, views } = withSecondTopicField(__dirname);
138
132
  doTest(tables, views, "users", "blog_in_topic_feed", expectedThree);
139
133
  });
140
134
 
141
- const expectedFour = [
142
- ...expectedThree,
143
- ".users.user_interested_in_topic$user.another_user.second_inbound$user.topic.blog_in_topic$topic",
144
- ".users.user_interested_in_topic$user.another_user.second_inbound$user.topic.blog_in_topic$second_topic",
145
- ".users.second_inbound$user.topic.blog_in_topic$topic",
146
- ".users.second_inbound$user.topic.blog_in_topic$second_topic",
147
- ".users.second_inbound$user.topic.inbound_inbound$topic.bp_inbound.post.blog_in_topic$post",
148
- ".users.messages$user.room.participants$room.user.second_inbound$user.topic.blog_in_topic$topic",
149
- ".users.messages$user.room.participants$room.user.second_inbound$user.topic.blog_in_topic$second_topic",
150
- ];
151
- it("multiple inbound tables", async () => {
152
- const { tables, views } = withMultipleInbounds();
135
+ it("multiple inbound tables", () => {
136
+ const { tables, views } = withMultipleInbounds(__dirname);
153
137
  doTest(tables, views, "users", "blog_in_topic_feed", expectedFour);
154
138
  });
155
139
 
156
- const expectedFive = [
157
- ...expectedFour,
158
- ".users.user_interested_in_topic$user.topic.inbound_inbound$topic.post_from_layer_two.blog_in_topic$post",
159
- ".users.user_interested_in_topic$another_user.topic.inbound_inbound$topic.post_from_layer_two.blog_in_topic$post",
160
- ".users.second_inbound$user.topic.inbound_inbound$topic.post_from_layer_two.blog_in_topic$post",
161
- ".users.user_interested_in_topic$user.topic.blog_in_topic$topic.post.inbound_inbound$post_from_layer_two.topic.blog_in_topic$second_topic",
162
- ".users.user_interested_in_topic$user.another_user.second_inbound$user.topic.inbound_inbound$topic.post_from_layer_two.blog_in_topic$post",
163
- ".users.user_interested_in_topic$another_user.topic.blog_in_topic$topic.post.inbound_inbound$post_from_layer_two.topic.blog_in_topic$second_topic",
164
- ".users.second_inbound$user.topic.blog_in_topic$topic.post.inbound_inbound$post_from_layer_two.topic.blog_in_topic$second_topic",
165
- ];
166
- it("key to source from layer two", async () => {
167
- const { tables, views } = withKeyFromLayerTwo();
140
+ it("key to source from layer two", () => {
141
+ const { tables, views } = withKeyFromLayerTwo(__dirname);
168
142
  doTest(tables, views, "users", "blog_in_topic_feed", expectedFive);
169
143
  });
170
144
 
171
- const expectedSix = [
172
- ...expectedFive,
173
- ".users.user_interested_in_topic$user.topic.inbound_level_three$topic.inbound_level_two.bp_inbound.post.blog_in_topic$post",
174
- ".users.user_interested_in_topic$user.topic.inbound_level_three$topic.inbound_level_two.post_from_layer_two.blog_in_topic$post",
175
- ".users.user_interested_in_topic$another_user.topic.inbound_level_three$topic.inbound_level_two.bp_inbound.post.blog_in_topic$post",
176
- ".users.user_interested_in_topic$another_user.topic.inbound_level_three$topic.inbound_level_two.post_from_layer_two.blog_in_topic$post",
177
- ".users.second_inbound$user.topic.inbound_level_three$topic.inbound_level_two.bp_inbound.post.blog_in_topic$post",
178
- ".users.second_inbound$user.topic.inbound_level_three$topic.inbound_level_two.post_from_layer_two.blog_in_topic$post",
179
- ];
180
- it("three levels inbound", async () => {
181
- const { tables, views } = withKeyFromLayerThree();
145
+ it("three levels inbound", () => {
146
+ const { tables, views } = withKeyFromLayerThree(__dirname);
182
147
  doTest(tables, views, "users", "blog_in_topic_feed", expectedSix);
183
148
  });
184
149
 
185
- it("simple post topic relation", async () => {
150
+ it("simple post topic relation", () => {
186
151
  const expected = [
187
152
  ".",
188
153
  ".users.favsimpletopic.simple_posts$topic",
@@ -190,20 +155,20 @@ describe("relations tests", () => {
190
155
  ".users.messages$user.room.participants$room.user.favsimpletopic.simple_posts$topic",
191
156
  ".users.messages$user.room.participants$room.user.favsimpletopic.simple_post_inbound$topic.post",
192
157
  ];
193
- const { tables, views } = withSimplePostTopicrelation();
158
+ const { tables, views } = withSimplePostTopicrelation(__dirname);
194
159
  doTest(tables, views, "users", "simple_posts_list", expected);
195
160
  });
196
161
  });
197
162
 
198
163
  describe("many to many relations", () => {
199
- it("artist_plays_on_album", async () => {
200
- const { tables, views } = fixturesData();
164
+ it("artist_plays_on_album", () => {
165
+ const { tables, views } = fixturesData(__dirname);
201
166
  const expected = [".", ".artists.artist_plays_on_album$artist.album"];
202
167
  doTest(tables, views, "artists", "albums_feed", expected);
203
168
  });
204
169
 
205
- it("tracks on album", async () => {
206
- const { tables, views } = fixturesData();
170
+ it("tracks on album", () => {
171
+ const { tables, views } = fixturesData(__dirname);
207
172
  const expected = [
208
173
  ".",
209
174
  ".artists.artist_plays_on_album$artist.album.tracks_on_album$album",
@@ -211,8 +176,8 @@ describe("relations tests", () => {
211
176
  doTest(tables, views, "artists", "tracks_on_album_feed", expected);
212
177
  });
213
178
 
214
- it("show pressing_job with embedded fan club feed", async () => {
215
- const { tables, views } = fixturesData();
179
+ it("show pressing_job with embedded fan club feed", () => {
180
+ const { tables, views } = fixturesData(__dirname);
216
181
  const expected = [
217
182
  ".",
218
183
  ".pressing_job.album.artist_plays_on_album$album.artist.fan_club$artist",
@@ -222,8 +187,8 @@ describe("relations tests", () => {
222
187
  });
223
188
 
224
189
  describe("excluded viewtemplates", () => {
225
- it("excluded viewtemplates", async () => {
226
- const { tables, views } = fixturesData();
190
+ it("excluded viewtemplates", () => {
191
+ const { tables, views } = fixturesData(__dirname);
227
192
  const expected = [];
228
193
  const excluded = ["Room"];
229
194
  doTest(tables, views, "participants", "rooms_view", expected, excluded);
@@ -232,7 +197,7 @@ describe("relations tests", () => {
232
197
 
233
198
  describe("open legacy relations", () => {
234
199
  it("ChildList", async () => {
235
- const { tables, views } = fixturesData();
200
+ const { tables, views } = fixturesData(__dirname);
236
201
  const expected = [".", ".books.discusses_books$book"];
237
202
  doTest(
238
203
  tables,
@@ -247,7 +212,7 @@ describe("relations tests", () => {
247
212
  });
248
213
 
249
214
  it("Independent", async () => {
250
- const { tables, views } = fixturesData();
215
+ const { tables, views } = fixturesData(__dirname);
251
216
  const expected = [
252
217
  ".",
253
218
  ".blog_posts",
@@ -266,7 +231,7 @@ describe("relations tests", () => {
266
231
  });
267
232
 
268
233
  it("Own", async () => {
269
- const { tables, views } = fixturesData();
234
+ const { tables, views } = fixturesData(__dirname);
270
235
  const expected = [".books"];
271
236
  doTest(
272
237
  tables,