@@ -4,6 +4,7 @@ import * as nock from "nock";
44import * as client from "./client" ;
55import { dataconnectOrigin } from "../api" ;
66
7+ const API_VERSION = "v1beta" ;
78describe ( "DataConnect control plane client" , ( ) => {
89 afterEach ( ( ) => {
910 nock . cleanAll ( ) ;
@@ -12,28 +13,30 @@ describe("DataConnect control plane client", () => {
1213 it ( "Should delete all child resources" , async ( ) => {
1314 const testService = "projects/test/locations/us-central1/services/test-service" ;
1415 const fake = nock ( dataconnectOrigin ( ) ) ;
15- fake . get ( `/v1alpha/${ testService } /connectors?pageSize=100&pageToken=&fields=` ) . reply ( 200 , {
16- connectors : [
17- { name : `${ testService } /connectors/c1` } ,
18- { name : `${ testService } /connectors/c2` } ,
19- ] ,
20- } ) ;
2116 fake
22- . delete ( `/v1alpha/${ testService } /connectors/c1` )
17+ . get ( `/${ API_VERSION } /${ testService } /connectors?pageSize=100&pageToken=&fields=` )
18+ . reply ( 200 , {
19+ connectors : [
20+ { name : `${ testService } /connectors/c1` } ,
21+ { name : `${ testService } /connectors/c2` } ,
22+ ] ,
23+ } ) ;
24+ fake
25+ . delete ( `/${ API_VERSION } /${ testService } /connectors/c1` )
2326 . reply ( 200 , { name : "projects/test/operations/abc123" } ) ;
2427 fake
25- . delete ( `/v1alpha /${ testService } /connectors/c2` )
28+ . delete ( `/${ API_VERSION } /${ testService } /connectors/c2` )
2629 . reply ( 200 , { name : "projects/test/operations/def456" } ) ;
2730 fake
28- . delete ( `/v1alpha /${ testService } /schemas/main` )
31+ . delete ( `/${ API_VERSION } /${ testService } /schemas/main` )
2932 . reply ( 200 , { name : "projects/test/operations/ghi123" } ) ;
3033 fake
31- . delete ( `/v1alpha /${ testService } ` )
34+ . delete ( `/${ API_VERSION } /${ testService } ` )
3235 . reply ( 200 , { name : "projects/test/operations/jkl456" } ) ;
33- fake . get ( "/v1alpha /projects/test/operations/abc123" ) . reply ( 200 , { done : true } ) ;
34- fake . get ( "/v1alpha /projects/test/operations/def456" ) . reply ( 200 , { done : true } ) ;
35- fake . get ( "/v1alpha /projects/test/operations/ghi123" ) . reply ( 200 , { done : true } ) ;
36- fake . get ( "/v1alpha /projects/test/operations/jkl456" ) . reply ( 200 , { done : true } ) ;
36+ fake . get ( "/${API_VERSION} /projects/test/operations/abc123" ) . reply ( 200 , { done : true } ) ;
37+ fake . get ( "/${API_VERSION} /projects/test/operations/def456" ) . reply ( 200 , { done : true } ) ;
38+ fake . get ( "/${API_VERSION} /projects/test/operations/ghi123" ) . reply ( 200 , { done : true } ) ;
39+ fake . get ( "/${API_VERSION} /projects/test/operations/jkl456" ) . reply ( 200 , { done : true } ) ;
3740
3841 await client . deleteServiceAndChildResources ( testService ) ;
3942
@@ -43,17 +46,19 @@ describe("DataConnect control plane client", () => {
4346 it ( "Succeed when there are no connectors" , async ( ) => {
4447 const testService = "projects/test/locations/us-central1/services/test-service" ;
4548 const fake = nock ( dataconnectOrigin ( ) ) ;
46- fake . get ( `/v1alpha/${ testService } /connectors?pageSize=100&pageToken=&fields=` ) . reply ( 200 , {
47- connectors : [ ] ,
48- } ) ;
4949 fake
50- . delete ( `/v1alpha/${ testService } /schemas/main` )
50+ . get ( `/${ API_VERSION } /${ testService } /connectors?pageSize=100&pageToken=&fields=` )
51+ . reply ( 200 , {
52+ connectors : [ ] ,
53+ } ) ;
54+ fake
55+ . delete ( `/${ API_VERSION } /${ testService } /schemas/main` )
5156 . reply ( 200 , { name : "projects/test/operations/ghi123" } ) ;
5257 fake
53- . delete ( `/v1alpha /${ testService } ` )
58+ . delete ( `/${ API_VERSION } /${ testService } ` )
5459 . reply ( 200 , { name : "projects/test/operations/jkl456" } ) ;
55- fake . get ( "/v1alpha /projects/test/operations/ghi123" ) . reply ( 200 , { done : true } ) ;
56- fake . get ( "/v1alpha /projects/test/operations/jkl456" ) . reply ( 200 , { done : true } ) ;
60+ fake . get ( "/${API_VERSION} /projects/test/operations/ghi123" ) . reply ( 200 , { done : true } ) ;
61+ fake . get ( "/${API_VERSION} /projects/test/operations/jkl456" ) . reply ( 200 , { done : true } ) ;
5762
5863 await client . deleteServiceAndChildResources ( testService ) ;
5964
@@ -63,14 +68,16 @@ describe("DataConnect control plane client", () => {
6368 it ( "Succeed when there is no schema" , async ( ) => {
6469 const testService = "projects/test/locations/us-central1/services/test-service" ;
6570 const fake = nock ( dataconnectOrigin ( ) ) ;
66- fake . get ( `/v1alpha/${ testService } /connectors?pageSize=100&pageToken=&fields=` ) . reply ( 200 , {
67- connectors : [ ] ,
68- } ) ;
69- fake . delete ( `/v1alpha/${ testService } /schemas/main` ) . reply ( 404 , { } ) ;
7071 fake
71- . delete ( `/v1alpha/${ testService } ` )
72+ . get ( `/${ API_VERSION } /${ testService } /connectors?pageSize=100&pageToken=&fields=` )
73+ . reply ( 200 , {
74+ connectors : [ ] ,
75+ } ) ;
76+ fake . delete ( `/${ API_VERSION } /${ testService } /schemas/main` ) . reply ( 404 , { } ) ;
77+ fake
78+ . delete ( `/${ API_VERSION } /${ testService } ` )
7279 . reply ( 200 , { name : "projects/test/operations/jkl456" } ) ;
73- fake . get ( "/v1alpha /projects/test/operations/jkl456" ) . reply ( 200 , { done : true } ) ;
80+ fake . get ( "/${API_VERSION} /projects/test/operations/jkl456" ) . reply ( 200 , { done : true } ) ;
7481
7582 await client . deleteServiceAndChildResources ( testService ) ;
7683
0 commit comments