PlayerHumanoidBinderTestUtils
Shared harness for the PlayerCharacterBinder/PlayerHumanoidBinder specs. [setup] boots a binder the way production does -- registered on a BinderProvider driven through a ServiceBag -- with the boot split into init()/start() so a test can stage mocks before the binder starts. Mocks are created through the bag's PlayerMockService (so discovery mirrors a real join, and teardown destroys them -- discovery is place-wide, so a leaked mock would bleed into the next test), and characters are plain Models with a real Humanoid.
Tags are global and the test place is shared across a batch run, so every controller derives a distinct tag from a single module-level counter, parents everything under its own container, and tears it all down via destroy().
Functions
makeTrackingClass
PlayerHumanoidBinderTestUtils.makeTrackingClass() → TrackingClassA minimal bound class that records its instance and whether it was destroyed. It ignores its constructor varargs: the ServiceBag is injected as a constructor arg, and its Signals' strict __index makes jest's deep-equality traversal throw, so the class must not retain it for toEqual to compare instances safely.
awaitUnbound
Returns once inst is no longer bound. Removal is usually already done by the time we check; the
guarded wait also covers a deferred case.
setup
PlayerHumanoidBinderTestUtils.setup(tagPrefix: string,--
keeps tags distinct between the two spec files
constructor: any?--
defaults to a fresh tracking class
) → {...}Builds the controller the specs share around one binder of the given class. init() registers and Init's the bag (mocks can then be staged), start() starts it, boot() does both. newMock() creates a player through the bag's PlayerMockService; newCharacter() builds a character Model (with a real Humanoid unless withHumanoid is false); setCharacter() assigns the mock's stand-in Character.