Skip to content

Commit

Permalink
contract deployment testing
Browse files Browse the repository at this point in the history
  • Loading branch information
aykutulis committed Mar 25, 2022
1 parent ab00dce commit fa88b3a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import solc from 'solc';

const rootDir = path.resolve();
const inboxPath = path.join(rootDir, 'contracts', 'Inbox.sol');
console.log(inboxPath);
const source = fs.readFileSync(inboxPath, 'utf8');

const input = {
Expand Down
12 changes: 9 additions & 3 deletions src/test/Inbox.test.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
import assert from 'assert';
import ganache from 'ganache-cli';
import Web3 from 'web3';
import { abi, evm } from '../compile';

const web3 = new Web3(ganache.provider());

let accounts: string[] = [];
let inbox: InstanceType<typeof web3.eth.Contract>;

beforeEach(async () => {
accounts = await web3.eth.getAccounts();
inbox = await new web3.eth.Contract(abi)
.deploy({ data: evm.bytecode.object, arguments: ['Hi there!'] })
.send({ from: accounts[0], gas: 1000000 });
});

describe('Inbox', () => {
it('deploys a contract', () => {
console.log(accounts);
})
})
assert.ok(inbox.options.address);
});
});

0 comments on commit fa88b3a

Please sign in to comment.