UNPKG

owl-bt

Version:

owl-bt is editor for Behavior trees. It has been inspired by Unreal engine behavior trees in a way, that it supports special node items like decorators and services. This makes trees smaller and much more readable.

37 lines (31 loc) 973 B
'use strict'; describe('Service: TreeNodeByIdStore', function() { // load the service's module beforeEach(() => angular.mock.module('editorApp')); // instantiate service let TreeNodeByIdStore; beforeEach(() => inject(function(_TreeNodeByIdStore_) { TreeNodeByIdStore = _TreeNodeByIdStore_; })); it('add should register the node that is then retrievable through getNode', function() { let node = { $meta: { id: 10, }, }; expect(TreeNodeByIdStore.getNode(10)).not.toBeDefined(); TreeNodeByIdStore.addNode(node); expect(TreeNodeByIdStore.getNode(10)).toBe(node); }); it('getNode should not return node after it has been removed', function() { let node = { $meta: { id: 10, }, }; TreeNodeByIdStore.addNode(node); expect(TreeNodeByIdStore.getNode(10)).toBe(node); TreeNodeByIdStore.removeNode(node); expect(TreeNodeByIdStore.getNode(10)).not.toBeDefined(); }); });