|
1 |
| -var InviteToken = artifacts.require("./InviteToken.sol"); |
2 | 1 | var VanityURL = artifacts.require("./VanityURL.sol");
|
3 | 2 |
|
4 | 3 | contract('VanityURL', function(accounts) {
|
5 | 4 | var vanityInstance;
|
6 |
| - var tokenInstance; |
7 | 5 |
|
8 | 6 | before(function () {
|
9 | 7 | return VanityURL.deployed().then(function(instance) {
|
10 | 8 | vanityInstance = instance;
|
11 |
| - return InviteToken.deployed(); |
12 |
| - }).then(function(token) { |
13 |
| - tokenInstance = token; |
14 |
| - // mint 1000 tokens |
15 |
| - return tokenInstance.mint(1000); |
16 |
| - }).then(function(minted) { |
17 |
| - return tokenInstance.transfer(accounts[1],10); |
18 |
| - }).then(function(transfer) { |
19 |
| - // add vanity contract to whitelist |
20 |
| - return tokenInstance.addWhiteListedContracts(vanityInstance.address); |
21 |
| - }).then(function(result) { |
22 |
| - assert.isDefined(result,"Vanity Contract should get added to whitelisted contracts") |
23 |
| - }).catch(function(error){ |
24 |
| - assert.isUndefined(error,"Vanity Contract should get added to whitelisted contracts") |
25 |
| - }) |
26 |
| - }); |
27 |
| - |
28 |
| - it("should have token defined", function() { |
29 |
| - return vanityInstance.tokenAddress.call().then(function(instance){ |
30 |
| - assert.isDefined(instance, "Token address should be defined"); |
31 |
| - assert.equal(instance,tokenInstance.address ,"Token address should be same as SRPMT"); |
32 |
| - }); |
33 |
| - }); |
34 |
| - |
35 |
| - it("should have reservePricing defined", function() { |
36 |
| - return vanityInstance.reservePricing.call().then(function(instance){ |
37 |
| - assert.isDefined(instance, "Token reservePricing should be defined"); |
38 | 9 | });
|
39 | 10 | });
|
40 | 11 |
|
41 | 12 | it("should be able to reserve a url", function() {
|
42 |
| - |
43 |
| - var amount = 1; //reserve fees |
44 |
| - // Get initial balances of first and second account. |
45 |
| - var account_one = accounts[1]; |
46 |
| - var account_two = accounts[2]; |
47 |
| - |
48 |
| - var account_one_starting_balance; |
49 |
| - var account_two_starting_balance; |
50 |
| - var account_one_ending_balance; |
51 |
| - var account_two_ending_balance; |
52 |
| - |
53 |
| - tokenInstance.balanceOf.call(account_one).then(function(balance){ |
54 |
| - account_one_starting_balance = balance.toNumber(); |
55 |
| - // check balance for account 2 |
56 |
| - return tokenInstance.balanceOf.call(account_two); |
57 |
| - }).then(function(balance){ |
58 |
| - account_two_starting_balance = balance.toNumber(); |
59 |
| - return vanityInstance.reserve('vinay_035',{from:accounts[1]}); |
60 |
| - }).then(function(instance){ |
| 13 | + return vanityInstance.reserve('vinay_035',{from:accounts[1]}).then(function(instance){ |
61 | 14 | return vanityInstance.retrieveWalletForVanity.call('vinay_035');
|
62 | 15 | }).then(function(result) {
|
63 | 16 | assert.equal(result,accounts[1],"Should be able to retrive the same wallet address");
|
64 | 17 | return vanityInstance.retrieveVanityForWallet.call(accounts[1]);
|
65 | 18 | }).then(function(result) {
|
66 | 19 | assert.equal(result,'vinay_035',"Should be able to retrive the same vanity");
|
67 |
| - }).then(function() { |
68 |
| - return tokenInstance.balanceOf.call(account_one); |
69 |
| - }).then(function(balance) { |
70 |
| - account_one_ending_balance = balance.toNumber(); |
71 |
| - return tokenInstance.balanceOf.call(account_two); |
72 |
| - }).then(function(balance) { |
73 |
| - account_two_ending_balance = balance.toNumber(); |
74 |
| - assert.equal(account_one_ending_balance, account_one_starting_balance - amount, "Amount wasn't correctly taken from the sender"); |
75 |
| - assert.equal(account_two_ending_balance, account_two_starting_balance + amount, "Amount wasn't correctly sent to tokenAddress"); |
76 | 20 | }).catch(function(error){
|
77 | 21 | assert.isUndefined(error,"should be able to reserve a url")
|
78 | 22 | })
|
|
0 commit comments