@metamask/snaps-simulation
Version:
A simulation framework for MetaMask Snaps, enabling headless testing of Snaps in a controlled environment
34 lines • 1.18 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStartTraceImplementation = void 0;
const effects_1 = require("redux-saga/effects");
const store_1 = require("../../store/index.cjs");
/**
* 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 (0, effects_1.put)((0, store_1.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.
*/
function getStartTraceImplementation(runSaga) {
return (...args) => {
return runSaga(startTraceImplementation, ...args).result();
};
}
exports.getStartTraceImplementation = getStartTraceImplementation;
//# sourceMappingURL=start-trace.cjs.map