better rpc tests, sum up your channel usage
parent
7ab65367c5
commit
7d5ff27900
|
@ -32,7 +32,10 @@ define([
|
|||
|
||||
// test a non-existent RPC call
|
||||
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);
|
||||
});
|
||||
|
||||
|
@ -45,10 +48,41 @@ define([
|
|||
console.log(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);
|
||||
});
|
||||
|
||||
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…
Reference in New Issue