search/
Start typing to search packages!
package_2
jest-mock-rbx
By @roblox
Roblox
Mirrored from Wallyjest-mock-rbx
No upstream. Roblox only.
This package implements Jest's data model mocking capabilities for Roblox:
InstanceProxy, used for constructing objects that act like an existing instance, except actions can be intercepted and mocked.DataModelMocker, provides higher-level proxies that can interact with each other as part of a fake data model.
:pencil2: Notes
- Right now, only a limited subset of data model mocking features are implemented and available for use.
DataModelMockershould be used for constructing instance mocks, notInstanceProxy.- The
InstanceProxyclass is a minimal, self-contained implementation with no special behaviour. - The
DataModelMockerclass allows proxies to be reused, and provides useful default mock behaviour like returning proxied descendants or ancestry.
- The
InstanceProxyintentionally only implements some of anInstance's capabilities.- It is assumed that the instance proxy is being used on normal, idiomatic
code that would correctly function if given an
Instance. - Instance proxies have normal reference-based equality. They are not equal to the original instance, nor to any other proxies of that instance.
- Instance proxies can't be consumed by functions expecting a "proper
Instance".
- In particular, calls to C such as
x:IsAncestorOf(InstanceProxy)will error as these calls are not mockable.
- In particular, calls to C such as
- It is assumed that the instance proxy is being used on normal, idiomatic
code that would correctly function if given an
Package Details
Install command (Click to copy)
Version
3.20.1
License
MIT
Safe for commercial use
The package archive does not include its license text; the license is declared in its manifest metadata.
Automated license review — not legal advice.
