Skip to content
This repository has been archived by the owner on Mar 8, 2020. It is now read-only.

Commit

Permalink
Add code coverage, VSCode debug configuration, and updated README.md (#…
Browse files Browse the repository at this point in the history
…54)

* Add code coverage, VSCode debug configuration, and updated README.md

* Disable code coverage until after release
  • Loading branch information
Simon Stone committed Jun 7, 2017
1 parent fcaa9e4 commit 4ed8ce1
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 7 deletions.
24 changes: 24 additions & 0 deletions 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
}
]
}
10 changes: 5 additions & 5 deletions packages/basic-sample-network/README.md
Expand Up @@ -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!
25 changes: 23 additions & 2 deletions packages/basic-sample-network/package.json
Expand Up @@ -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",
Expand Down Expand Up @@ -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": [
Expand All @@ -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
}
}

0 comments on commit 4ed8ce1

Please sign in to comment.