@neo4j-nvl/layout-workers 0.3.1-f010f7a1 → 0.3.1-fd6624ed

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.
@@ -0,0 +1,36 @@
1
+ import { layout } from './dagre-layout-impl.js';
2
+ describe('Dagre-layout-impl', () => {
3
+ test('is defined', () => {
4
+ expect(layout).toBeDefined();
5
+ });
6
+ test('the waypoints are defined by the first relationship', () => {
7
+ const nodes = [
8
+ { id: '1', color: '#000000', caption: 'Thing1', pinned: false, activated: false, selected: false },
9
+ { id: '2', color: '#000000', caption: 'Thing2', pinned: false, activated: false, selected: false },
10
+ { id: '3', color: '#000000', caption: 'Thing3', pinned: false, activated: false, selected: false }
11
+ ];
12
+ const nodeIds = {
13
+ 1: { id: '1', color: '#000000', caption: 'Thing1', pinned: false, activated: false, selected: false },
14
+ 2: { id: '2', color: '#000000', caption: 'Thing2', pinned: false, activated: false, selected: false },
15
+ 3: { id: '3', color: '#000000', caption: 'Thing3', pinned: false, activated: false, selected: false }
16
+ };
17
+ const rels = [
18
+ { id: '1000', from: '1', to: '2', type: 'CONNECTED_TO', properties: {} },
19
+ { id: '1002', from: '2', to: '3', type: 'CONNECTED_TO', properties: {} },
20
+ { id: '1004', from: '1', to: '3', type: 'CONNECTED_TO', properties: {} },
21
+ { id: '1005', from: '3', to: '1', type: 'CONNECTED_TO', properties: {} }
22
+ ];
23
+ const idToPosition = { 1: { id: '1' }, 2: { id: '2' }, 3: { id: '3' } };
24
+ const result = layout(nodes, nodeIds, idToPosition, rels, 'right', 2);
25
+ expect(result).toBeDefined();
26
+ expect(result.positions).toBeDefined();
27
+ expect(result.parents).toBeDefined();
28
+ expect(result.waypoints).toBeDefined();
29
+ expect(result.waypoints['1-3']).toBeDefined();
30
+ const wpObject = result.waypoints['1-3'];
31
+ const xs = [wpObject.from.x, ...wpObject.points.map((p) => p.x), wpObject.to.x];
32
+ for (let i = 1; i < xs.length; i++) {
33
+ expect(xs[i]).toBeGreaterThan(xs[i - 1]);
34
+ }
35
+ });
36
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neo4j-nvl/layout-workers",
3
- "version": "0.3.1-f010f7a1",
3
+ "version": "0.3.1-fd6624ed",
4
4
  "license": "SEE LICENSE IN 'LICENSE.txt'",
5
5
  "description": "Layout workers for the Neo4j Visualization Library",
6
6
  "keywords": [
@@ -20,7 +20,8 @@
20
20
  "scripts": {
21
21
  "build": "tsc",
22
22
  "prepack": "cp ../../LICENSE.txt ./",
23
- "postpack": "rm LICENSE.txt"
23
+ "postpack": "rm LICENSE.txt",
24
+ "eslint": "eslint ./src/ --ext .js,.mjs --plugin only-warn"
24
25
  },
25
26
  "typedoc": {
26
27
  "entryPoint": "./src/index.js",
@@ -37,9 +38,11 @@
37
38
  },
38
39
  "devDependencies": {
39
40
  "@types/node": "^18.11.11",
41
+ "eslint": "8.38.0",
40
42
  "typescript": "^5.4.5"
41
43
  },
42
44
  "peerDependencies": {
45
+ "eslint": "*",
43
46
  "typescript": "*"
44
47
  },
45
48
  "stableVersion": "0.3.1"