better rpc tests, sum up your channel usage
This commit is contained in:
parent
7ab65367c5
commit
7d5ff27900
@ -32,7 +32,10 @@ define([
|
|||||||
|
|
||||||
// test a non-existent RPC call
|
// test a non-existent RPC call
|
||||||
rpc.send('PEWPEW', ['pew'], function (e, msg) {
|
rpc.send('PEWPEW', ['pew'], function (e, msg) {
|
||||||
if (e) { return void console.error(e); }
|
if (e) {
|
||||||
|
if (e === 'UNSUPPORTED_RPC_CALL') { return; }
|
||||||
|
return void console.error(e);
|
||||||
|
}
|
||||||
console.log(msg);
|
console.log(msg);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -45,10 +48,41 @@ define([
|
|||||||
console.log(msg);
|
console.log(msg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
rpc.send('GET_FILE_SIZE', 'pewpew', function (e, msg) {
|
rpc.send('GET_FILE_SIZE', 'pewpew', function (e, msg) {
|
||||||
if (e) { return void console.error(e); }
|
if (e) {
|
||||||
|
if (e === 'INVALID_CHAN') { return; }
|
||||||
|
return void console.error(e);
|
||||||
|
}
|
||||||
console.log(msg);
|
console.log(msg);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
rpc.send('GET_FILE_SIZE', '26f014b2ab959418605ea37a6785f317', function (e, msg) {
|
||||||
|
if (e) {
|
||||||
|
if (e === 'ENOENT') { return; }
|
||||||
|
return void console.error(e);
|
||||||
|
}
|
||||||
|
console.error("EXPECTED ENOENT");
|
||||||
|
console.log(msg);
|
||||||
|
});
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
var bytes = 0;
|
||||||
|
list.forEach(function (chan) {
|
||||||
|
rpc.send('GET_FILE_SIZE', chan, function (e, msg) {
|
||||||
|
if (e) { return void console.error(e); }
|
||||||
|
if (msg && msg[0] && typeof(msg[0]) === 'number') {
|
||||||
|
bytes += msg[0];
|
||||||
|
console.log(bytes);
|
||||||
|
} else {
|
||||||
|
console.log(msg);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}());
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user