@metamask/snaps-simulation
Version:
A simulation framework for MetaMask Snaps, enabling headless testing of Snaps in a controlled environment
30 lines • 967 B
JavaScript
import { put } from "redux-saga/effects";
import { startTrace } from "../../store/index.mjs";
/**
* Start a performance trace.
*
* @param event - The performance trace to start.
* @returns `null`.
* @yields Adds the pending trace to the store.
*/
function* startTraceImplementation(event) {
yield put(startTrace(event));
return {
/* eslint-disable @typescript-eslint/naming-convention */
_traceId: 'test-trace-id',
_spanId: 'test-span-id',
/* eslint-enable @typescript-eslint/naming-convention */
};
}
/**
* Get a method that can be used to start a performance trace.
*
* @param runSaga - A function to run a saga outside the usual Redux flow.
* @returns A method that can be used to start a performance trace.
*/
export function getStartTraceImplementation(runSaga) {
return (...args) => {
return runSaga(startTraceImplementation, ...args).result();
};
}
//# sourceMappingURL=start-trace.mjs.map