diff --git a/packages/bigquery/src/index.js b/packages/bigquery/src/index.js index 0ae231e0e66..50fa39091dc 100644 --- a/packages/bigquery/src/index.js +++ b/packages/bigquery/src/index.js @@ -806,7 +806,7 @@ BigQuery.prototype.getJobs = function(options, callback) { } var jobs = (resp.jobs || []).map(function(jobObject) { - var job = that.job(jobObject.id); + var job = that.job(jobObject.jobReference.jobId); job.metadata = jobObject; return job; }); diff --git a/packages/bigquery/test/index.js b/packages/bigquery/test/index.js index 4583e0cbc67..5209372e8e2 100644 --- a/packages/bigquery/test/index.js +++ b/packages/bigquery/test/index.js @@ -1048,7 +1048,16 @@ describe('BigQuery', function() { it('should return Job objects', function(done) { bq.request = function(reqOpts, callback) { - callback(null, { jobs: [{ id: JOB_ID }] }); + callback(null, { + jobs: [ + { + id: JOB_ID, + jobReference: { + jobId: JOB_ID + } + } + ] + }); }; bq.getJobs(function(err, jobs) { @@ -1059,7 +1068,16 @@ describe('BigQuery', function() { }); it('should return apiResponse', function(done) { - var resp = { jobs: [{ id: JOB_ID }] }; + var resp = { + jobs: [ + { + id: JOB_ID, + jobReference: { + jobId: JOB_ID + } + } + ] + }; bq.request = function(reqOpts, callback) { callback(null, resp); @@ -1073,7 +1091,16 @@ describe('BigQuery', function() { }); it('should assign metadata to the Job objects', function(done) { - var jobObjects = [{ a: 'b', c: 'd', id: JOB_ID }]; + var jobObjects = [ + { + a: 'b', + c: 'd', + id: JOB_ID, + jobReference: { + jobId: JOB_ID + } + } + ]; bq.request = function(reqOpts, callback) { callback(null, { jobs: jobObjects });