diff --git a/packages/basic-sample-network/.vscode/launch.json b/packages/basic-sample-network/.vscode/launch.json new file mode 100644 index 0000000..eb7543e --- /dev/null +++ b/packages/basic-sample-network/.vscode/launch.json @@ -0,0 +1,24 @@ +{ + // Use IntelliSense to learn about possible Node.js debug attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Launch Program", + "program": "${file}" + }, + { + "type": "node", + "protocol": "inspector", + "request": "launch", + "name": "Launch Program", + "program": "${workspaceRoot}/node_modules/.bin/_mocha", + "args": [ "-t", "0" ], + "cwd": "${workspaceRoot}", + "smartStep": true + } + ] +} \ No newline at end of file diff --git a/packages/basic-sample-network/README.md b/packages/basic-sample-network/README.md index 976af21..2d9b2af 100644 --- a/packages/basic-sample-network/README.md +++ b/packages/basic-sample-network/README.md @@ -2,16 +2,16 @@ This is the "Hello World" of Hyperledger Composer samples. -This sample defines a business network composed of a single asset type (`SampleAsset`), a single participant type (`SampleParticipant`), and a single transaction type (`SampleTransaction`). +This sample defines a business network composed of a single asset type (`SampleAsset`), a single participant type (`SampleParticipant`), a single transaction type (`SampleTransaction`), and a single event type (`SampleEvent`). -`SampleAssets` are owned by a `SampleParticipant`, and the value property on a `SampleAsset` can be modified by submitting a `SampleTransaction`. +`SampleAssets` are owned by a `SampleParticipant`, and the value property on a `SampleAsset` can be modified by submitting a `SampleTransaction`. The `SampleTransaction` emits a `SampleEvent` that notifies applications of the old and new values for each modified `SampleAsset`. To get started inside Hyperledger Composer you can click the Test tab and create instances of `SampleAsset` and `SampleParticipant`. Make sure that the owner property on the `SampleAsset` refers to a `SampleParticipant` that you have created. -You can then submit a `SampleTransaction`, making sure that the asset property refers to an asset that you created earlier. After the transaction has been processed you should see that the value property on the asset has been modified. +You can then submit a `SampleTransaction`, making sure that the asset property refers to an asset that you created earlier. After the transaction has been processed you should see that the value property on the asset has been modified, and that a `SampleEvent` has been emitted. -The logic for updating the asset when a `SampleTransaction` is processed is written in `logic.js`. +The logic for updating the asset when a `SampleTransaction` is processed is written in `sample.js`. -Don't forget you can import more advanced samples into Hyperledger Composer using the Import/Replace button. +Don't forget that you can import more advanced samples into Hyperledger Composer using the Import/Replace button. Have fun learning Hyperledger Composer! \ No newline at end of file diff --git a/packages/basic-sample-network/package.json b/packages/basic-sample-network/package.json index c7d0ce3..793c88a 100644 --- a/packages/basic-sample-network/package.json +++ b/packages/basic-sample-network/package.json @@ -10,7 +10,9 @@ "licchk": "license-check", "postlicchk": "npm run doc", "doc": "jsdoc --pedantic --recurse -c jsdoc.conf", - "test": "mocha -t 0 --recursive && cucumber-js" + "test-inner": "mocha --recursive && cucumber-js", + "test-cover": "nyc npm run test-inner", + "test": "npm run test-inner" }, "repository": { "type": "git", @@ -38,7 +40,8 @@ "license-check": "^1.1.5", "mkdirp": "^0.5.1", "mocha": "^3.2.0", - "moment": "^2.17.1" + "moment": "^2.17.1", + "nyc": "^11.0.2" }, "license-check-config": { "src": [ @@ -52,5 +55,23 @@ "blocking": true, "logInfo": false, "logError": true + }, + "nyc": { + "exclude": [ + "coverage/**", + "features/**", + "out/**", + "test/**" + ], + "reporter": [ + "text-summary", + "html" + ], + "all": true, + "check-coverage": true, + "statements": 100, + "branches": 100, + "functions": 100, + "lines": 100 } }