ethers.js/packages/testcases/lib.esm/index.js

22 lines
945 B
JavaScript
Raw Normal View History

'use strict';
import fs from 'fs';
import path from 'path';
import zlib from 'browserify-zlib';
import { randomBytes, randomHexString, randomNumber } from "./random";
export { randomBytes, randomHexString, randomNumber };
2020-10-19 06:19:16 +03:00
import * as TestCase from "./testcases";
export { TestCase };
export function saveTests(tag, data) {
//let filename = path.resolve(__dirname, 'testcases', tag + '.json.gz');
2020-01-07 03:00:55 +03:00
let filename = path.resolve(__dirname, '../testcases', tag + '.json.gz');
fs.writeFileSync(filename, zlib.gzipSync(JSON.stringify(data, undefined, ' ') + '\n'));
console.log('Save testcase: ' + filename);
}
export function loadTests(tag) {
let filename = path.resolve(__dirname, '../testcases', tag + '.json.gz');
return JSON.parse(zlib.gunzipSync(fs.readFileSync(filename)).toString());
}
export function loadData(filename) {
return fs.readFileSync(path.resolve(__dirname, filename));
}
2020-07-13 15:03:56 +03:00
//# sourceMappingURL=index.js.map