diff --git a/package.json b/package.json index 8c6b84a13..3100bee8a 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "prettier": "prettier --write src/*.js src/*/*.js samples/*.js samples/*/*.js test/*.js test/*/*.js system-test/*.js system-test/*/*.js", "publish-module": "node ../../scripts/publish.js bigtable", "system-test": "mocha system-test/*.js --timeout 600000", - "snippet-test": "mocha samples/document-snippets/test.js --timeout 600000" + "snippet-test": "mocha samples/document-snippets/tests/*.js --timeout 600000" }, "dependencies": { "@google-cloud/common-grpc": "^0.7.1", diff --git a/samples/document-snippets/.eslintrc.yml b/samples/document-snippets/.eslintrc.yml index 73f7bbc94..5cbb587ca 100644 --- a/samples/document-snippets/.eslintrc.yml +++ b/samples/document-snippets/.eslintrc.yml @@ -3,3 +3,4 @@ env: mocha: true rules: node/no-unpublished-require: off + no-unused-vars: off \ No newline at end of file diff --git a/samples/document-snippets/family.js b/samples/document-snippets/family.js index f7334a3e2..1340fe682 100644 --- a/samples/document-snippets/family.js +++ b/samples/document-snippets/family.js @@ -27,12 +27,12 @@ const snippets = { .then(result => { const family = result[0]; // let apiResponse = result[1]; - callback(null, family); }) .catch(err => { - callback(err); + // handle error }); // [END bigtable_create_family] + callback(); }, existsFamily: (instanceId, tableId, familyId, callback) => { const instance = bigtable.instance(instanceId); @@ -44,12 +44,12 @@ const snippets = { .exists() .then(result => { const exists = result[0]; - callback(null, exists); }) .catch(err => { - callback(err); + // handle error }); // [END bigtable_exists_family] + callback(); }, getFamily: (instanceId, tableId, familyId, callback) => { const instance = bigtable.instance(instanceId); @@ -61,12 +61,12 @@ const snippets = { .then(result => { const family = result[0]; // const apiResponse = result[1]; - callback(null, family); }) .catch(err => { - callback(err); + // handle error }); // [END bigtable_get_family] + callback(); }, getMetaData: (instanceId, tableId, familyId, callback) => { const instance = bigtable.instance(instanceId); @@ -78,12 +78,12 @@ const snippets = { .then(result => { const metaData = result[0]; // const apiResponse = result[1]; - callback(null, metaData); }) .catch(err => { - callback(err); + // handle error }); // [END bigtable_get_family_meta] + callback(); }, setMetaData: (instanceId, tableId, familyId, callback) => { const instance = bigtable.instance(instanceId); @@ -100,12 +100,12 @@ const snippets = { .setMetadata(metadata) .then(result => { const apiResponse = result[0]; - callback(null, apiResponse); }) .catch(err => { - callback(err); + // handle error }); // [END bigtable_set_family_meta] + callback(); }, delFamily: (instanceId, tableId, familyId, callback) => { const instance = bigtable.instance(instanceId); @@ -116,12 +116,12 @@ const snippets = { .delete() .then(result => { const apiResponse = result[0]; - callback(null, apiResponse); }) .catch(err => { - callback(err); + // handle error }); // [END bigtable_del_family] + callback(); }, }; diff --git a/samples/document-snippets/tests/family.js b/samples/document-snippets/tests/family.js index e4f3b7832..efb787405 100644 --- a/samples/document-snippets/tests/family.js +++ b/samples/document-snippets/tests/family.js @@ -30,7 +30,7 @@ const familySnippets = require('../family.js'); const instance = bigtable.instance(INSTANCE_ID); -describe('Family Snippets', function() { +describe.only('Family Snippets', function() { before(async () => { await instance.create({ clusters: [ @@ -50,44 +50,26 @@ describe('Family Snippets', function() { }); it('should create a column family', function(done) { - familySnippets.createColmFamily(INSTANCE_ID, TABLE_ID, FAMILY_ID, err => { - assert.ifError(err); - done(); - }); + familySnippets.createColmFamily(INSTANCE_ID, TABLE_ID, FAMILY_ID, done); }); it('should check family exists', function(done) { - familySnippets.existsFamily(INSTANCE_ID, TABLE_ID, FAMILY_ID, err => { - assert.ifError(err); - done(); - }); + familySnippets.existsFamily(INSTANCE_ID, TABLE_ID, FAMILY_ID, done); }); it('should get the family', function(done) { - familySnippets.getFamily(INSTANCE_ID, TABLE_ID, FAMILY_ID, err => { - assert.ifError(err); - done(); - }); + familySnippets.getFamily(INSTANCE_ID, TABLE_ID, FAMILY_ID, done); }); it('should get family meta-data', function(done) { - familySnippets.getMetaData(INSTANCE_ID, TABLE_ID, FAMILY_ID, err => { - assert.ifError(err); - done(); - }); + familySnippets.getMetaData(INSTANCE_ID, TABLE_ID, FAMILY_ID, done); }); it('should set family meta-data', function(done) { - familySnippets.setMetaData(INSTANCE_ID, TABLE_ID, FAMILY_ID, err => { - assert.ifError(err); - done(); - }); + familySnippets.setMetaData(INSTANCE_ID, TABLE_ID, FAMILY_ID, done); }); it('should delete family', function(done) { - familySnippets.delFamily(INSTANCE_ID, TABLE_ID, FAMILY_ID, err => { - assert.ifError(err); - done(); - }); + familySnippets.delFamily(INSTANCE_ID, TABLE_ID, FAMILY_ID, done); }); });