ethers.js/packages/tests/lib.esm/skip-test-solc.js

25 lines
1.0 KiB
JavaScript
Raw Permalink Normal View History

2020-01-06 19:00:55 -05:00
'use strict';
import assert from "assert";
import { resolve } from "path";
import fs from "fs";
import { solc } from "@ethersproject/cli";
describe('Test solc', function () {
it('compiles contracts with imported library', function () {
this.timeout(1200000);
const filename = resolve(__dirname, '../contracts/test-solc/consumer.sol');
const source = fs.readFileSync(filename).toString();
2020-09-23 01:00:30 -04:00
try {
const code = solc.compile(source, { filename, optimize: true })
.filter(((contract) => contract.name === 'Consumer'))[0];
const { bytecode, interface: iface } = code;
assert(bytecode.length > 2, 'The bytecode should should have a length');
assert(bytecode.startsWith('0x'), 'The bytecode should start with 0x');
assert(iface.functions['f()'], 'The interface should have function f()');
}
catch (error) {
console.log(error);
throw error;
}
2020-01-06 19:00:55 -05:00
});
});
//# sourceMappingURL=skip-test-solc.js.map