mirror of https://github.com/embarklabs/embark.git
Created Test Driven Development (markdown)
parent
01a12116c7
commit
6f5aacde62
|
@ -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.
|
||||||
|
|
||||||
|
```
|
Loading…
Reference in New Issue