Commit 9729722a authored by Aurel's avatar Aurel

test retrieval of report + use login/password

parent 4be88b8a
...@@ -18,11 +18,10 @@ global.StreamBuffers = require('stream-buffers'); ...@@ -18,11 +18,10 @@ global.StreamBuffers = require('stream-buffers');
global.window = global; global.window = global;
global.sessionStorage = {}; global.sessionStorage = {};
var jIO = require('jio'); var jIO = require('jio');
var ClearRoadBillingPeriodRegistration = require("clearroad"); var clearroad = require("clearroad");
var i = 0;
var cr = new ClearRoadBillingPeriodRegistration(); var cr = new clearroad.ClearRoadBillingPeriodRegistration("testam", "testam");
console.log("init"); console.log("init");
cr.post({ cr.post({
"reference" : "Q421", "reference" : "Q421",
...@@ -33,13 +32,25 @@ cr.post({ ...@@ -33,13 +32,25 @@ cr.post({
return cr.sync(); return cr.sync();
}).push(function (){ }).push(function (){
console.info("Sync done"); console.info("Sync done");
}, function (error) { }).push(function() {
console.info("Error :"); cr = new clearroad.ClearRoadBillingPeriodRegistrationReport("testam", "testam", 100);
console.warn(error.stack) return cr.sync();
console.warn(error); }).push(function (){
console.log("sync done && loading result...")
return cr.allDocs()
}).push(function (result) {
console.log("browsing results : "+result.data.total_rows);
for (i = 0; i < result.data.total_rows; i += 1) {
console.log("Ref : "+result.data.rows[i].value.reference+", state : "+result.data.rows[i].value.state+", comment"+result.data.rows[i].value.comment);
}
console.log("Finished");
}).push(undefined, function (error) {
throw error;
}); });
// init project // init project
var express = require('express'); var express = require('express');
var app = express(); var app = express();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment