From 5fb4e3330c9e55c7a764064a9e0f4a073b83f5b8 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Fri, 1 Jun 2018 13:44:30 -0400 Subject: [PATCH] conflict in packagelock --- .../test/array_references_spec.js | 4 +- test_apps/contracts_app/test/lib_test_spec.js | 33 ++-- test_apps/contracts_app/test/token_spec.js | 163 +++++++++--------- 3 files changed, 98 insertions(+), 102 deletions(-) diff --git a/test_apps/contracts_app/test/array_references_spec.js b/test_apps/contracts_app/test/array_references_spec.js index 719b5146..4ca15ab4 100644 --- a/test_apps/contracts_app/test/array_references_spec.js +++ b/test_apps/contracts_app/test/array_references_spec.js @@ -31,12 +31,12 @@ contract("SomeContract", function() { it("set MyToken2 address", async function() { let address = await SomeContract.methods.addr_1().call(); - assert.equal(address, MyToken2.options.address); + assert.strictEqual(address, MyToken2.options.address); }); it("set SimpleStorage address", async function() { let address = await SomeContract.methods.addr_2().call(); - assert.equal(address, SimpleStorage.options.address); + assert.strictEqual(address, SimpleStorage.options.address); }); }); diff --git a/test_apps/contracts_app/test/lib_test_spec.js b/test_apps/contracts_app/test/lib_test_spec.js index 18aef2c9..7d158b69 100644 --- a/test_apps/contracts_app/test/lib_test_spec.js +++ b/test_apps/contracts_app/test/lib_test_spec.js @@ -1,22 +1,23 @@ +/*global contract, config, it, embark*/ +const assert = require('assert'); +const Test2 = embark.require('Embark/contracts/Test2'); + +config({ + contracts: { + "Test2": { + }, + "ZAMyLib": { + }, + "ZAMyLib2": { + "deploy": true + } + } +}); + contract("Test", function() { - before(function(done) { - this.timeout(0); - var contractsConfig = { - "Test2": { - }, - "ZAMyLib": { - }, - "ZAMyLib2": { - "deploy": true - } - }; - - EmbarkSpec.deployAll(contractsConfig, () => { done() }); - }); - it("should call library correctly", async function() { let result = await Test2.methods.testAdd().call(); - assert.equal(result, 3); + assert.strictEqual(parseInt(result, 10), 3); }); }); diff --git a/test_apps/contracts_app/test/token_spec.js b/test_apps/contracts_app/test/token_spec.js index f101a789..5390e665 100644 --- a/test_apps/contracts_app/test/token_spec.js +++ b/test_apps/contracts_app/test/token_spec.js @@ -1,87 +1,82 @@ +/*global describe, config, it, embark*/ +const assert = require('assert'); +const Token = embark.require('Embark/contracts/Token'); +const MyToken = embark.require('Embark/contracts/MyToken'); +const MyToken2 = embark.require('Embark/contracts/MyToken2'); +const AlreadyDeployedToken = embark.require('Embark/contracts/AlreadyDeployedToken'); +const Test = embark.require('Embark/contracts/Test'); -describe("Token", function() { - - this.timeout(0); - before(function(done) { - this.timeout(0); - - //config({ - // node: "http://localhost:8545" - //}); - - var contractsConfig = { - "ZAMyLib": { - }, - "Token": { - }, - "SimpleStorage": { - args: [100] - }, - "AnotherStorage": { - args: ["$SimpleStorage"] - }, - "Token": { - deploy: false, - args: [1000] - }, - "MyToken": { - instanceOf: "Token" - }, - "MyToken2": { - instanceOf: "Token", - args: [2000] - }, - "AlreadyDeployedToken": { - "address": "0xCAFECAFECAFECAFECAFECAFECAFECAFECAFECAFE", - instanceOf: "Token" - }, - "Test": { - onDeploy: [ - "Test.methods.changeAddress('$MyToken').send()" - ] - }, - "ContractArgs": { - "args": { - "initialValue": 123, - "_addresses": ["$MyToken2", "$SimpleStorage"] - } - }, - "SomeContract": { - "args": [ - ["$MyToken2", "$SimpleStorage"], - 100 - ] +config({ + contracts: { + ZAMyLib: {}, + SimpleStorage: { + args: [100] + }, + AnotherStorage: { + args: ["$SimpleStorage"] + }, + Token: { + deploy: false, + args: [1000] + }, + MyToken: { + instanceOf: "Token" + }, + MyToken2: { + instanceOf: "Token", + args: [2000] + }, + AlreadyDeployedToken: { + address: "0xCAFECAFECAFECAFECAFECAFECAFECAFECAFECAFE", + instanceOf: "Token" + }, + Test: { + onDeploy: ["Test.methods.changeAddress('$MyToken').send()"] + }, + ContractArgs: { + args: { + initialValue: 123, + _addresses: ["$MyToken2", "$SimpleStorage"] } - }; - EmbarkSpec.deployAll(contractsConfig, () => { done() }); - }); - - it("not deploy Token", function() { - assert.equal(Token.address, ""); - }); - - it("not deploy MyToken and MyToken2", function() { - assert.notEqual(MyToken.address, ""); - assert.notEqual(MyToken2.address, ""); - }); - - it("set MyToken Balance correctly", async function() { - let result = await MyToken.methods._supply().call(); - assert.equal(result, 1000); - }); - - it("set MyToken2 Balance correctly", async function() { - let result = await MyToken2.methods._supply().call(); - assert.equal(result, 2000); - }); - - it("get right address", function() { - assert.equal(AlreadyDeployedToken.address, "0xCAFECAFECAFECAFECAFECAFECAFECAFECAFECAFE"); - }); - - it("should use onDeploy", async function() { - let result = await Test.methods.addr().call(); - assert.equal(result, MyToken.address) - }); - + }, + SomeContract: { + args: [ + ["$MyToken2", "$SimpleStorage"], + 100 + ] + } + } +}); + +describe("Token", function () { + this.timeout(0); + + it("not deploy Token", function () { + assert.strictEqual(Token.address, undefined); + }); + + it("should deploy MyToken and MyToken2", function () { + assert.ok(MyToken.options.address); + assert.ok(MyToken2.options.address); + }); + + it("set MyToken Balance correctly", async function () { + let result = await MyToken.methods._supply().call(); + assert.strictEqual(parseInt(result, 10), 1000); + }); + + it("set MyToken2 Balance correctly", async function () { + let result = await MyToken2.methods._supply().call(); + assert.strictEqual(parseInt(result, 10), 2000); + }); + + it("get right address", function () { + assert.strictEqual(AlreadyDeployedToken.options.address.toLowerCase(), + "0xCAFECAFECAFECAFECAFECAFECAFECAFECAFECAFE".toLowerCase()); + }); + + it("should use onDeploy", async function () { + let result = await Test.methods.addr().call(); + assert.strictEqual(result, MyToken.options.address); + }); });