Skip to content

Commit

Permalink
Added test for table.import() callback invocation
Browse files Browse the repository at this point in the history
  • Loading branch information
jwngr committed Apr 13, 2015
1 parent 90e3175 commit 285415e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/bigquery/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -698,16 +698,22 @@ describe('BigQuery/Table', function() {
}, 'file.json');

it('should accept just a File and a callback', function(done) {
var mockJob = { id: 'foo' };

table.createWriteStream = function() {
var ws = new stream.Writable();
setImmediate(function() {
ws.emit('complete');
ws.emit('complete', mockJob);
ws.end();
});
return ws;
};

table.import(FILEPATH, done);
table.import(FILEPATH, function(error, job) {
assert.strictEqual(error, null);
assert.deepEqual(job, mockJob);
done();
});
});

it('should return a stream when a string is given', function() {
Expand Down

0 comments on commit 285415e

Please sign in to comment.