UNPKG

@haechi-labs/henesis-cli

Version:

🚀 Command Line Interface tool to Utilize henesis

55 lines • 2.34 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const solc_1 = require("./solc"); const test_1 = require("@oclif/test"); const fancy_test_1 = require("fancy-test"); describe('solc', () => { describe('#compileSol()', () => { it('should compile solidity code', async () => { const path = __dirname + '/../../templates/contracts/example.sol'; const result = await solc_1.compileSol(path, { solcVersion: '0.5.8', }); test_1.expect(result.contracts).to.not.equal(undefined); test_1.expect(result.sources).to.not.equal(undefined); }).timeout(10000); context('when file does not end with .sol', () => { fancy_test_1.fancy .do(async () => { const path = __dirname + '/../../templates/contract/example.notsol'; await solc_1.compileSol(path, { solcVersion: '0.4.12' }); }) .catch('it is not a solidity file.') .it('should throw not sol file error'); }); }); describe('CompileResult', () => { let result; describe('#getAbi()', () => { const contractName = 'example'; const abi = [{ abi: 'abi' }]; beforeEach(() => { const contracts = { example: { abi: abi }, }; const sources = { example: {}, }; result = new solc_1.CompileResult(contracts, sources); }); it('should get abi', () => { test_1.expect(result.getAbi(contractName)).to.deep.equal(abi); }); }); }); describe('#getLatestEvmVersion()', () => { it('should return appropriate evm version', () => { test_1.expect(solc_1.getLatestEvmVersion('0.4.4')).to.equal('byzantium'); test_1.expect(solc_1.getLatestEvmVersion('0.4.26')).to.equal('byzantium'); test_1.expect(solc_1.getLatestEvmVersion('0.5.4')).to.equal('byzantium'); test_1.expect(solc_1.getLatestEvmVersion('0.5.5')).to.equal('petersburg'); test_1.expect(solc_1.getLatestEvmVersion('0.5.8')).to.equal('petersburg'); }); }); }); //# sourceMappingURL=solc.spec.js.map