From 32e676384d0437da1e3842b96c499698f096ac78 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Wed, 30 May 2018 17:35:54 -0400 Subject: [PATCH] change another storage test --- lib/tests/test.js | 7 +++-- .../test/another_storage_spec.js | 29 ++++++++++--------- .../contracts_app/test/simple_storage_spec.js | 2 +- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/lib/tests/test.js b/lib/tests/test.js index 8049ceb09..4e2b8e2f7 100644 --- a/lib/tests/test.js +++ b/lib/tests/test.js @@ -81,6 +81,9 @@ class Test { if (!callback) { callback = function () {}; } + if (!options.contracts) { + throw new Error(__('No contracts specified in the options')); + } this.options = utils.recursiveMerge(this.options, options); this.simOptions = this.options.simulatorOptions || {}; this.ready = false; @@ -145,8 +148,8 @@ class Test { } require(module) { - if (module.startsWith('contracts/')) { - const contractName = module.substr(10); + if (module.startsWith('Embark/contracts/')) { + const contractName = module.substr(17); if (!this.engine.contractsManager.contracts[contractName]) { throw new Error(__('No contract with the name %s', contractName)); } diff --git a/test_apps/contracts_app/test/another_storage_spec.js b/test_apps/contracts_app/test/another_storage_spec.js index 255a5d4b8..82ee75fb5 100644 --- a/test_apps/contracts_app/test/another_storage_spec.js +++ b/test_apps/contracts_app/test/another_storage_spec.js @@ -1,21 +1,24 @@ +/*global contract, config, it, embark*/ +const assert = require('assert'); +const AnotherStorage = embark.require('Embark/contracts/AnotherStorage'); +const SimpleStorage = embark.require('Embark/contracts/SimpleStorage'); + +config({ + contracts: { + "SimpleStorage": { + args: [100] + }, + "AnotherStorage": { + args: ["$SimpleStorage"] + } + } +}); + contract("AnotherStorage", function() { this.timeout(0); - before(function(done) { - this.timeout(0); - var contractsConfig = { - "SimpleStorage": { - args: [100] - }, - "AnotherStorage": { - args: ["$SimpleStorage"] - } - }; - EmbarkSpec.deployAll(contractsConfig, () => { done() }); - }); it("set SimpleStorage address", async function() { let result = await AnotherStorage.methods.simpleStorageAddress().call(); assert.equal(result.toString(), SimpleStorage.options.address); }); - }); diff --git a/test_apps/contracts_app/test/simple_storage_spec.js b/test_apps/contracts_app/test/simple_storage_spec.js index f8aeccf2a..0eba871ab 100644 --- a/test_apps/contracts_app/test/simple_storage_spec.js +++ b/test_apps/contracts_app/test/simple_storage_spec.js @@ -1,6 +1,6 @@ /*global contract, config, it, embark*/ const assert = require('assert'); -const SimpleStorage = embark.require('contracts/SimpleStorage'); +const SimpleStorage = embark.require('Embark/contracts/SimpleStorage'); config({ contracts: {