chaingate
Version:
A complete TypeScript library for connecting to and making transactions on different blockchains
24 lines • 884 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.setupCryptoGetRandomValuesMock = setupCryptoGetRandomValuesMock;
exports.getTestPhrase = getTestPhrase;
function setupCryptoGetRandomValuesMock() {
beforeEach(() => {
jest.spyOn(global.crypto, 'getRandomValues').mockImplementation((array) => {
// Fill the array with zeros
array.fill(0x00);
return array;
});
});
afterEach(() => {
global.crypto.getRandomValues.mockRestore();
});
}
function getTestPhrase() {
const testPhrase = process.env.TEST_PHRASE;
if (!testPhrase || testPhrase.startsWith('encrypted:')) {
throw new Error('Missing TEST_PHRASE environment variable. Please set TEST_PHRASE with the original phrase to run the tests.');
}
return testPhrase;
}
//# sourceMappingURL=TestUtils.js.map