Added action tests

This commit is contained in:
Thaum Rystra
2023-11-16 14:00:26 +02:00
parent 6d8dfc2255
commit 375a84226d
2 changed files with 50 additions and 3 deletions

View File

@@ -117,11 +117,11 @@ const ActionSchema = new SimpleSchema({
'results.$.propId': {
type: Object,
},
'result.$.targetIds': {
'results.$.targetIds': {
type: Array,
defaultValue: [],
},
'result.$.targetIds.$': {
'results.$.targetIds.$': {
type: String,
regEx: SimpleSchema.RegEx.Id,
},
@@ -155,11 +155,13 @@ const ActionSchema = new SimpleSchema({
Actions.attachSchema(ActionSchema);
export default Actions;
/**
* Create a new action ready to be run starting at the given property (or its 'before' triggers)
* @param prop
*/
export async function createAction(prop) {
export function createAction(prop) {
const action: Action = {
creatureId: prop.ancestors[0].id,
rootPropId: prop._id,