-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Getting the State on a Container Node with nested state containing an array, or object returns an array or object of VirtualNodes, rather than the formatted object. Rather, it should return an array of the primitive values only, not VirutalNodes
To Reproduce
Steps to reproduce the behavior:
- Create A ConstructorNode, and Initialize the State with an Array Populated with Values
- CombineNodes with the ConstructorNode
- Called Get State on the SiloNode returned by combineNodes
- Notice that the array is returned as a set of virtual nodes rather than an array of values
Expected behavior
If I initialize state with an array, [1, 2] the array returned when calling get state should consist of [1, 2] rather than the current returned value of [VirtualNode {val: 1 ...}, VirtualNode {val: 2 ...}]. This should be true of all values in VirtualNodes that are not ContainerNodes.
Test Snippet
test('State Is Correctly Initialized', () => {
let rootNode = new constructorNode('Root');
rootNode.initializeState({
testString: 'Testing',
testNum: 123,
testArr: ['1', '2', '3'],
testObject: {
key1: '1',
key2: '2',
key3: '3'
}
});
let generatedTree = combineNodes(rootNode);
expect(generatedTree.Root.getState().testString.val).toBe('Testing');
expect(generatedTree.Root.getState().testNum.val).toBe(123);
console.warn('State Is Correctly Initialized: Removed Due to Bug #56 - https://github.com/radonjs/Radon/issues/56');
//Removed Due to Bug #56 - https://github.com/radonjs/Radon/issues/56
//expect(generatedTree.Root.getState().testArr).toEqual(['1', '2', '3']);
//expect(generatedTree.Root.getState().testObject).toEqual({key1: '1', key2: '2', key3: '3'});
});Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working