/
wyvern-dao.js
54 lines (49 loc) · 1.67 KB
/
wyvern-dao.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* global artifacts:false, it:false, contract:false, assert:false */
const WyvernDAO = artifacts.require('WyvernDAO')
const WyvernToken = artifacts.require('WyvernToken')
const BigNumber = require('bignumber.js')
const { utxoAmount } = require('./aux.js')
contract('WyvernDAO', (accounts) => {
it('should have the right initial balance', () => {
return WyvernDAO
.deployed()
.then(daoInstance => {
return WyvernToken
.deployed()
.then(tokenInstance => {
return tokenInstance.balanceOf.call(daoInstance.address)
})
.then(value => {
const expected = (new BigNumber(20000000 * Math.pow(10, 18))).sub(new BigNumber(utxoAmount * Math.pow(10, 11)))
assert.equal(value.equals(expected), true, 'Incorrect balance!')
})
})
})
it('should have the right address', () => {
return WyvernDAO
.deployed()
.then(daoInstance => {
return WyvernToken
.deployed()
.then(tokenInstance => {
return daoInstance.sharesTokenAddress.call()
.then(address => {
assert.equal(address, tokenInstance.address, 'Incorrect token address')
})
})
})
})
it('should not allow release twice', () => {
return WyvernToken
.deployed()
.then(tokenInstance => {
return tokenInstance.releaseTokens.sendTransaction(tokenInstance.address)
})
.then(() => {
assert.equal(true, false, 'Tokens were released twice!')
})
.catch(err => {
assert.equal(err.message, 'VM Exception while processing transaction: revert', 'Incorrect error')
})
})
})