Files
DiceCloud/app/imports/api/engine/computation/computeComputation/tests/computeEffects.testFn.js
2023-09-28 21:27:05 +02:00

60 lines
1.3 KiB
JavaScript

import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation';
import { assert } from 'chai';
import computeCreatureComputation from '../../computeCreatureComputation';
import clean from '../../utility/cleanProp.testFn';
export default function () {
const computation = buildComputationFromProps(testProperties);
computeCreatureComputation(computation);
const prop = id => computation.propsById[id];
assert.equal(prop('strengthId').value, 26);
}
var testProperties = [
clean({
_id: 'strengthId',
variableName: 'strength',
type: 'attribute',
attributeType: 'ability',
baseValue: {
calculation: '8'
},
}),
clean({
_id: 'strength2Id',
variableName: 'strength',
type: 'attribute',
attributeType: 'ability',
baseValue: {
calculation: '10'
},
}),
clean({
_id: 'strengthBaseId',
type: 'effect',
operation: 'base',
amount: {
calculation: '10 + 2'
},
stats: ['strength'],
}),
clean({
_id: 'strengthAddId',
type: 'effect',
operation: 'add',
amount: {
calculation: '1'
},
stats: ['strength'],
}),
clean({
_id: 'strengthMulId',
type: 'effect',
operation: 'mul',
amount: {
calculation: '2'
},
stats: ['strength'],
}),
];