Skip to content

Commit b1e10ad

Browse files
committed
Updated bigquery test
1 parent db75945 commit b1e10ad

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

lib/bigquery.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,12 @@
7070
* @param {String} id 任务 id
7171
* @since 0.5.5
7272
*/
73-
AV.BigQuery.JobQuery = function(id) {
73+
AV.BigQuery.JobQuery = function(id, className) {
7474
if(!id) {
7575
throw 'Please provide the job id.';
7676
}
7777
this.id = id;
78+
this.className = className;
7879
this._skip = 0;
7980
this._limit = 100;
8081
};
@@ -126,14 +127,13 @@
126127

127128
var request = AV._request("bigquery", 'jobs', this.id, "GET",
128129
params);
130+
var self = this;
129131
return request.then(function(response) {
130-
delete response.nextAnchor;
131132
if(response.error) {
132133
return AV.Promise.error(new AV.Error(response.code, response.error));
133134
}
134-
return response;
135+
return AV.Promise.as(response);
135136
})._thenRunCallbacks(options);
136-
137137
}
138138

139139
};

test/bigquery.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,29 @@
11
describe('bigquery', function() {
22
describe('startJob', function(){
3-
this.timeout(10000);
4-
it('return job id.', function(done) {
3+
this.timeout(20000);
4+
it('return job id and query job status.', function(done) {
55
AV.BigQuery.startJob({
6-
sql: "select * from _User",
6+
sql: "select * from `_User`",
77
saveAs: {
88
className: 'BigQueryResult',
99
limit:1
1010
}
1111
}).then(function(id) {
12-
console.log(id);
13-
done();
12+
expect(id).to.be.ok();
13+
setTimeout(function() {
14+
try{
15+
var q = new AV.BigQuery.JobQuery(id, AV.User);
16+
q.find().then(function(results) {
17+
console.dir(results);
18+
expect(results).to.not.be.empty();
19+
done();
20+
}, function(err) {
21+
throw err;
22+
});
23+
}catch(e) {
24+
console.dir(e);
25+
}
26+
}, 10000);
1427
}, function(err) {
1528
throw err;
1629
});

0 commit comments

Comments
 (0)