Skip to content

Commit

Permalink
Add Coveralls for code coverage tracking. Badge and updates to README
Browse files Browse the repository at this point in the history
  • Loading branch information
davidarvan committed Apr 5, 2020
1 parent b80dbf3 commit 68ce1bf
Show file tree
Hide file tree
Showing 18 changed files with 82 additions and 28 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -21,6 +21,9 @@ lib-cov
# nyc test coverage
.nyc_output

# Coveralls config
.coveralls.yml

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

Expand Down
2 changes: 1 addition & 1 deletion bin/run.tests.sh
Expand Up @@ -3,10 +3,10 @@ source $(dirname ${0})/base.sh

info "Running all tests"

cd $SRC_JS_OPENTIMESTAMP

info "Checking code lint"

cd $SRC_JS_OPENTIMESTAMP
npm run lint


Expand Down
4 changes: 2 additions & 2 deletions docs/coverage/clover.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1585584114059" clover="3.2.0">
<project timestamp="1585584114060" name="All files">
<coverage generated="1586091106317" clover="3.2.0">
<project timestamp="1586091106317" name="All files">
<metrics statements="259" coveredstatements="259" conditionals="77" coveredconditionals="77" methods="47" coveredmethods="47" elements="383" coveredelements="383" complexity="0" loc="259" ncloc="259" packages="1" files="4" classes="4"/>
<file name="calendar.js" path="/Users/david/src/opendataformats/opentimestamp/src/javascript/opentimestamp/lib/calendar.js">
<metrics statements="34" coveredstatements="34" conditionals="4" coveredconditionals="4" methods="9" coveredmethods="9"/>
Expand Down
2 changes: 1 addition & 1 deletion docs/coverage/lcov-report/calendar.js.html
Expand Up @@ -616,7 +616,7 @@ <h1><a href="index.html">All files</a> calendar.js</h1>
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
at Mon Mar 30 2020 18:01:54 GMT+0200 (Central European Summer Time)
at Sun Apr 05 2020 14:51:46 GMT+0200 (Central European Summer Time)
</div>
</div>
<script src="prettify.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion docs/coverage/lcov-report/execution.js.html
Expand Up @@ -505,7 +505,7 @@ <h1><a href="index.html">All files</a> execution.js</h1>
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
at Mon Mar 30 2020 18:01:54 GMT+0200 (Central European Summer Time)
at Sun Apr 05 2020 14:51:46 GMT+0200 (Central European Summer Time)
</div>
</div>
<script src="prettify.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion docs/coverage/lcov-report/index.html
Expand Up @@ -140,7 +140,7 @@ <h1>All files</h1>
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
at Mon Mar 30 2020 18:01:54 GMT+0200 (Central European Summer Time)
at Sun Apr 05 2020 14:51:46 GMT+0200 (Central European Summer Time)
</div>
</div>
<script src="prettify.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion docs/coverage/lcov-report/parser.js.html
Expand Up @@ -550,7 +550,7 @@ <h1><a href="index.html">All files</a> parser.js</h1>
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
at Mon Mar 30 2020 18:01:54 GMT+0200 (Central European Summer Time)
at Sun Apr 05 2020 14:51:46 GMT+0200 (Central European Summer Time)
</div>
</div>
<script src="prettify.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion docs/coverage/lcov-report/timestamp.js.html
Expand Up @@ -1462,7 +1462,7 @@ <h1><a href="index.html">All files</a> timestamp.js</h1>
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
at Mon Mar 30 2020 18:01:54 GMT+0200 (Central European Summer Time)
at Sun Apr 05 2020 14:51:46 GMT+0200 (Central European Summer Time)
</div>
</div>
<script src="prettify.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion docs/jsdocs/Timestamp.html
Expand Up @@ -3183,7 +3183,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Timestamp
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Mon Mar 30 2020 18:01:56 GMT+0200 (Central European Summer Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Sun Apr 05 2020 14:51:51 GMT+0200 (Central European Summer Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/jsdocs/index.html
Expand Up @@ -580,7 +580,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Timestamp
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Mon Mar 30 2020 18:01:56 GMT+0200 (Central European Summer Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Sun Apr 05 2020 14:51:51 GMT+0200 (Central European Summer Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/jsdocs/index.js.html
Expand Up @@ -53,7 +53,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Timestamp
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Mon Mar 30 2020 18:01:56 GMT+0200 (Central European Summer Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Sun Apr 05 2020 14:51:51 GMT+0200 (Central European Summer Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/jsdocs/lib_calendar.js.html
Expand Up @@ -226,7 +226,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Timestamp
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Mon Mar 30 2020 18:01:56 GMT+0200 (Central European Summer Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Sun Apr 05 2020 14:51:51 GMT+0200 (Central European Summer Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/jsdocs/lib_execution.js.html
Expand Up @@ -189,7 +189,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Timestamp
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Mon Mar 30 2020 18:01:56 GMT+0200 (Central European Summer Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Sun Apr 05 2020 14:51:51 GMT+0200 (Central European Summer Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/jsdocs/lib_parser.js.html
Expand Up @@ -204,7 +204,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Timestamp
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Mon Mar 30 2020 18:01:56 GMT+0200 (Central European Summer Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Sun Apr 05 2020 14:51:51 GMT+0200 (Central European Summer Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/jsdocs/lib_timestamp.js.html
Expand Up @@ -508,7 +508,7 @@ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Timestamp
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Mon Mar 30 2020 18:01:56 GMT+0200 (Central European Summer Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Sun Apr 05 2020 14:51:51 GMT+0200 (Central European Summer Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
45 changes: 35 additions & 10 deletions src/javascript/opentimestamp/README.md
Expand Up @@ -2,6 +2,8 @@

[![Build Status](https://travis-ci.com/OpenDataFormats/opentimestamp.svg?branch=master)](https://travis-ci.com/OpenDataFormats/opentimestamp)

[![Coverage Status](https://coveralls.io/repos/github/OpenDataFormats/opentimestamp/badge.svg?branch=master)](https://coveralls.io/github/OpenDataFormats/opentimestamp?branch=master)

# OpenTimestamp

ECMAScript/JS 6 Node library for creating compact, portable [Open Timestamps](https://en.wikipedia.org/wiki/OpenTimestamps) attestations.
Expand Down Expand Up @@ -115,14 +117,14 @@ This can be set during creation by calling `.setIdentity()`.

```javascript
timestamp.setIdentity(
'US',
'NY',
'New York',
'My Company',
'Engineering',
'Corp Eng',
'eng@example.com',
'John Smith',
'US', // Country Code
'NY', // State/Province
'New York', // City
'My Company', // Organization
'Engineering', // Section/Division
'Corp Eng', // Common Name
'eng@example.com', // Email Address
'John Smith', // Full Name
);
```

Expand All @@ -138,8 +140,12 @@ This can be set during creation by calling `.setLocation()`.

```javascript
timestamp.setLocation(
40.73111,
-73.99689,
40.73111, // Latitude
-73.99689, // Longitude
120, // Altitude, meters
10, // Accuracy, meters
217.39, // Direction, degrees
42, // Velocity
);
```

Expand Down Expand Up @@ -195,6 +201,25 @@ After some time has passed, the calendar server will submit a transaction to the
timestamp.update();
```

### Saving a Timestamp

Serialize the internal Timestamp protocol buffer to portable binary and save the data to a storage layer of choice; filesystem, database, etc.

```javascript
const /** @type {Buffer} */ data = timestamp.toBinary();
fs.writeFileSync('./myfile.timestamp', data);
```

### Loading a Timestamp

Loading the binary representation into the wrapped `OpenTimestamp` class is done by the static `.fromBinary` class method.

```javascript
const OpenTimestamp = require('opentimestamp');

const data = fs.readFileSync('./myfile.timestamp');
const timestamp = OpenTimestamp.fromBinary(data);
```

## Testing

Expand Down
27 changes: 26 additions & 1 deletion src/javascript/opentimestamp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions src/javascript/opentimestamp/package.json
@@ -1,6 +1,6 @@
{
"name": "opentimestamp",
"version": "0.1.8",
"version": "0.1.9",
"description": "ECMAScript/JS 6 Node library for creating compact, portable Open Timestamps attestations.",
"keywords": [
"opentimestamps",
Expand All @@ -16,7 +16,7 @@
"lint": "eslint .",
"lint-fix": "eslint . --fix",
"start": "node frontend.js",
"test": "jest",
"test": "jest && coveralls < ../../../docs/coverage/lcov.info",
"test:watch": "jest --watchAll"
},
"repository": {
Expand All @@ -36,6 +36,7 @@
"google-protobuf": "^3.9.1"
},
"devDependencies": {
"coveralls": "^3.0.11",
"eslint": "^5.6.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-plugin-import": "^2.14.0",
Expand Down

0 comments on commit 68ce1bf

Please sign in to comment.