Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0e45990

Browse files
committed
fix(test): entwine Node
1 parent fb56b76 commit 0e45990

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

packages/Main/test/unit/entwine.js

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -159,21 +159,32 @@ describe('Entwine Point Tile', function () {
159159
root.children[2].children[1].add(new EntwinePointTileNode(3, 1, 6, 7, layer));
160160
});
161161

162-
it('finds the common ancestor of two nodes', () => {
163-
let ancestor = root.children[2].children[1].children[0].findCommonAncestor(root.children[2].children[0].children[0]);
164-
assert.deepStrictEqual(ancestor, root.children[2]);
162+
describe('finds the common ancestor of two nodes', () => {
163+
let ancestor;
164+
it('cousins => grand parent', () => {
165+
ancestor = root.children[2].children[1].children[0].findCommonAncestor(root.children[2].children[0].children[0]);
166+
assert.deepStrictEqual(ancestor, root.children[2]);
167+
});
165168

166-
ancestor = root.children[0].children[0].children[0].findCommonAncestor(root.children[0].children[0].children[1]);
167-
assert.deepStrictEqual(ancestor, root.children[0].children[0]);
169+
it('brothers => parent', () => {
170+
ancestor = root.children[0].children[0].children[0].findCommonAncestor(root.children[0].children[0].children[1]);
171+
assert.deepStrictEqual(ancestor, root.children[0].children[0]);
172+
});
168173

169-
ancestor = root.children[0].children[1].findCommonAncestor(root.children[2].children[1].children[0]);
170-
assert.deepStrictEqual(ancestor, root);
174+
it('grand child and grand grand child => root', () => {
175+
ancestor = root.children[0].children[1].findCommonAncestor(root.children[2].children[1].children[0]);
176+
assert.deepStrictEqual(ancestor, root);
177+
});
171178

172-
ancestor = root.children[1].findCommonAncestor(root.children[1].children[0].children[0]);
173-
assert.deepStrictEqual(ancestor, root.children[1]);
179+
it('parent and child => parent', () => {
180+
ancestor = root.children[1].findCommonAncestor(root.children[1].children[0].children[0]);
181+
assert.deepStrictEqual(ancestor, root.children[1]);
182+
});
174183

175-
ancestor = root.children[2].children[0].findCommonAncestor(root.children[2]);
176-
assert.deepStrictEqual(ancestor, root.children[2]);
184+
it('child and parent => parent', () => {
185+
ancestor = root.children[2].children[0].findCommonAncestor(root.children[2]);
186+
assert.deepStrictEqual(ancestor, root.children[2]);
187+
});
177188
});
178189
});
179190
});

0 commit comments

Comments
 (0)