Files
DiceCloud/app/imports/api/engine/computation/buildComputation/tests/computeSlotQuantityFilled.testFn.js
2023-10-04 14:27:06 +02:00

39 lines
939 B
JavaScript

import { buildComputationFromProps } from '/imports/api/engine/computation/buildCreatureComputation';
import { assert } from 'chai';
import clean from '../../utility/cleanProp.testFn';
import { applyNestedSetProperties } from '/imports/api/parenting/parentingFunctions';
export default function () {
const computation = buildComputationFromProps(testProperties);
const totalFilled = computation.propsById['slotId'].totalFilled;
assert.equal(totalFilled, 4);
}
var testProperties = [
// Slots
clean({
_id: 'slotId',
type: 'propertySlot',
}),
// Children
clean({
_id: 'slotFillerId',
type: 'folder',
slotQuantityFilled: 3,
slotFillerType: 'item',
parentId: 'slotId',
}),
clean({
_id: 'slotChildId',
type: 'item',
parentId: 'slotId',
}),
clean({
_id: 'slotGrandchildId',
type: 'effect',
parentId: 'slotChildId',
}),
];
applyNestedSetProperties(testProperties);