Skip to content
This repository was archived by the owner on Sep 3, 2021. It is now read-only.

Async Crypto Endeavour #5

Merged
merged 12 commits into from
Nov 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
sudo: false
language: node_js
node_js:
- 4
- 5
- stable

matrix:
include:
- node_js: 4
env: CXX=g++-4.8
- node_js: 6
env: CXX=g++-4.8
- node_js: stable
env:
- SAUCE=true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sauce should be ran in a LTS version of Node.js

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- CXX=g++-4.8

# Make sure we have new NPM.
before_install:
Expand All @@ -14,12 +21,19 @@ script:
- npm test
- npm run coverage

addons:
firefox: 'latest'

before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start

after_success:
- npm run coverage-publish



addons:
firefox: 'latest'
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
[![Circle CI](https://circleci.com/gh/ipfs/js-cid.svg?style=svg)](https://circleci.com/gh/ipfs/js-cid)
[![Dependency Status](https://david-dm.org/ipfs/js-cid.svg?style=flat-square)](https://david-dm.org/ipfs/js-cid)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)
![](https://img.shields.io/badge/npm-%3E%3D3.0.0-orange.svg?style=flat-square)
![](https://img.shields.io/badge/Node.js-%3E%3D4.0.0-orange.svg?style=flat-square)

[![Sauce Test Status](https://saucelabs.com/browser-matrix/ipfs-js-cid.svg)](https://saucelabs.com/u/ipfs-js-cid)

> CID implementation in JavaScript.

Expand Down
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
"name": "cids",
"version": "0.2.0",
"description": "cid implementation",
"main": "lib/index.js",
"jsnext:main": "src/index.js",
"main": "src/index.js",
"scripts": {
"test:node": "aegir-test node",
"lint": "aegir-lint",
Expand Down Expand Up @@ -40,13 +39,13 @@
"multihashes": "^0.2.2"
},
"devDependencies": {
"aegir": "^8.0.1",
"aegir": "^9.0.1",
"chai": "^3.5.0",
"multihashing": "^0.2.1",
"pre-commit": "^1.1.2"
"multihashing-async": "^0.2.0",
"pre-commit": "^1.1.3"
},
"engines": {
"node": ">=4.2.2"
"node": ">=4.0.0"
},
"contributors": [
"David Dias <[email protected]>",
Expand Down
21 changes: 12 additions & 9 deletions test/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

const expect = require('chai').expect
const multihash = require('multihashes')
const multihashing = require('multihashing')
const multihashing = require('multihashing-async')

const CID = require('../src')

Expand All @@ -20,17 +20,20 @@ describe('CID', () => {
expect(cid.toBaseEncodedString()).to.be.eql(mhStr)
})

it('handles Buffer multihash', () => {
const mh = multihashing(Buffer('hello world'), 'sha2-256')
const mhStr = 'QmaozNR7DZHQK1ZcU9p7QdrshMvXqWK6gpu5rmrkPdT3L4'
it('handles Buffer multihash', (done) => {
multihashing(Buffer('hello world'), 'sha2-256', (err, mh) => {
expect(err).to.not.exist
const mhStr = 'QmaozNR7DZHQK1ZcU9p7QdrshMvXqWK6gpu5rmrkPdT3L4'

const cid = new CID(mh)
const cid = new CID(mh)

expect(cid).to.have.property('codec', 'dag-pb')
expect(cid).to.have.property('version', 0)
expect(cid).to.have.property('multihash').that.eql(mh)
expect(cid).to.have.property('codec', 'dag-pb')
expect(cid).to.have.property('version', 0)
expect(cid).to.have.property('multihash').that.eql(mh)

expect(cid.toBaseEncodedString()).to.be.eql(mhStr)
expect(cid.toBaseEncodedString()).to.be.eql(mhStr)
done()
})
})

it('create by parts', () => {
Expand Down