Advertisement
Guest User

svejedno

a guest
May 23rd, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  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. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement