Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
Merge pull request #62 from xicombd/use-buffer-loader
Browse files Browse the repository at this point in the history
Use buffer-loader for tests
  • Loading branch information
daviddias committed Jan 28, 2016
2 parents 096bfae + b971337 commit 371efda
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
"homepage": "https://github.com/ipfs/js-ipfs#readme",
"devDependencies": {
"async": "^1.5.2",
"binary-loader": "0.0.1",
"brfs": "^1.4.3",
"buffer-loader": "0.0.1",
"chai": "^3.4.1",
"fs-blob-store": "^5.2.1",
"idb-plus-blob-store": "^1.0.0",
Expand All @@ -55,7 +55,6 @@
"ncp": "^2.0.0",
"nexpect": "^0.5.0",
"pre-commit": "^1.1.2",
"raw-loader": "^0.5.1",
"rimraf": "^2.4.4",
"standard": "^5.4.1",
"transform-loader": "^0.2.3",
Expand Down
2 changes: 1 addition & 1 deletion tests/test-core/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const async = require('async')
const store = require('idb-plus-blob-store')
const _ = require('lodash')

const repoContext = require.context('raw!./../repo-example', true)
const repoContext = require.context('buffer!./../repo-example', true)

const idb = window.indexedDB ||
window.mozIndexedDB ||
Expand Down
13 changes: 5 additions & 8 deletions tests/test-core/test-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,19 @@ const isNode = !global.window

const fileA = isNode
? fs.readFileSync(process.cwd() + '/tests/repo-example/blocks/12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07606bfdb812303d.data')
: new Buffer(require('binary!./../repo-example/blocks/12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07606bfdb812303d.data'), 'binary')
: require('buffer!./../repo-example/blocks/12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07606bfdb812303d.data')

// console.log('=>', fileA)
// console.log('=>', fileA.length)

describe('block', () => {
// TODO use arrow funtions again when https://github.com/webpack/webpack/issues/1944 is fixed
describe('block', function () {
var ipfs

it('get', done => {
it('get', function (done) {
ipfs = new IPFS()
const b58mh = 'QmVtU7ths96fMgZ8YSZAbKghyieq7AjxNdcqyVzxTt3qVe'
const mh = new Buffer(base58.decode(b58mh))
ipfs.block.get(mh, (err, block) => {
expect(err).to.not.exist
const eq = fileA.equals(block.data)
console.log(block)
expect(eq).to.equal(true)
done()
})
Expand Down Expand Up @@ -62,7 +59,7 @@ describe('block', () => {
})
})

it('stat', done => {
it('stat', function (done) {
const mh = new Buffer(base58
.decode('QmVtU7ths96fMgZ8YSZAbKghyieq7AjxNdcqyVzxTt3qVe'))
ipfs.block.stat(mh, (err, stats) => {
Expand Down

0 comments on commit 371efda

Please sign in to comment.