mirror of
https://github.com/trekhleb/javascript-algorithms.git
synced 2026-03-13 08:51:02 +08:00
Make it possible to attach meta information to binary tree node.
This commit is contained in:
@@ -196,4 +196,12 @@ describe('BinaryTreeNode', () => {
|
||||
expect(node1.toString()).toBe('object_1');
|
||||
expect(node2.toString()).toBe('[object Object]');
|
||||
});
|
||||
|
||||
it('should be possible to attach meta information to the node', () => {
|
||||
const redNode = new BinaryTreeNode(1, { color: 'red' });
|
||||
const blackNode = new BinaryTreeNode(2, { color: 'black' });
|
||||
|
||||
expect(redNode.meta.color).toBe('red');
|
||||
expect(blackNode.meta.color).toBe('black');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user