Skip to content

Commit

Permalink
Datastore: fix Queries created in Transaction with unspecified namesp…
Browse files Browse the repository at this point in the history
…ace (#2448)
  • Loading branch information
beaulac authored and stephenplusplus committed Jul 12, 2017
1 parent ac8967c commit fcffd0e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/datastore/src/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ function Transaction(datastore) {
this.datastore = datastore;

this.projectId = datastore.projectId;
this.namespace = datastore.namespace;

this.request = datastore.request.bind(datastore);

Expand Down
8 changes: 7 additions & 1 deletion packages/datastore/test/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ describe('Transaction', function() {
var transaction;
var TRANSACTION_ID = 'transaction-id';
var PROJECT_ID = 'project-id';
var NAMESPACE = 'a-namespace';

var DATASTORE = {
request: function() {},
projectId: PROJECT_ID
projectId: PROJECT_ID,
namespace: NAMESPACE
};

function key(path) {
Expand Down Expand Up @@ -99,6 +101,10 @@ describe('Transaction', function() {
assert.strictEqual(transaction.projectId, PROJECT_ID);
});

it('should localize the namespace', function() {
assert.strictEqual(transaction.namespace, NAMESPACE);
});

it('should localize request function', function(done) {
var transaction;

Expand Down

0 comments on commit fcffd0e

Please sign in to comment.