@@ -53,8 +53,8 @@ describe('DataConnectApiClient', () => {
5353 } ;
5454
5555 const noProjectId = 'Failed to determine project ID. Initialize the SDK with service '
56- + 'account credentials or set project ID as an app option. Alternatively, set the '
57- + 'GOOGLE_CLOUD_PROJECT environment variable.' ;
56+ + 'account credentials or set project ID as an app option. Alternatively, set the '
57+ + 'GOOGLE_CLOUD_PROJECT environment variable.' ;
5858
5959 const TEST_RESPONSE = {
6060 data : {
@@ -75,7 +75,7 @@ describe('DataConnectApiClient', () => {
7575 location : 'us-west2' ,
7676 serviceId : 'my-service' ,
7777 connector : 'mock-connector'
78- } ;
78+ } ;
7979
8080 const clientWithoutProjectId = new DataConnectApiClient (
8181 connectorConfig ,
@@ -232,7 +232,7 @@ describe('DataConnectApiClient', () => {
232232 method : 'POST' ,
233233 url : `https://firebasedataconnect.googleapis.com/v1alpha/projects/test-project/locations/${ connectorConfig . location } /services/${ connectorConfig . serviceId } :executeGraphql` ,
234234 headers : EXPECTED_HEADERS ,
235- data : { query : 'query' }
235+ data : { query : 'query' }
236236 } ) ;
237237 } ) ;
238238 } ) ;
@@ -301,7 +301,7 @@ describe('DataConnectApiClient', () => {
301301
302302 describe ( 'executeQuery' , ( ) => {
303303 it ( 'should reject when project id is not available' , ( ) => {
304- return clientWithoutProjectIdWithConnector . executeQuery ( { operationName : 'getById' } )
304+ return clientWithoutProjectIdWithConnector . executeQuery ( { operationName : 'getById' } )
305305 . should . eventually . be . rejectedWith ( noProjectId ) ;
306306 } ) ;
307307
@@ -334,7 +334,7 @@ describe('DataConnectApiClient', () => {
334334 . stub ( HttpClient . prototype , 'send' )
335335 . rejects ( utils . errorFrom ( ERROR_RESPONSE , 404 ) ) ;
336336 const expected = new FirebaseDataConnectError ( 'not-found' , 'Requested entity not found' ) ;
337- return apiClientWithConnector . executeQuery ( { operationName : 'getById' } )
337+ return apiClientWithConnector . executeQuery ( { operationName : 'getById' } )
338338 . should . eventually . be . rejected . and . deep . include ( expected ) ;
339339 } ) ;
340340
@@ -343,7 +343,7 @@ describe('DataConnectApiClient', () => {
343343 . stub ( HttpClient . prototype , 'send' )
344344 . rejects ( utils . errorFrom ( { } , 404 ) ) ;
345345 const expected = new FirebaseDataConnectError ( 'unknown-error' , 'Unknown server error: {}' ) ;
346- return apiClientWithConnector . executeQuery ( { operationName : 'getById' } )
346+ return apiClientWithConnector . executeQuery ( { operationName : 'getById' } )
347347 . should . eventually . be . rejected . and . deep . include ( expected ) ;
348348 } ) ;
349349
@@ -353,7 +353,7 @@ describe('DataConnectApiClient', () => {
353353 . rejects ( utils . errorFrom ( 'not json' , 404 ) ) ;
354354 const expected = new FirebaseDataConnectError (
355355 'unknown-error' , 'Unexpected response with status: 404 and body: not json' ) ;
356- return apiClientWithConnector . executeQuery ( { operationName : 'getById' } )
356+ return apiClientWithConnector . executeQuery ( { operationName : 'getById' } )
357357 . should . eventually . be . rejected . and . deep . include ( expected ) ;
358358 } ) ;
359359
@@ -362,7 +362,7 @@ describe('DataConnectApiClient', () => {
362362 sandbox
363363 . stub ( HttpClient . prototype , 'send' )
364364 . rejects ( expected ) ;
365- return apiClientWithConnector . executeQuery ( { operationName : 'getById' } )
365+ return apiClientWithConnector . executeQuery ( { operationName : 'getById' } )
366366 . should . eventually . be . rejected . and . deep . include ( expected ) ;
367367 } ) ;
368368
@@ -379,7 +379,7 @@ describe('DataConnectApiClient', () => {
379379 const stub = sandbox
380380 . stub ( HttpClient . prototype , 'send' )
381381 . resolves ( utils . responseFrom ( TEST_RESPONSE , 200 ) ) ;
382- return apiClientWithConnector . executeQuery < UsersResponse , unknown > ( { operationName : 'getById' } )
382+ return apiClientWithConnector . executeQuery < UsersResponse , unknown > ( { operationName : 'getById' } )
383383 . then ( ( resp ) => {
384384 expect ( resp . data . users ) . to . be . not . empty ;
385385 expect ( resp . data . users [ 0 ] . name ) . to . be . not . undefined ;
@@ -389,7 +389,7 @@ describe('DataConnectApiClient', () => {
389389 method : 'POST' ,
390390 url : `https://firebasedataconnect.googleapis.com/v1alpha/projects/test-project/locations/${ connectorConfig_with_connector . location } /services/${ connectorConfig_with_connector . serviceId } /connectors/${ connectorConfig_with_connector . connector } :executeQuery` ,
391391 headers : EXPECTED_HEADERS ,
392- data : { query : undefined , name : 'getById' , operationName : 'getById' }
392+ data : { query : undefined , name : 'getById' , operationName : 'getById' }
393393 } ) ;
394394 } ) ;
395395 } ) ;
@@ -407,7 +407,7 @@ describe('DataConnectApiClient', () => {
407407 const stub = sandbox
408408 . stub ( HttpClient . prototype , 'send' )
409409 . resolves ( utils . responseFrom ( TEST_RESPONSE , 200 ) ) ;
410- return apiClientWithConnector . executeQuery < UsersResponse , unknown > ( { operationName : 'getById' , variables : { } } )
410+ return apiClientWithConnector . executeQuery < UsersResponse , unknown > ( { operationName : 'getById' , variables : { } } )
411411 . then ( ( resp ) => {
412412 expect ( resp . data . users ) . to . be . not . empty ;
413413 expect ( resp . data . users [ 0 ] . name ) . to . be . not . undefined ;
@@ -417,7 +417,7 @@ describe('DataConnectApiClient', () => {
417417 method : 'POST' ,
418418 url : `https://firebasedataconnect.googleapis.com/v1alpha/projects/test-project/locations/${ connectorConfig_with_connector . location } /services/${ connectorConfig_with_connector . serviceId } /connectors/${ connectorConfig_with_connector . connector } :executeQuery` ,
419419 headers : EXPECTED_HEADERS ,
420- data : { query : undefined , name : 'getById' , operationName : 'getById' , variables : { } }
420+ data : { query : undefined , name : 'getById' , operationName : 'getById' , variables : { } }
421421 } ) ;
422422 } ) ;
423423 } ) ;
@@ -427,21 +427,21 @@ describe('DataConnectApiClient', () => {
427427 const stub = sandbox
428428 . stub ( HttpClient . prototype , 'send' )
429429 . resolves ( utils . responseFrom ( TEST_RESPONSE , 200 ) ) ;
430- return apiClientWithConnector . executeQuery ( { operationName : 'getById' } )
430+ return apiClientWithConnector . executeQuery ( { operationName : 'getById' } )
431431 . then ( ( ) => {
432432 expect ( stub ) . to . have . been . calledOnce . and . calledWith ( {
433433 method : 'POST' ,
434434 url : `http://localhost:9399/v1alpha/projects/test-project/locations/${ connectorConfig_with_connector . location } /services/${ connectorConfig_with_connector . serviceId } /connectors/${ connectorConfig_with_connector . connector } :executeQuery` ,
435435 headers : EMULATOR_EXPECTED_HEADERS ,
436- data : { query : undefined , name : 'getById' , operationName : 'getById' }
436+ data : { query : undefined , name : 'getById' , operationName : 'getById' }
437437 } ) ;
438438 } ) ;
439439 } ) ;
440440 } ) ;
441-
441+
442442 describe ( 'executeMutation' , ( ) => {
443443 it ( 'should reject when project id is not available' , ( ) => {
444- return clientWithoutProjectIdWithConnector . executeMutation ( { operationName : 'getById' } )
444+ return clientWithoutProjectIdWithConnector . executeMutation ( { operationName : 'getById' } )
445445 . should . eventually . be . rejectedWith ( noProjectId ) ;
446446 } ) ;
447447
@@ -474,7 +474,7 @@ describe('DataConnectApiClient', () => {
474474 . stub ( HttpClient . prototype , 'send' )
475475 . rejects ( utils . errorFrom ( ERROR_RESPONSE , 404 ) ) ;
476476 const expected = new FirebaseDataConnectError ( 'not-found' , 'Requested entity not found' ) ;
477- return apiClientWithConnector . executeMutation ( { operationName : 'getById' } )
477+ return apiClientWithConnector . executeMutation ( { operationName : 'getById' } )
478478 . should . eventually . be . rejected . and . deep . include ( expected ) ;
479479 } ) ;
480480
@@ -483,7 +483,7 @@ describe('DataConnectApiClient', () => {
483483 . stub ( HttpClient . prototype , 'send' )
484484 . rejects ( utils . errorFrom ( { } , 404 ) ) ;
485485 const expected = new FirebaseDataConnectError ( 'unknown-error' , 'Unknown server error: {}' ) ;
486- return apiClientWithConnector . executeMutation ( { operationName : 'getById' } )
486+ return apiClientWithConnector . executeMutation ( { operationName : 'getById' } )
487487 . should . eventually . be . rejected . and . deep . include ( expected ) ;
488488 } ) ;
489489
@@ -493,7 +493,7 @@ describe('DataConnectApiClient', () => {
493493 . rejects ( utils . errorFrom ( 'not json' , 404 ) ) ;
494494 const expected = new FirebaseDataConnectError (
495495 'unknown-error' , 'Unexpected response with status: 404 and body: not json' ) ;
496- return apiClientWithConnector . executeMutation ( { operationName : 'getById' } )
496+ return apiClientWithConnector . executeMutation ( { operationName : 'getById' } )
497497 . should . eventually . be . rejected . and . deep . include ( expected ) ;
498498 } ) ;
499499
@@ -502,7 +502,7 @@ describe('DataConnectApiClient', () => {
502502 sandbox
503503 . stub ( HttpClient . prototype , 'send' )
504504 . rejects ( expected ) ;
505- return apiClientWithConnector . executeMutation ( { operationName : 'getById' } )
505+ return apiClientWithConnector . executeMutation ( { operationName : 'getById' } )
506506 . should . eventually . be . rejected . and . deep . include ( expected ) ;
507507 } ) ;
508508
@@ -519,7 +519,7 @@ describe('DataConnectApiClient', () => {
519519 const stub = sandbox
520520 . stub ( HttpClient . prototype , 'send' )
521521 . resolves ( utils . responseFrom ( TEST_RESPONSE , 200 ) ) ;
522- return apiClientWithConnector . executeMutation < UsersResponse , unknown > ( { operationName : 'getById' } )
522+ return apiClientWithConnector . executeMutation < UsersResponse , unknown > ( { operationName : 'getById' } )
523523 . then ( ( resp ) => {
524524 expect ( resp . data . users ) . to . be . not . empty ;
525525 expect ( resp . data . users [ 0 ] . name ) . to . be . not . undefined ;
@@ -529,7 +529,7 @@ describe('DataConnectApiClient', () => {
529529 method : 'POST' ,
530530 url : `https://firebasedataconnect.googleapis.com/v1alpha/projects/test-project/locations/${ connectorConfig_with_connector . location } /services/${ connectorConfig_with_connector . serviceId } /connectors/${ connectorConfig_with_connector . connector } :executeMutation` ,
531531 headers : EXPECTED_HEADERS ,
532- data : { query : undefined , name : 'getById' , operationName : 'getById' }
532+ data : { query : undefined , name : 'getById' , operationName : 'getById' }
533533 } ) ;
534534 } ) ;
535535 } ) ;
@@ -547,7 +547,7 @@ describe('DataConnectApiClient', () => {
547547 const stub = sandbox
548548 . stub ( HttpClient . prototype , 'send' )
549549 . resolves ( utils . responseFrom ( TEST_RESPONSE , 200 ) ) ;
550- return apiClientWithConnector . executeMutation < UsersResponse , unknown > ( { operationName : 'getById' , variables : { } } )
550+ return apiClientWithConnector . executeMutation < UsersResponse , unknown > ( { operationName : 'getById' , variables : { } } )
551551 . then ( ( resp ) => {
552552 expect ( resp . data . users ) . to . be . not . empty ;
553553 expect ( resp . data . users [ 0 ] . name ) . to . be . not . undefined ;
@@ -557,7 +557,7 @@ describe('DataConnectApiClient', () => {
557557 method : 'POST' ,
558558 url : `https://firebasedataconnect.googleapis.com/v1alpha/projects/test-project/locations/${ connectorConfig_with_connector . location } /services/${ connectorConfig_with_connector . serviceId } /connectors/${ connectorConfig_with_connector . connector } :executeMutation` ,
559559 headers : EXPECTED_HEADERS ,
560- data : { query : undefined , name : 'getById' , operationName : 'getById' , variables : { } }
560+ data : { query : undefined , name : 'getById' , operationName : 'getById' , variables : { } }
561561 } ) ;
562562 } ) ;
563563 } ) ;
@@ -567,13 +567,13 @@ describe('DataConnectApiClient', () => {
567567 const stub = sandbox
568568 . stub ( HttpClient . prototype , 'send' )
569569 . resolves ( utils . responseFrom ( TEST_RESPONSE , 200 ) ) ;
570- return apiClientWithConnector . executeMutation ( { operationName : 'getById' } )
570+ return apiClientWithConnector . executeMutation ( { operationName : 'getById' } )
571571 . then ( ( ) => {
572572 expect ( stub ) . to . have . been . calledOnce . and . calledWith ( {
573573 method : 'POST' ,
574574 url : `http://localhost:9399/v1alpha/projects/test-project/locations/${ connectorConfig_with_connector . location } /services/${ connectorConfig_with_connector . serviceId } /connectors/${ connectorConfig_with_connector . connector } :executeMutation` ,
575575 headers : EMULATOR_EXPECTED_HEADERS ,
576- data : { query : undefined , name : 'getById' , operationName : 'getById' }
576+ data : { query : undefined , name : 'getById' , operationName : 'getById' }
577577 } ) ;
578578 } ) ;
579579 } ) ;
@@ -708,11 +708,11 @@ describe('DataConnectApiClient CRUD helpers', () => {
708708 . to . be . rejectedWith ( FirebaseDataConnectError , / ` d a t a ` m u s t b e a n o n - n u l l o b j e c t ./ ) ;
709709 } ) ;
710710
711- it ( 'should throw FirebaseDataConnectError for array data' , async ( ) => {
711+ it ( 'should throw FirebaseDataConnectError for array data' , async ( ) => {
712712 await expect ( apiClient . insert ( tableName , [ ] ) )
713713 . to . be . rejectedWith ( FirebaseDataConnectError , / ` d a t a ` m u s t b e a n o b j e c t , n o t a n a r r a y , f o r s i n g l e i n s e r t ./ ) ;
714714 } ) ;
715-
715+
716716 it ( 'should amend the message for query errors' , async ( ) => {
717717 await expect ( apiClientQueryError . insert ( tableName , { data : 1 } ) )
718718 . to . be . rejectedWith ( FirebaseDataConnectError , `${ serverErrorString } . ${ additionalErrorMessageForBulkImport } ` ) ;
0 commit comments