Skip to content

Commit

Permalink
code review edits
Browse files Browse the repository at this point in the history
  • Loading branch information
vijay-qlogic committed Dec 12, 2018
1 parent 8d61e3c commit c120a83
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,8 @@ class DatastoreRequest {
* const entities = data[0];
* });
*/
get(keys, options, callback?) {
get(keys, options?): Promise<any>;
get(keys, options, callback?): void|Promise<any> {
if (is.fn(options)) {
callback = options;
options = {};
Expand Down
16 changes: 11 additions & 5 deletions system-test/datastore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import * as assert from 'assert';
import {Datastore} from '../src';
import {entity} from '../src/entity';
import {promisify} from '@google-cloud/promisify';

describe('Datastore', () => {
const testKinds: Array<{}> = [];
Expand Down Expand Up @@ -858,16 +859,21 @@ describe('Datastore', () => {

await Promise.all([
// Deletes the key that is in the deletion queue.
datastore.get(deleteKey, (err, entity) => {
assert.ifError(err);
datastore.get(deleteKey)
.then(([entity]) => {
assert.strictEqual(typeof entity, 'undefined');
})
.catch(err => {
assert.ifError(err);
}),

// Updates data on the key.
datastore.get(key, (err, entity) => {
assert.ifError(err);
datastore.get(key)
.then(([entity]) => {
assert.strictEqual(entity.rating, 10);
})
.catch(err => {
assert.ifError(err);
})
]);
});

Expand Down

0 comments on commit c120a83

Please sign in to comment.