File tree 2 files changed +40
-6
lines changed
2 files changed +40
-6
lines changed Original file line number Diff line number Diff line change @@ -1373,13 +1373,17 @@ class Table extends common.ServiceObject {
1373
1373
metadata . schema = Table . createSchemaFromString_ ( metadata . schema ) ;
1374
1374
}
1375
1375
1376
- extend ( true , metadata , {
1377
- destinationTable : {
1378
- projectId : this . bigQuery . projectId ,
1379
- datasetId : this . dataset . id ,
1380
- tableId : this . id ,
1376
+ metadata = extend (
1377
+ true ,
1378
+ {
1379
+ destinationTable : {
1380
+ projectId : this . bigQuery . projectId ,
1381
+ datasetId : this . dataset . id ,
1382
+ tableId : this . id ,
1383
+ } ,
1381
1384
} ,
1382
- } ) ;
1385
+ metadata
1386
+ ) ;
1383
1387
1384
1388
let jobId = metadata . jobId || uuid . v4 ( ) ;
1385
1389
Original file line number Diff line number Diff line change @@ -1507,6 +1507,36 @@ describe('BigQuery/Table', () => {
1507
1507
table . createWriteStream_ ( { schema : SCHEMA_STRING } ) . emit ( 'writing' ) ;
1508
1508
} ) ;
1509
1509
1510
+ it ( 'should override destination table' , done => {
1511
+ const expectedMetadata = {
1512
+ destinationTable : {
1513
+ projectId : 'projectId-override' ,
1514
+ datasetId : 'datasetId-override' ,
1515
+ tableId : 'tableId-override' ,
1516
+ } ,
1517
+ } ;
1518
+ makeWritableStreamOverride = (
1519
+ stream : stream . Stream ,
1520
+ options : MakeWritableStreamOptions
1521
+ ) => {
1522
+ assert . deepStrictEqual (
1523
+ options . metadata . configuration ?. load ?. destinationTable ,
1524
+ expectedMetadata . destinationTable
1525
+ ) ;
1526
+ done ( ) ;
1527
+ } ;
1528
+
1529
+ table
1530
+ . createWriteStream_ ( {
1531
+ destinationTable : {
1532
+ projectId : 'projectId-override' ,
1533
+ datasetId : 'datasetId-override' ,
1534
+ tableId : 'tableId-override' ,
1535
+ } ,
1536
+ } )
1537
+ . emit ( 'writing' ) ;
1538
+ } ) ;
1539
+
1510
1540
it ( 'should return a stream' , ( ) => {
1511
1541
assert ( table . createWriteStream_ ( ) instanceof stream . Stream ) ;
1512
1542
} ) ;
You can’t perform that action at this time.
0 commit comments