-
Notifications
You must be signed in to change notification settings - Fork 481
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue where actors referenced within scripts were not always bein…
…g linked correctly
- Loading branch information
1 parent
9a9696d
commit 0146740
Showing
6 changed files
with
207 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { | ||
ScriptEventDefs, | ||
isActorField, | ||
} from "shared/lib/scripts/scriptDefHelpers"; | ||
|
||
test('should identify fields starting with "$actor[" as actor fields from custom events', () => { | ||
expect(isActorField("EVENT_TEST", "$actor[0]", {}, {})).toEqual(true); | ||
}); | ||
|
||
test('should identify fields with type "actor" as actor fields', () => { | ||
expect( | ||
isActorField("EVENT_TEST", "test", {}, { | ||
EVENT_TEST: { | ||
id: "EVENT_TEST", | ||
fieldsLookup: { | ||
test: { | ||
key: "test", | ||
type: "actor", | ||
}, | ||
}, | ||
}, | ||
} as unknown as ScriptEventDefs) | ||
).toEqual(true); | ||
}); | ||
|
||
test('should not identify fields without type "actor" as actor fields', () => { | ||
expect( | ||
isActorField("EVENT_TEST", "test", {}, { | ||
EVENT_TEST: { | ||
id: "EVENT_TEST", | ||
fieldsLookup: { | ||
test: { | ||
key: "test", | ||
type: "number", | ||
}, | ||
}, | ||
}, | ||
} as unknown as ScriptEventDefs) | ||
).toEqual(false); | ||
}); |