diff --git a/templates/boilerplate/test/contract_spec.js b/templates/boilerplate/test/contract_spec.js index 5fa719de5..200301761 100644 --- a/templates/boilerplate/test/contract_spec.js +++ b/templates/boilerplate/test/contract_spec.js @@ -1,24 +1,25 @@ -//describe("SimpleStorage", function() { -// this.timeout(0); -// before(function(done) { -// this.timeout(0); -// var contractsConfig = { -// "SimpleStorage": { -// args: [100] -// } -// }; -// EmbarkSpec.deployAll(contractsConfig, () => { done() }); -// }); -// -// it("should set constructor value", async function() { -// let result = await SimpleStorage.methods.storedData().call(); -// assert.equal(result, 100); -// }); -// -// it("set storage value", async function() { -// await SimpleStorage.methods.set(150).send(); -// let result = await SimpleStorage.methods.get().call(); -// assert.equal(result, 150); -// }); -// -//}); +// /*global contract, config, it, assert*/ +/*const SimpleStorage = require('Embark/contracts/SimpleStorage'); + +config({ + contracts: { + "SimpleStorage": { + args: [100] + } + } +}); + +contract("SimpleStorage", function () { + this.timeout(0); + + it("should set constructor value", async function () { + let result = await SimpleStorage.methods.storedData().call(); + assert.strictEqual(parseInt(result, 10), 100); + }); + + it("set storage value", async function () { + await SimpleStorage.methods.set(150).send(); + let result = await SimpleStorage.methods.get().call(); + assert.strictEqual(parseInt(result, 10), 150); + }); +});*/ diff --git a/templates/demo/test/simple_storage_spec.js b/templates/demo/test/simple_storage_spec.js index 25855d70c..262cd291a 100644 --- a/templates/demo/test/simple_storage_spec.js +++ b/templates/demo/test/simple_storage_spec.js @@ -1,24 +1,25 @@ -describe("SimpleStorage", function() { +/*global contract, config, it, assert*/ +const SimpleStorage = require('Embark/contracts/SimpleStorage'); + +config({ + contracts: { + "SimpleStorage": { + args: [100] + } + } +}); + +contract("SimpleStorage", function () { this.timeout(0); - before(function(done) { - this.timeout(0); - var contractsConfig = { - "SimpleStorage": { - args: [100] - } - }; - EmbarkSpec.deployAll(contractsConfig, () => { done() }); - }); - it("should set constructor value", async function() { + it("should set constructor value", async function () { let result = await SimpleStorage.methods.storedData().call(); - assert.equal(result, 100); + assert.strictEqual(parseInt(result, 10), 100); }); - it("set storage value", async function() { + it("set storage value", async function () { await SimpleStorage.methods.set(150).send(); let result = await SimpleStorage.methods.get().call(); - assert.equal(result, 150); + assert.strictEqual(parseInt(result, 10), 150); }); - }); diff --git a/templates/simple/test/contract_spec.js b/templates/simple/test/contract_spec.js index 5fa719de5..200301761 100644 --- a/templates/simple/test/contract_spec.js +++ b/templates/simple/test/contract_spec.js @@ -1,24 +1,25 @@ -//describe("SimpleStorage", function() { -// this.timeout(0); -// before(function(done) { -// this.timeout(0); -// var contractsConfig = { -// "SimpleStorage": { -// args: [100] -// } -// }; -// EmbarkSpec.deployAll(contractsConfig, () => { done() }); -// }); -// -// it("should set constructor value", async function() { -// let result = await SimpleStorage.methods.storedData().call(); -// assert.equal(result, 100); -// }); -// -// it("set storage value", async function() { -// await SimpleStorage.methods.set(150).send(); -// let result = await SimpleStorage.methods.get().call(); -// assert.equal(result, 150); -// }); -// -//}); +// /*global contract, config, it, assert*/ +/*const SimpleStorage = require('Embark/contracts/SimpleStorage'); + +config({ + contracts: { + "SimpleStorage": { + args: [100] + } + } +}); + +contract("SimpleStorage", function () { + this.timeout(0); + + it("should set constructor value", async function () { + let result = await SimpleStorage.methods.storedData().call(); + assert.strictEqual(parseInt(result, 10), 100); + }); + + it("set storage value", async function () { + await SimpleStorage.methods.set(150).send(); + let result = await SimpleStorage.methods.get().call(); + assert.strictEqual(parseInt(result, 10), 150); + }); +});*/