Skip to content

Commit bbd5ee8

Browse files
author
Ace Nassri
committed
Minor stylistic tweaks
1 parent 3d35fac commit bbd5ee8

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

bigquery/system-test/export_data.test.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ describe('bigquery:export_data', function () {
2727
it('should export data to GCS', function (done) {
2828
example.exportTableToGCS(options, function (err, job) {
2929
assert.ifError(err);
30-
assert.notEqual(job, null);
31-
assert.notEqual(job.id, null);
32-
assert(job.id.length > 5);
30+
assert(job, 'job is not null');
31+
assert(job.id, 'job has an id');
32+
assert(job.id.length > 5, 'job id is 5 characters or more');
3333
jobId = job.id;
3434
setTimeout(done, 100); // Wait for export job to be submitted
3535
});
@@ -38,15 +38,17 @@ describe('bigquery:export_data', function () {
3838

3939
describe('export_poll', function () {
4040
it('should fetch job status', function (done) {
41-
assert.notEqual(jobId, null);
41+
assert(jobId);
4242
var poller = function (tries) {
4343
example.pollExportJob(jobId, function (err, metadata) {
4444
if (!err || tries === 0) {
45-
assert.ifError(err);
46-
assert.equal(metadata.status.state, 'DONE');
45+
assert.ifError(err, 'no error occurred');
46+
assert.equal(metadata.status.state, 'DONE', 'export job is finished');
4747
done();
4848
} else {
49-
setTimeout(function () { poller(tries - 1); }, 1000);
49+
setTimeout(function () {
50+
poller(tries - 1);
51+
}, 1000);
5052
}
5153
});
5254
};

bigquery/test/export_data.test.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,14 @@ describe('bigquery:export', function () {
123123
example.mocks.bigquery.job = sinon.stub().returns(example.mocks.job);
124124
example.program.pollExportJob(example.jobId, callback);
125125

126-
assert(example.mocks.bigquery.job.calledOnce);
127-
assert(example.mocks.job.getMetadata.calledOnce);
128-
assert(callback.calledOnce);
129-
assert.equal(callback.firstCall.args.length, 2);
130-
assert.equal(callback.firstCall.args[0], null);
131-
assert.deepEqual(callback.firstCall.args[1], example.mocks.metadata);
126+
assert(example.mocks.bigquery.job.calledOnce, 'job called once');
127+
assert(example.mocks.job.getMetadata.calledOnce, 'getMetadata called once');
128+
assert(callback.calledOnce, 'callback called once');
129+
assert.equal(callback.firstCall.args.length, 2, 'callback received 2 arguments');
130+
assert.equal(callback.firstCall.args[0], null, 'callback did not receive error');
131+
assert.deepEqual(callback.firstCall.args[1], example.mocks.metadata,
132+
'callback received metadata'
133+
);
132134

133135
assert(
134136
console.log.calledWith('PollExportJob: job status: %s', example.mocks.metadata.status.state),
@@ -148,9 +150,7 @@ describe('bigquery:export', function () {
148150
assert(example.mocks.job.getMetadata.calledOnce, 'getMetadata called once');
149151
assert(callback.calledOnce, 'callback called once');
150152
assert.equal(callback.firstCall.args.length, 1, 'callback received 1 argument');
151-
assert.deepEqual(
152-
callback.firstCall.args[0],
153-
new Error('Job %s is not done'),
153+
assert.deepEqual(callback.firstCall.args[0], new Error('Job %s is not done'),
154154
'callback received error'
155155
);
156156

@@ -168,9 +168,7 @@ describe('bigquery:export', function () {
168168

169169
assert.equal(callback.secondCall.args.length, 2, 'callback received 2 arguments');
170170
assert.ifError(callback.secondCall.args[0], 'callback did not receive error');
171-
assert.deepEqual(
172-
callback.secondCall.args[1],
173-
example.mocks.metadata,
171+
assert.deepEqual(callback.secondCall.args[1], example.mocks.metadata,
174172
'callback received metadata'
175173
);
176174

0 commit comments

Comments
 (0)