Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
surbhigarg92 committed Dec 26, 2024
1 parent 699656d commit db2938b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {

Check failure on line 2098 in src/database.ts

View workflow job for this annotation

GitHub Actions / lint

Replace `options·!=null·&&·(options['maxStaleness']·!=·null·||·options['minReadTimestamp']·!=·null)` with `⏎······options·!=·null·&&⏎······(options['maxStaleness']·!=·null·||·options['minReadTimestamp']·!=·null)⏎····`

Check failure on line 2098 in src/database.ts

View workflow job for this annotation

GitHub Actions / lint

Expected '!==' and instead saw '!='

Check failure on line 2098 in src/database.ts

View workflow job for this annotation

GitHub Actions / lint

Expected '!==' and instead saw '!='

Check failure on line 2098 in src/database.ts

View workflow job for this annotation

GitHub Actions / lint

Expected '!==' and instead saw '!='
const error = Object.assign(
new Error(
'maxStaleness / minReadTimestamp is not supported for multi-use read-only transactions.'
Expand Down
9 changes: 9 additions & 0 deletions test/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {});

Expand Down

0 comments on commit db2938b

Please sign in to comment.