Files
DiceCloud/app/imports/api/engine/action/applyProperties/applyFolderProperty.test.ts
2025-05-02 15:38:18 +02:00

51 lines
1.0 KiB
TypeScript

import { assert } from 'chai';
import {
allMutations,
createTestCreature,
getRandomIds,
removeAllCreaturesAndProps,
runActionById,
TestCreature
} from '/imports/api/engine/action/functions/actionEngineTest.testFn';
const [
creatureId, folderId
] = getRandomIds(100);
const actionTestCreature: TestCreature = {
_id: creatureId,
props: [
{
_id: folderId,
type: 'folder',
children: [{
type: 'note',
summary: { text: 'this should run' },
}],
},
],
}
describe('Apply folder properties', function () {
// Increase timeout
this.timeout(8000);
before(async function () {
await removeAllCreaturesAndProps();
await createTestCreature(actionTestCreature);
});
it('Applies the children of the folder', async function () {
const action = await runActionById(folderId);
assert.exists(action);
assert.deepEqual(allMutations(action), [{
contents: [
{
value: 'this should run'
}
],
targetIds: [],
}]);
});
});