Skip to content

Commit

Permalink
test: add test for missing range input
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarowolfx committed Apr 17, 2024
1 parent 40197b8 commit 2caf086
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions test/bigquery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,36 @@ describe('BigQuery', () => {
);
assert.strictEqual(timestampRange.elementType, 'TIMESTAMP');
});

it('should accept a Range with start and/or end missing', () => {
const dateRange = bq.range(
{
start: '2020-01-01',
},
'DATE'
);
assert.strictEqual(
dateRange.literalValue,
'RANGE<DATE> [2020-01-01, UNBOUNDED)'
);

const datetimeRange = bq.range(
{
end: '2020-12-31 12:00:00',
},
'DATETIME'
);
assert.strictEqual(
datetimeRange.literalValue,
'RANGE<DATETIME> [UNBOUNDED, 2020-12-31 12:00:00)'
);

const timestampRange = bq.range({}, 'TIMESTAMP');
assert.strictEqual(
timestampRange.literalValue,
'RANGE<TIMESTAMP> [UNBOUNDED, UNBOUNDED)'
);
});
});

describe('geography', () => {
Expand Down

0 comments on commit 2caf086

Please sign in to comment.