-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify BigQuery samples according to our standard. #207
Conversation
Same eslint |
@@ -49,15 +52,16 @@ describe('bigquery:datasets', function () { | |||
describe('listDatasets', function () { | |||
it('should list datasets', function (done) { | |||
program.listDatasets(projectId, function (err, datasets) { | |||
assert.ifError(err); | |||
assert.equal(err, null); | |||
assert(Array.isArray(datasets)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix assert
style?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
format: options.format, | ||
gzip: options.gzip | ||
}; | ||
var Storage = require('@google-cloud/storage'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason you're declaring this here and on line 170?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, because this is an import. Imports should be as close to top-level statements as possible. In ES6, the new version of JavaScript, this is enforced by the new import
syntax, which only works as a top-level statement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good to know.
assert.equal(example.mocks.job.getMetadata.calledOnce, true); | ||
assert.deepEqual(example.mocks.job.getMetadata.firstCall.args.slice(0, -1), []); | ||
assert.equal(example.mocks.job.on.calledTwice, true); | ||
assert.deepEqual(example.mocks.job.on.firstCall.args.slice(0, -1), ['error']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these tests depend on the order of the callbacks? (It seems like they do, at least currently...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sample is deterministic and the current assertions are about as restrictive/specific as it gets, and won't fail unless someone changes the sample. The only alternative would be looser assertions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough - adding this feature would likely add arguably unnecessary complexity to the tests.
assert.deepEqual(program.copyTable.firstCall.args.slice(0, -1), | ||
[srcDataset, srcTable, destDataset, destTable] | ||
); | ||
assert.deepEqual(program.copyTable.firstCall.args.slice(0, -1), [srcDatasetId, srcTableId, destDatasetId, destTableId]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: not personally a fan of lines > 100 chars.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps in a separate PR we can consider switching from Semistandard to ESLint + JSCS to give us some configurability and better enforceability on our style?
LGTM, but I think there's some App Engine dependency issue going on... |
🤖 I have created a release \*beep\* \*boop\* --- ### [2.3.8](https://www.github.com/googleapis/nodejs-game-servers/compare/v2.3.7...v2.3.8) (2021-08-17) ### Bug Fixes * **build:** migrate to using main branch ([#206](https://www.github.com/googleapis/nodejs-game-servers/issues/206)) ([04998bf](https://www.github.com/googleapis/nodejs-game-servers/commit/04998bf4f24613792beb12fff9d1a14da795b74b)) * **deps:** google-gax v2.24.1 ([#208](https://www.github.com/googleapis/nodejs-game-servers/issues/208)) ([8462da4](https://www.github.com/googleapis/nodejs-game-servers/commit/8462da415e3df130356f70e34f97698628f48b2b)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release \*beep\* \*boop\* --- ### [2.3.8](https://www.github.com/googleapis/nodejs-game-servers/compare/v2.3.7...v2.3.8) (2021-08-17) ### Bug Fixes * **build:** migrate to using main branch ([#206](https://www.github.com/googleapis/nodejs-game-servers/issues/206)) ([04998bf](https://www.github.com/googleapis/nodejs-game-servers/commit/04998bf4f24613792beb12fff9d1a14da795b74b)) * **deps:** google-gax v2.24.1 ([#208](https://www.github.com/googleapis/nodejs-game-servers/issues/208)) ([8462da4](https://www.github.com/googleapis/nodejs-game-servers/commit/8462da415e3df130356f70e34f97698628f48b2b)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release \*beep\* \*boop\* --- ### [2.3.8](https://www.github.com/googleapis/nodejs-game-servers/compare/v2.3.7...v2.3.8) (2021-08-17) ### Bug Fixes * **build:** migrate to using main branch ([#206](https://www.github.com/googleapis/nodejs-game-servers/issues/206)) ([04998bf](https://www.github.com/googleapis/nodejs-game-servers/commit/04998bf4f24613792beb12fff9d1a14da795b74b)) * **deps:** google-gax v2.24.1 ([#208](https://www.github.com/googleapis/nodejs-game-servers/issues/208)) ([8462da4](https://www.github.com/googleapis/nodejs-game-servers/commit/8462da415e3df130356f70e34f97698628f48b2b)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release \*beep\* \*boop\* --- ### [2.3.8](https://www.github.com/googleapis/nodejs-game-servers/compare/v2.3.7...v2.3.8) (2021-08-17) ### Bug Fixes * **build:** migrate to using main branch ([#206](https://www.github.com/googleapis/nodejs-game-servers/issues/206)) ([04998bf](https://www.github.com/googleapis/nodejs-game-servers/commit/04998bf4f24613792beb12fff9d1a14da795b74b)) * **deps:** google-gax v2.24.1 ([#208](https://www.github.com/googleapis/nodejs-game-servers/issues/208)) ([8462da4](https://www.github.com/googleapis/nodejs-game-servers/commit/8462da415e3df130356f70e34f97698628f48b2b)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
No description provided.