Skip to content

Commit

Permalink
pass name for view parameter in table.exists (#280)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaaym authored and sduskis committed Aug 31, 2018
1 parent 6338364 commit af01dcf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
7 changes: 6 additions & 1 deletion src/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,12 @@ Please use the format 'prezzy' or '${instance.name}/tables/prezzy'.`
gaxOptions = {};
}

this.getMetadata(gaxOptions, err => {
const reqOpts = {
view: 'name',
gaxOptions: gaxOptions,
};

this.getMetadata(reqOpts, err => {
if (err) {
if (err.code === 5) {
callback(null, false);
Expand Down
17 changes: 13 additions & 4 deletions test/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -1134,8 +1134,8 @@ describe('Bigtable/Table', function() {

describe('exists', function() {
it('should not require gaxOptions', function(done) {
table.getMetadata = function(gaxOptions) {
assert.deepStrictEqual(gaxOptions, {});
table.getMetadata = function(options_) {
assert.deepStrictEqual(options_.gaxOptions, {});
done();
};

Expand All @@ -1144,9 +1144,18 @@ describe('Bigtable/Table', function() {

it('should pass gaxOptions to getMetadata', function(done) {
let gaxOptions = {};
table.getMetadata = function(options_) {
assert.strictEqual(options_.gaxOptions, gaxOptions);
done();
};

table.getMetadata = function(gaxOptions_) {
assert.strictEqual(gaxOptions_, gaxOptions);
table.exists(gaxOptions, assert.ifError);
});

it('should pass view = name to getMetadata', function(done) {
let gaxOptions = {};
table.getMetadata = function(options_) {
assert.strictEqual(options_.view, 'name');
done();
};

Expand Down

0 comments on commit af01dcf

Please sign in to comment.