From 6f5aacde628b3a12f44c2a54f0a615d77e5d81d5 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Sun, 21 Jun 2015 13:04:31 -0400 Subject: [PATCH] Created Test Driven Development (markdown) --- Test-Driven-Development.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Test-Driven-Development.md diff --git a/Test-Driven-Development.md b/Test-Driven-Development.md new file mode 100644 index 0000000..74dd7e1 --- /dev/null +++ b/Test-Driven-Development.md @@ -0,0 +1,31 @@ +Tests +====== + +You can run specs with ```embark spec```, it will run any files ending *_spec.js under ```spec/```. + +Embark includes a testing lib to fastly run & test your contracts in a EVM. + +```Javascript +# spec/contracts/simple_storage_spec.js +EmbarkSpec = require('embark-framework').Tests; + +describe("SimpleStorage", function() { + beforeAll(function() { + // equivalent to initializing SimpleStorage with param 150 + SimpleStorage = EmbarkSpec.request("SimpleStorage", [150]); + }); + + it("should set constructor value", function() { + expect(SimpleStorage.storedData()).toEqual('150'); + }); + + it("set storage value", function() { + SimpleStorage.set(100); + expect(SimpleStorage.get()).toEqual('100'); + }); + +}) + +Embark uses [Jasmine](https://jasmine.github.io/2.3/introduction.html) by default, but you can use any testing framework you want. + +``` \ No newline at end of file