var DetherTx = artifacts.require("./DetherTx.sol");

contract('DetherTx', function(accounts) {
  it("add a account", () => {
    var customer1 = accounts[0]
    var customer2 = accounts[1]
    var customer3 = accounts[2]
    var customer4 = accounts[3]

    let structUser = ["Bob", 0, 0, 0, 123, 0]

    return DetherTx.new().then((instance) => {
      dether = instance
      return dether.addAccount("Bob", 0, 0, 0, 123, 0)
    }).then(() => {
      return dether.addAccount.call("Bob", 0, 0, 0, 123, 0)
    }).then((result) => {
      assert.equal(result[0].toString(), "Bob", "error username")
      assert.equal(result[1].toNumber(), 0, "error balance")
      assert.equal(result[2].toNumber(), 0, "error volume")
      assert.equal(result[3].toNumber(), 0, "error nb transaction")
      assert.equal(result[4].toNumber(), 123, "error localization")
      assert.equal(result[5].toNumber(), 0, "error comment id")
    })
  })

  it("should put 1 DetherTx in the first account", () => {
    return DetherTx.deployed().then((instance) => {
      detherTx = instance;
      return detherTx.deposit.call({value: web3.toWei(42, "ether"), from: accounts[0]})
    })
    .then(result => {
      assert.equal(result.toNumber(), 42000000000000000000, "error balance")
    })
  })
});

@@ -99,32 +99,56 @@
 t(%22add a account
+, deposit fund, sendCoin
 %22, () =%3E %7B%0A    v
@@ -138,24 +138,24 @@
 n%22, () =%3E %7B%0A
-
     var cust
@@ -460,28 +460,20 @@
 hen(
-() =%3E %7B
 %0A      
-return
+() =%3E
  det
@@ -524,24 +524,21 @@
     
-%7D
 ).then(
-(
 result
-)
  =%3E 
@@ -934,154 +934,211 @@
     
-%7D)%0A  %7D)%0A%0A  it(%22should put 1 DetherTx in the first account%22, () =%3E %7B%0A    return DetherTx.deployed().then((instance) =%3E %7B%0A      detherTx = inst
+  return dether.deposit(%7Bvalue: 42000000, from: accounts%5B0%5D%7D)%0A    %7D).then(() =%3E dether.getBalance.call(accounts%5B0%5D)%0A    ).then(result =%3E %7B%0A      assert.equal(result.toNumber(), 42000000, %22error bal
 ance
-;
+%22)
 %0A   
@@ -1157,57 +1157,42 @@
 ther
-Tx.deposit.call(%7Bvalue: web3.toWei(42, %22ether%22)
+.sendCoin(accounts%5B1%5D, 10000000
 , 
+%7B
 from
@@ -1213,21 +1213,69 @@
 )%0A    %7D)
+.then(() =%3E dether.getBalance.call(accounts%5B0%5D)
 %0A    
+)
 .then(re
@@ -1274,39 +1274,190 @@
 .then(result =%3E 
-%7B%0A     
+assert.equal(result.toNumber(), 32000000, %22error balance customer1 after transaction%22)%0A    ).then(() =%3E dether.getBalance.call(accounts%5B1%5D)%0A  ).then(result =%3E
  assert.equal(re
@@ -1477,23 +1477,10 @@
 (), 
-420000000000000
+99
 0000
@@ -1500,16 +1500,38 @@
 ance
-%22)%0A    %7D
+ customer2 after transaction%22)
 )%0A  

add test sendCoin()