Files
DiceCloud/app/imports/api/engine/action/applySilencedProps.test.ts
2024-10-30 17:53:39 +02:00

51 lines
1.0 KiB
TypeScript

import { assert } from 'chai';
import {
allMutations,
createTestCreature,
getRandomIds,
removeAllCreaturesAndProps,
runActionById
} from '/imports/api/engine/action/functions/actionEngineTest.testFn';
const [
creatureId, silencedNoteId
] = getRandomIds(2);
const actionTestCreature = {
_id: creatureId,
props: [
{
_id: silencedNoteId,
type: 'note',
name: 'Note Name',
summary: { text: 'Note summary {1 + 2}' },
silent: true,
},
],
}
describe('Apply silenced properties', function () {
// Increase timeout
this.timeout(8000);
before(async function () {
await removeAllCreaturesAndProps();
await createTestCreature(actionTestCreature);
});
it('Hides the note text', async function () {
const action = await runActionById(silencedNoteId);
assert.exists(action);
assert.deepEqual(allMutations(action), [{
contents: [
{
name: 'Note Name',
value: 'Note summary 3',
silenced: true,
},
],
targetIds: [],
}]);
});
});