Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
Closed
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
19 changes: 19 additions & 0 deletions submodules/ipfs-blocks/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "ipfs-blocks",
"version": "0.0.0",
"description": "subsystem of ipfs that provides or coordinates block retrieval for the other subsystems.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"ipfs",
"block",
"retrieval"
],
"author": "Juan Benet <juan@benet.ai> (http://juan.benet.ai/)",
"license": "MIT",
"dependencies": {
"multihashes": "^0.1.2"
}
}
2 changes: 1 addition & 1 deletion submodules/ipfs-cli/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Adder.prototype.addPath = function(p, cb) {
if (self.opts.recursive)
self.addTree(p, cb)
else
console.log(p + ': ignored (use -r for recursive)')
console.error(p + ': ignored (use -r for recursive)')
}
else if (stat.isFile())
self.addBlock(p, cb)
Expand Down
7 changes: 5 additions & 2 deletions submodules/ipfs-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@
"untildify": "^0.1.0",
"xtend": "^3.0.0"
},
"devDependencies": {},
"devDependencies": {
"tap": "^0.4.12",
"tape": "^2.14.0"
},
"scripts": {
"test": "node test.js"
"test": "tap test/index.js"
},
"keywords": [
"ipfs",
Expand Down
1 change: 1 addition & 0 deletions submodules/ipfs-cli/test/fixtures/foo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ipfs-cli-test-file-foo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ipfs-cli-test-folder/bar/baz
1 change: 1 addition & 0 deletions submodules/ipfs-cli/test/fixtures/ipfs-cli-test-folder/foo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ipfs-cli-test-folder/foo
1 change: 1 addition & 0 deletions submodules/ipfs-cli/test/fixtures/ipfs-cli-test-folder/qux
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ipfs-cli-test-folder/qux
144 changes: 144 additions & 0 deletions submodules/ipfs-cli/test/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
var test = require('tape');
var cp = require('child_process');
var path = require('path');

var fixturesPath = path.join(__dirname, 'fixtures');
var opts = { cwd: fixturesPath };

test('add single file', function (t) {
t.plan(3);

cp.exec('ipfs add foo', opts, function(err, stdout, stderr) {

var expectedStdout = 'foo: added block /5duKSVkSnhkgrxPH5VPkAKEp85e455\n';

t.error(err);
t.equal(stdout, expectedStdout, 'Correct stdout');
t.equal(stderr, '', 'No output on stderr');
});
});

test('return error when folder is added without `-r` flag', function (t) {
t.plan(3);

cp.exec('ipfs add ipfs-cli-test-folder/', opts, function(err, stdout, stderr) {

var expectedStderr = 'ipfs-cli-test-folder/: ignored (use -r for recursive)\n';

t.error(err);
t.equal(stdout, '', 'No output on stdout');
t.equal(stderr, expectedStderr, 'Correct stderr');
});
});

// This test is flaky since the order of the output is not deterministic.
test('add a folder', function (t) {
t.plan(3);

cp.exec('ipfs add -r ipfs-cli-test-folder/', opts, function(err, stdout, stderr) {

var expectedStdout = [
'ipfs-cli-test-folder/foo: added block /5duGBb9uHuKx6Ws85NhQE8Vkw1Lkjm',
'ipfs-cli-test-folder/qux: added block /5dry7LqtUiY1EQotqiigJxS2e3tvxx',
'ipfs-cli-test-folder/bar/baz: added block /5dtpFqU7B9Lp2oieyQwrhiAGBxwwCF',
'ipfs-cli-test-folder/bar: added tree /5dtDk8iQKBTMHpKnyrvkGUdDoRCoog',
'ipfs-cli-test-folder/: added tree /5duMCCrptmJ7mX1hvzjZByrwqrebeh'
].join('\n') + '\n';

t.error(err);
t.equal(stdout, expectedStdout, 'Correct stdout');
t.equal(stderr, '', 'No output on stderr');
});
});

test('list tree (w/ blocks & subtrees)', function (t) {
t.plan(3);

cp.exec('ipfs ls /5duMCCrptmJ7mX1hvzjZByrwqrebeh', opts, function(err, stdout, stderr) {

var expectedStdout = [
'5dtDk8iQKBTMHpKnyrvkGUdDoRCoog 72 bar',
'5duGBb9uHuKx6Ws85NhQE8Vkw1Lkjm 27 foo',
'5dry7LqtUiY1EQotqiigJxS2e3tvxx 27 qux'
].join('\n') + '\n';

t.error(err);
t.equal(stdout, expectedStdout, 'Correct stdout');
t.equal(stderr, '', 'No output on stderr');
});
});

test('list tree (w/ blocks only)', function (t) {
t.plan(3);

cp.exec('ipfs ls 5dtDk8iQKBTMHpKnyrvkGUdDoRCoog', opts, function(err, stdout, stderr) {

var expectedStdout = '5dtpFqU7B9Lp2oieyQwrhiAGBxwwCF 31 baz\n';

t.error(err);
t.equal(stdout, expectedStdout, 'Correct stdout');
t.equal(stderr, '', 'No output on stderr');
});
});

test('cat a block', function (t) {
t.plan(3);

cp.exec('ipfs cat 5dtpFqU7B9Lp2oieyQwrhiAGBxwwCF', opts, function(err, stdout, stderr) {

var expectedStdout = 'ipfs-cli-test-folder/bar/baz\n';

t.error(err);
t.equal(stdout, expectedStdout, 'Correct stdout');
t.equal(stderr, '', 'No output on stderr');
});
});

// The behavior of cat-ing a tree hash is not yet defined. In the future, there
// may be a special "index" file (like index.html or index.js) or possibly
// support for various index strategies (depending on the type of index content
// the seeking process wants);
test('cat a tree', function (t) {
t.plan(3);

cp.exec('ipfs cat 5dtDk8iQKBTMHpKnyrvkGUdDoRCoog', opts, function(err, stdout, stderr) {

var expectedStdout = '\n\x04\b\x00\x10\x00';

t.error(err);
t.equal(stdout, expectedStdout, 'Correct stdout');
t.equal(stderr, '', 'No output on stderr');
});
});

test('cat a block via a tree path', function (t) {
t.plan(3);

cp.exec('ipfs cat 5dtDk8iQKBTMHpKnyrvkGUdDoRCoog/baz', opts, function(err, stdout, stderr) {

var expectedStdout = 'ipfs-cli-test-folder/bar/baz\n';

t.error(err);
t.equal(stdout, expectedStdout, 'Correct stdout');
t.equal(stderr, '', 'No output on stderr');
});
});

test('recursively list child references for a reference', function (t) {
t.plan(3);

cp.exec('ipfs refs -r /5duMCCrptmJ7mX1hvzjZByrwqrebeh', opts, function(err, stdout, stderr) {

var expectedStdout = [
'5dtDk8iQKBTMHpKnyrvkGUdDoRCoog',
'5duGBb9uHuKx6Ws85NhQE8Vkw1Lkjm',
'5dry7LqtUiY1EQotqiigJxS2e3tvxx',
'5dtpFqU7B9Lp2oieyQwrhiAGBxwwCF'
].join('\n') + '\n';

t.error(err);
t.equal(stdout, expectedStdout, 'Correct stdout');
t.equal(stderr, '', 'No output on stderr');
});
});

25 changes: 25 additions & 0 deletions submodules/ipfs-mount/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "ipfs-mount",
"version": "0.0.0",
"description": "Mount ipfs paths via FUSE",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"ipfs",
"FUSE",
"filesystem"
],
"author": "Juan Benet <juan@benet.ai> (http://juan.benet.ai/)",
"license": "MIT",
"dependencies": {
"base58-native": "^0.1.4",
"fuse4js": "^0.1.9",
"lodash.map": "^2.4.1",
"mkdirp": "^0.5.0",
"prettysize": "0.0.3",
"rimraf": "^2.2.8",
"single-line-log": "^0.4.1"
}
}