tested and fixed constant node computations
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { buildComputationFromProps } from '/imports/api/creature/computation/newEngine/buildCreatureComputation.js';
|
||||
import { assert } from 'chai';
|
||||
import computeCreatureComputation from '../../computeCreatureComputation.js';
|
||||
import clean from '../../utility/cleanProp.testFn.js';
|
||||
|
||||
export default function(){
|
||||
const computation = buildComputationFromProps(testProperties);
|
||||
computeCreatureComputation(computation);
|
||||
const prop = id => computation.propsById[id];
|
||||
assert.equal(prop('attId').value, 6);
|
||||
}
|
||||
|
||||
var testProperties = [
|
||||
clean({
|
||||
_id: 'constId',
|
||||
type: 'constant',
|
||||
variableName: 'arrayConstant',
|
||||
calculation: '[2, 4, 6, 8, 10]',
|
||||
}),
|
||||
clean({
|
||||
_id: 'attId',
|
||||
type: 'attribute',
|
||||
baseValue: {
|
||||
calculation: 'arrayConstant[3]',
|
||||
},
|
||||
ancestors: [{id: 'charId'}],
|
||||
}),
|
||||
];
|
||||
@@ -1,6 +1,7 @@
|
||||
import computeAction from './computeAction.testFn.js';
|
||||
import computeAttribute from './computeAttribute.testFn.js';
|
||||
import computeClasses from './computeClasses.testFn.js';
|
||||
import computeConstants from './computeConstants.testFn.js';
|
||||
|
||||
export default [{
|
||||
text: 'Computes actions',
|
||||
@@ -11,4 +12,7 @@ export default [{
|
||||
},{
|
||||
text: 'Computes classes',
|
||||
fn: computeClasses,
|
||||
},{
|
||||
text: 'Computes constants',
|
||||
fn: computeConstants,
|
||||
}];
|
||||
|
||||
Reference in New Issue
Block a user