@@ -104,6 +104,8 @@ describe('DataClient tests', () => {
104104 locationId : 'testLocationId' ,
105105 } ) ;
106106
107+ const binaryDataId1 = 'testID1' ;
108+ const binaryDataId2 = 'testID2' ;
107109 describe ( 'exportTabularData tests' , ( ) => {
108110 const sharedAttributes = {
109111 partId : 'partId1' ,
@@ -417,13 +419,33 @@ describe('DataClient tests', () => {
417419 } ) ;
418420 } ) ;
419421
422+ it ( 'get binary data by binary data ids' , async ( ) => {
423+ const promise = await subject ( ) . binaryDataByIds ( [
424+ binaryDataId1 ,
425+ binaryDataId2 ,
426+ ] ) ;
427+ expect ( promise . length ) . toEqual ( 2 ) ;
428+ expect ( promise [ 0 ] ?. binary ) . toEqual ( bin1 ) ;
429+ expect ( promise [ 1 ] ?. binary ) . toEqual ( bin2 ) ;
430+ } ) ;
431+
420432 it ( 'get binary data by ids' , async ( ) => {
421433 const promise = await subject ( ) . binaryDataByIds ( [ binaryId1 , binaryId2 ] ) ;
422434 expect ( promise . length ) . toEqual ( 2 ) ;
423435 expect ( promise [ 0 ] ?. binary ) . toEqual ( bin1 ) ;
424436 expect ( promise [ 1 ] ?. binary ) . toEqual ( bin2 ) ;
425437 } ) ;
426438
439+ it ( 'get binary data by binary data id' , async ( ) => {
440+ const expectedRequest = new BinaryDataByIDsRequest ( {
441+ binaryDataIds : [ binaryDataId1 ] ,
442+ includeBinary : true ,
443+ } ) ;
444+
445+ await subject ( ) . binaryDataByIds ( [ binaryDataId1 ] ) ;
446+ expect ( capReq ) . toStrictEqual ( expectedRequest ) ;
447+ } ) ;
448+
427449 it ( 'get binary data by id' , async ( ) => {
428450 const expectedRequest = new BinaryDataByIDsRequest ( {
429451 binaryIds : [ binaryId1 ] ,
@@ -515,14 +537,27 @@ describe('DataClient tests', () => {
515537 service ( DataService , {
516538 deleteBinaryDataByIDs : ( req ) => {
517539 return new DeleteBinaryDataByIDsResponse ( {
518- deletedCount : BigInt ( req . binaryIds . length ) ,
540+ deletedCount : BigInt (
541+ Math . max ( req . binaryDataIds . length , req . binaryIds . length )
542+ ) ,
519543 } ) ;
520544 } ,
521545 } ) ;
522546 } ) ;
523547 } ) ;
524548
525- it ( 'delete binary data' , async ( ) => {
549+ it ( 'delete binary data by binary data ids' , async ( ) => {
550+ const promise1 = await subject ( ) . deleteBinaryDataByIds ( [ binaryDataId1 ] ) ;
551+ expect ( promise1 ) . toEqual ( 1n ) ;
552+
553+ const promise2 = await subject ( ) . deleteBinaryDataByIds ( [
554+ binaryDataId1 ,
555+ binaryDataId2 ,
556+ ] ) ;
557+ expect ( promise2 ) . toEqual ( 2n ) ;
558+ } ) ;
559+
560+ it ( 'delete binary data by ids' , async ( ) => {
526561 const promise1 = await subject ( ) . deleteBinaryDataByIds ( [ binaryId1 ] ) ;
527562 expect ( promise1 ) . toEqual ( 1n ) ;
528563
@@ -547,6 +582,19 @@ describe('DataClient tests', () => {
547582 } ) ;
548583 } ) ;
549584
585+ it ( 'add tags to binary data by binary data ids' , async ( ) => {
586+ const expectedRequest = new AddTagsToBinaryDataByIDsRequest ( {
587+ binaryDataIds : [ binaryDataId1 , binaryDataId2 ] ,
588+ tags : [ 'tag1' , 'tag2' ] ,
589+ } ) ;
590+
591+ await subject ( ) . addTagsToBinaryDataByIds (
592+ [ 'tag1' , 'tag2' ] ,
593+ [ binaryDataId1 , binaryDataId2 ]
594+ ) ;
595+ expect ( capReq ) . toStrictEqual ( expectedRequest ) ;
596+ } ) ;
597+
550598 it ( 'add tags to binary data' , async ( ) => {
551599 const expectedRequest = new AddTagsToBinaryDataByIDsRequest ( {
552600 binaryIds : [ binaryId1 , binaryId2 ] ,
@@ -600,7 +648,21 @@ describe('DataClient tests', () => {
600648 } ) ;
601649 } ) ;
602650
603- it ( 'remove tags to binary data' , async ( ) => {
651+ it ( 'remove tags to binary data by binary data ids' , async ( ) => {
652+ const expectedRequest = new RemoveTagsFromBinaryDataByIDsRequest ( {
653+ binaryDataIds : [ binaryDataId1 , binaryDataId2 ] ,
654+ tags : [ 'tag1' , 'tag2' ] ,
655+ } ) ;
656+
657+ const promise = await subject ( ) . removeTagsFromBinaryDataByIds (
658+ [ 'tag1' , 'tag2' ] ,
659+ [ binaryDataId1 , binaryDataId2 ]
660+ ) ;
661+ expect ( capReq ) . toStrictEqual ( expectedRequest ) ;
662+ expect ( promise ) . toEqual ( 2n ) ;
663+ } ) ;
664+
665+ it ( 'remove tags to binary data by ids' , async ( ) => {
604666 const expectedRequest = new RemoveTagsFromBinaryDataByIDsRequest ( {
605667 binaryIds : [ binaryId1 , binaryId2 ] ,
606668 tags : [ 'tag1' , 'tag2' ] ,
@@ -686,7 +748,29 @@ describe('DataClient tests', () => {
686748 } ) ;
687749 } ) ;
688750
689- it ( 'add bounding box to image' , async ( ) => {
751+ it ( 'add bounding box to image by binary data id' , async ( ) => {
752+ const expectedRequest = new AddBoundingBoxToImageByIDRequest ( {
753+ binaryDataId : binaryDataId1 ,
754+ label : 'label' ,
755+ xMinNormalized : 0 ,
756+ yMinNormalized : 0 ,
757+ yMaxNormalized : 1 ,
758+ xMaxNormalized : 1 ,
759+ } ) ;
760+
761+ const promise = await subject ( ) . addBoundingBoxToImageById (
762+ binaryDataId1 ,
763+ 'label' ,
764+ 0 ,
765+ 0 ,
766+ 1 ,
767+ 1
768+ ) ;
769+ expect ( capReq ) . toStrictEqual ( expectedRequest ) ;
770+ expect ( promise ) . toEqual ( 'bboxId' ) ;
771+ } ) ;
772+
773+ it ( 'add bounding box to image by id' , async ( ) => {
690774 const expectedRequest = new AddBoundingBoxToImageByIDRequest ( {
691775 binaryId : binaryId1 ,
692776 label : 'label' ,
@@ -722,7 +806,17 @@ describe('DataClient tests', () => {
722806 } ) ;
723807 } ) ;
724808
725- it ( 'remove bounding box from image' , async ( ) => {
809+ it ( 'remove bounding box from image by binary data id' , async ( ) => {
810+ const expectedRequest = new RemoveBoundingBoxFromImageByIDRequest ( {
811+ binaryDataId : binaryDataId1 ,
812+ bboxId : 'bboxId' ,
813+ } ) ;
814+
815+ await subject ( ) . removeBoundingBoxFromImageById ( binaryDataId1 , 'bboxId' ) ;
816+ expect ( capReq ) . toStrictEqual ( expectedRequest ) ;
817+ } ) ;
818+
819+ it ( 'remove bounding box from image by id' , async ( ) => {
726820 const expectedRequest = new RemoveBoundingBoxFromImageByIDRequest ( {
727821 binaryId : binaryId1 ,
728822 bboxId : 'bboxId' ,
@@ -822,7 +916,20 @@ describe('DataClient tests', () => {
822916 } ) ;
823917 } ) ;
824918
825- it ( 'add binary data to dataset' , async ( ) => {
919+ it ( 'add binary data to dataset by binary data ids' , async ( ) => {
920+ const expectedRequest = new AddBinaryDataToDatasetByIDsRequest ( {
921+ binaryDataIds : [ binaryDataId1 , binaryDataId2 ] ,
922+ datasetId : 'datasetId' ,
923+ } ) ;
924+
925+ await subject ( ) . addBinaryDataToDatasetByIds (
926+ [ binaryDataId1 , binaryDataId2 ] ,
927+ 'datasetId'
928+ ) ;
929+ expect ( capReq ) . toStrictEqual ( expectedRequest ) ;
930+ } ) ;
931+
932+ it ( 'add binary data to dataset by ids' , async ( ) => {
826933 const expectedRequest = new AddBinaryDataToDatasetByIDsRequest ( {
827934 binaryIds : [ binaryId1 , binaryId2 ] ,
828935 datasetId : 'datasetId' ,
@@ -849,7 +956,20 @@ describe('DataClient tests', () => {
849956 } ) ;
850957 } ) ;
851958
852- it ( 'remove binary data from dataset' , async ( ) => {
959+ it ( 'remove binary data from dataset by binary data ids' , async ( ) => {
960+ const expectedRequest = new RemoveBinaryDataFromDatasetByIDsRequest ( {
961+ binaryDataIds : [ binaryDataId1 , binaryDataId2 ] ,
962+ datasetId : 'datasetId' ,
963+ } ) ;
964+
965+ await subject ( ) . removeBinaryDataFromDatasetByIds (
966+ [ binaryDataId1 , binaryDataId2 ] ,
967+ 'datasetId'
968+ ) ;
969+ expect ( capReq ) . toStrictEqual ( expectedRequest ) ;
970+ } ) ;
971+
972+ it ( 'remove binary data from dataset by ids' , async ( ) => {
853973 const expectedRequest = new RemoveBinaryDataFromDatasetByIDsRequest ( {
854974 binaryIds : [ binaryId1 , binaryId2 ] ,
855975 datasetId : 'datasetId' ,
@@ -1249,7 +1369,7 @@ describe('DataSyncClient tests', () => {
12491369 dataCaptureUpload : ( req ) => {
12501370 capReq = req ;
12511371 return new DataCaptureUploadResponse ( {
1252- fileId : 'fileId' ,
1372+ binaryDataId : 'fileId' ,
12531373 } ) ;
12541374 } ,
12551375 } ) ;
0 commit comments