From db2938b151f5cf0d8297ca918573913d12e70124 Mon Sep 17 00:00:00 2001 From: surbhigarg92 Date: Thu, 26 Dec 2024 11:51:15 +0530 Subject: [PATCH] review comments --- src/database.ts | 2 +- test/database.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/database.ts b/src/database.ts index 381af8e74..fcbb7d451 100644 --- a/src/database.ts +++ b/src/database.ts @@ -2095,7 +2095,7 @@ class Database extends common.GrpcServiceObject { ? (optionsOrCallback as TimestampBounds) : {}; - if ('maxStaleness' in options || 'minReadTimestamp' in options) { + if (options !=null && (options['maxStaleness'] != null || options['minReadTimestamp'] != null)) { const error = Object.assign( new Error( 'maxStaleness / minReadTimestamp is not supported for multi-use read-only transactions.' diff --git a/test/database.ts b/test/database.ts index a3eaf82d7..4f15fc93a 100644 --- a/test/database.ts +++ b/test/database.ts @@ -2331,6 +2331,15 @@ describe('Database', () => { }); }); + it('should pass when maxStaleness is undefined', () => { + const fakeTimestampBounds = {minReadTimestamp: undefined}; + + database.getSnapshot(fakeTimestampBounds, assert.ifError); + + const bounds = snapshotStub.lastCall.args[0]; + assert.strictEqual(bounds, fakeTimestampBounds); + }); + it('should begin a snapshot', () => { beginSnapshotStub.callsFake(() => {});