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

Commit 5e3ca3a

Browse files
committedJan 25, 2016
only missing local-storage-blob-store being able to store binary data
1 parent 8a5d52d commit 5e3ca3a

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed
 

‎karma.conf.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ module.exports = function (config) {
2323
},
2424
module: {
2525
loaders: [
26-
{ test: /\.json$/, loader: 'json' },
27-
{ test: /\.js$/, loader: 'transform?brfs' }
26+
{ test: /\.json$/, loader: 'json' }
2827
]
2928
}
3029
},

‎package.json

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"homepage": "https://github.com/ipfs/js-ipfs#readme",
3636
"devDependencies": {
3737
"async": "^1.5.2",
38+
"binary-loader": "0.0.1",
3839
"brfs": "^1.4.3",
3940
"chai": "^3.4.1",
4041
"fs-blob-store": "^5.2.1",

‎tests/test-core/browser.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,20 @@ const async = require('async')
55
const store = require('local-storage-blob-store')
66
const _ = require('lodash')
77

8-
var repoContext = require.context('raw!../repo-example', true)
8+
var repoContext = require.context('binary!../repo-example', true)
99

1010
describe('core', function () {
1111
before(function (done) {
1212
window.localStorage.clear()
1313

1414
var repoData = []
1515
repoContext.keys().forEach(function (key) {
16-
console.log(key)
16+
// console.log(key)
17+
var value = new Buffer(require('binary!./../repo-example/' + key.replace('./', '')), 'binary')
18+
console.log('+>', value.length)
1719
repoData.push({
1820
key: key.replace('./', ''),
19-
value: repoContext(key)
21+
value: new Buffer(require('binary!./../repo-example/' + key.replace('./', '')), 'binary')
2022
})
2123
})
2224

‎tests/test-core/test-block.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ const fs = require('fs')
88
const IPFS = require('../../src/ipfs-core')
99
const Block = require('ipfs-merkle-dag').Block
1010

11-
// const isNode = !global.window
11+
const isNode = !global.window
1212

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

16-
console.log('=>', fileA)
17+
// console.log('=>', fileA)
18+
// console.log('=>', fileA.length)
1719

1820
describe('block', () => {
1921
var ipfs
@@ -24,6 +26,9 @@ describe('block', () => {
2426
const mh = new Buffer(base58.decode(b58mh))
2527
ipfs.block.get(mh, (err, block) => {
2628
expect(err).to.not.exist
29+
console.log('->', fileA.length)
30+
console.log('->', block.data.length)
31+
2732
const eq = fileA.equals(block.data)
2833
expect(eq).to.equal(true)
2934
done()

0 commit comments

Comments
 (0)
This repository has been archived.