Files
DiceCloud/app/imports/api/engine/computation/buildCreatureComputation.test.js
2023-09-28 21:27:05 +02:00

44 lines
1.7 KiB
JavaScript

import '/imports/api/simpleSchemaConfig';
import { buildComputationFromProps } from './buildCreatureComputation';
import { assert } from 'chai';
import CreatureProperties from '/imports/api/creature/creatureProperties/CreatureProperties';
import computeInactiveStatus from './buildComputation/tests/computeInactiveStatus.testFn';
import computeSlotQuantityFilled from './buildComputation/tests/computeSlotQuantityFilled.testFn';
import computeToggleDependencies from './buildComputation/tests/computeToggleDependencies.testFn';
import linkCalculationDependencies from './buildComputation/tests/linkCalculationDependencies.testFn';
import linkInventory from './buildComputation/tests/linkInventory.testFn';
import linkTypeDependencies from './buildComputation/tests/linkTypeDependencies.testFn';
describe('buildComputation', function () {
it('Builds something at all', function () {
let computation = buildComputationFromProps(testProperties);
assert.exists(computation);
});
it('Computes inactive status', computeInactiveStatus);
it('Computes slot fill quantity', computeSlotQuantityFilled);
it('Links toggle dependencies', computeToggleDependencies);
it('Links calculation dependencies', linkCalculationDependencies);
it('Links inventory stats', linkInventory);
it('Links type dependencies', linkTypeDependencies);
});
var testProperties = [
clean({
_id: 'attributeId123',
type: 'attribute',
variableName: 'strength',
attributeType: 'ability',
baseValue: {
calculation: '1 + 2 + 3',
},
description: {
text: 'strength is {strength}'
}
}),
];
function clean(prop) {
let schema = CreatureProperties.simpleSchema(prop);
return schema.clean(prop);
}