Jest API and options
You can use the @metamask/snaps-jest
package for end-to-end Snaps testing.
This reference describes the available API methods, Jest matchers,
and options.
API methods
installSnap
Installs a Snap in the execution environment. We recommend using this function in each test to ensure that it starts with a new Snap installation.
Parameters
By default, if the built-in server is enabled, installSnap
installs the Snap from the built-in server.
Otherwise, you must specify a Snap ID to install.
Returns
An object with functions that can be used to interact with the Snap.
Example
import { installSnap } from "@metamask/snaps-jest"
describe("MySnap", () => {
it("should do something", async () => {
await installSnap(/* optional Snap ID */)
// ...
})
})