daily pastebin goal
47%
SHARE
TWEET

svejedno

a guest May 23rd, 2018 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const assert = require('assert');
  2. const ganache = require('ganache-cli');
  3. const Web3 = require('web3');
  4.  
  5. const provider = ganache.provider();
  6. const web3 = new Web3(provider);
  7. const { interface, bytecode } = require('../compile');
  8.  
  9.  
  10. let lottery;
  11. let accounts;
  12. beforeEach(async()=>{
  13.   //Get list of all accounts
  14.   accounts = await web3.eth.getAccounts();
  15.  
  16.   //Use one of those accounts to deploy
  17.   //the contract
  18.   lottery = await new web3.eth.Contract(JSON.parse(interface))
  19.   .deploy({data: bytecode })
  20.   .send({from: accounts[0], gas:'1000000'});
  21.   lottery.setProvider(provider);
  22. });
  23.  
  24. describe ('Lottery Contract', ()=> {
  25.   it('deploys a contract',()=>{
  26.     // console.log(accounts);
  27.     //console.log(inbox.options.address);
  28.     //console.log(inbox);
  29.     assert.ok(lottery.options.address);
  30.   });
  31. /*
  32.   it('has a default message', async()=> {
  33.     const message = await inbox.methods.message().call();
  34.     assert.equal(message, 'Hi There!');
  35.   });
  36.   it('can change the message', async()=> {
  37.     await inbox.methods.setMessage('bye').send({ from: accounts[0]});
  38.     const message = await inbox.methods.message().call();
  39.     assert.equal(message, 'bye');
  40.   });
  41. */
  42. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top