@@ -23,23 +23,22 @@ const replaceableVariables: Record<string, string> = {
2323 AZURE_CLIENT_ID : "azure_client_id" ,
2424 AZURE_CLIENT_SECRET : "azure_client_secret" ,
2525 AZURE_TENANT_ID : "88888888-8888-8888-8888-888888888888" ,
26- SUBSCRIPTION_ID : "azure_subscription_id"
26+ SUBSCRIPTION_ID : "azure_subscription_id" ,
2727} ;
2828
2929const recorderOptions : RecorderStartOptions = {
30- envSetupForPlayback : replaceableVariables
30+ envSetupForPlayback : replaceableVariables ,
31+ removeCentralSanitizers : [
32+ "AZSDK3493" , // .name in the body is not a secret and is listed below in the beforeEach section
33+ ] ,
3134} ;
3235
3336export const testPollingOptions = {
3437 updateIntervalInMs : isPlaybackMode ( ) ? 0 : undefined ,
3538} ;
3639
3740export function createTestCredential ( ) {
38- return isPlaybackMode ( )
39- ? new NoOpCredential ( )
40- : new
41- DefaultAzureCredential ( )
42- ;
41+ return isPlaybackMode ( ) ? new NoOpCredential ( ) : new DefaultAzureCredential ( ) ;
4342}
4443
4544describe ( "Eventgrid test" , ( ) => {
@@ -56,10 +55,14 @@ describe("Eventgrid test", () => {
5655 beforeEach ( async function ( this : Context ) {
5756 recorder = new Recorder ( this . currentTest ) ;
5857 await recorder . start ( recorderOptions ) ;
59- subscriptionId = env . SUBSCRIPTION_ID || '' ;
58+ subscriptionId = env . SUBSCRIPTION_ID || "" ;
6059 // This is an example of how the environment variables are used
6160 const credential = createTestCredential ( ) ;
62- client = new EventGridManagementClient ( credential , subscriptionId , recorder . configureClientOptions ( { } ) ) ;
61+ client = new EventGridManagementClient (
62+ credential ,
63+ subscriptionId ,
64+ recorder . configureClientOptions ( { } ) ,
65+ ) ;
6366 location = "east us2 euap" ;
6467 resourceGroupName = "myjstest" ;
6568 topicName = "mytopicxxx" ;
@@ -73,7 +76,12 @@ describe("Eventgrid test", () => {
7376 } ) ;
7477
7578 it ( "topics create test" , async function ( ) {
76- const res = await client . topics . beginCreateOrUpdateAndWait ( resourceGroupName , topicName , { location } , testPollingOptions ) ;
79+ const res = await client . topics . beginCreateOrUpdateAndWait (
80+ resourceGroupName ,
81+ topicName ,
82+ { location } ,
83+ testPollingOptions ,
84+ ) ;
7785 assert . equal ( res . name , topicName ) ;
7886 } ) ;
7987
@@ -86,17 +94,27 @@ describe("Eventgrid test", () => {
8694 } ) ;
8795
8896 it ( "domains create test" , async function ( ) {
89- const res = await client . domains . beginCreateOrUpdateAndWait ( resourceGroupName , domainName , { location : location } , testPollingOptions ) ;
97+ const res = await client . domains . beginCreateOrUpdateAndWait (
98+ resourceGroupName ,
99+ domainName ,
100+ { location : location } ,
101+ testPollingOptions ,
102+ ) ;
90103 assert . equal ( res . name , domainName ) ;
91104 } ) ;
92105
93106 it ( "domains update test" , async function ( ) {
94- const res = await client . domains . beginUpdateAndWait ( resourceGroupName , domainName , {
95- tags : {
96- tag1 : "value1" ,
97- tag2 : "value2"
98- }
99- } , testPollingOptions ) ;
107+ const res = await client . domains . beginUpdateAndWait (
108+ resourceGroupName ,
109+ domainName ,
110+ {
111+ tags : {
112+ tag1 : "value1" ,
113+ tag2 : "value2" ,
114+ } ,
115+ } ,
116+ testPollingOptions ,
117+ ) ;
100118 //It's void response
101119 } ) ;
102120
@@ -110,33 +128,46 @@ describe("Eventgrid test", () => {
110128 for await ( let item of client . domains . listByResourceGroup ( resourceGroupName ) ) {
111129 resArray . push ( item ) ;
112130 }
113- assert . equal ( resArray . length , 1 )
131+ assert . equal ( resArray . length , 1 ) ;
114132 } ) ;
115133
116134 it ( "domaintopics create test" , async function ( ) {
117- const res = await client . topics . beginCreateOrUpdateAndWait ( resourceGroupName , domaintopicName , { location } , testPollingOptions ) ;
135+ const res = await client . topics . beginCreateOrUpdateAndWait (
136+ resourceGroupName ,
137+ domaintopicName ,
138+ { location } ,
139+ testPollingOptions ,
140+ ) ;
118141 assert . equal ( res . name , domaintopicName ) ;
119142 } ) ;
120143
121144 it ( "domainTopicEventSubscriptions create test" , async function ( ) {
122145 //before test this case please create an eventhub namespace "czweventhub" and an eventhub "czweh"
123- const res = await client . domainTopicEventSubscriptions . beginCreateOrUpdateAndWait ( resourceGroupName ,
146+ const res = await client . domainTopicEventSubscriptions . beginCreateOrUpdateAndWait (
147+ resourceGroupName ,
124148 domainName ,
125149 domaintopicName ,
126150 eventSubscriptionName ,
127151 {
128- topic : "/subscriptions/" + subscriptionId + "/resourceGroups/myjstest/providers/Microsoft.EventGrid/domains/mydomainxxx/topics/testDomainTopic" ,
152+ topic :
153+ "/subscriptions/" +
154+ subscriptionId +
155+ "/resourceGroups/myjstest/providers/Microsoft.EventGrid/domains/mydomainxxx/topics/testDomainTopic" ,
129156 destination : {
130157 endpointType : "EventHub" ,
131- resourceId : "/subscriptions/" + subscriptionId + "/resourceGroups/myjstest/providers/Microsoft.EventHub/namespaces/czweventhub/eventhubs/czweh" ,
158+ resourceId :
159+ "/subscriptions/" +
160+ subscriptionId +
161+ "/resourceGroups/myjstest/providers/Microsoft.EventHub/namespaces/czweventhub/eventhubs/czweh" ,
132162 } ,
133163 filter : {
134164 advancedFilters : [ ] ,
135- enableAdvancedFilteringOnArrays : true
165+ enableAdvancedFilteringOnArrays : true ,
136166 } ,
137- eventDeliverySchema : "EventGridSchema"
167+ eventDeliverySchema : "EventGridSchema" ,
138168 } ,
139- testPollingOptions ) ;
169+ testPollingOptions ,
170+ ) ;
140171 console . log ( res ) ;
141172 assert . equal ( res . name , eventSubscriptionName ) ;
142173 } ) ;
@@ -146,39 +177,46 @@ describe("Eventgrid test", () => {
146177 for await ( let item of client . domainTopicEventSubscriptions . list (
147178 resourceGroupName ,
148179 domainName ,
149- domaintopicName ) ) {
180+ domaintopicName ,
181+ ) ) {
150182 resArray . push ( item ) ;
151183 }
152184 assert . equal ( resArray . length , 1 ) ;
153- console . log ( ' ********************************' )
185+ console . log ( " ********************************" ) ;
154186 } ) ;
155187
156188 it ( "domainTopicEventSubscriptions get test" , async function ( ) {
157189 const res = await client . domainTopicEventSubscriptions . get (
158190 resourceGroupName ,
159191 domainName ,
160192 domaintopicName ,
161- eventSubscriptionName ) ;
193+ eventSubscriptionName ,
194+ ) ;
162195 assert . equal ( res . name , eventSubscriptionName ) ;
163196 } ) ;
164197
165198 it ( "domainTopicEventSubscriptions update test" , async function ( ) {
166- const res = await client . domainTopicEventSubscriptions . beginUpdateAndWait ( resourceGroupName ,
199+ const res = await client . domainTopicEventSubscriptions . beginUpdateAndWait (
200+ resourceGroupName ,
167201 domainName ,
168202 domaintopicName ,
169203 eventSubscriptionName ,
170204 {
171205 destination : {
172206 endpointType : "EventHub" ,
173- resourceId : "/subscriptions/" + subscriptionId + "/resourceGroups/myjstest/providers/Microsoft.EventHub/namespaces/czweventhub/eventhubs/czweh" ,
207+ resourceId :
208+ "/subscriptions/" +
209+ subscriptionId +
210+ "/resourceGroups/myjstest/providers/Microsoft.EventHub/namespaces/czweventhub/eventhubs/czweh" ,
174211 } ,
175212 filter : {
176213 advancedFilters : [ ] ,
177- enableAdvancedFilteringOnArrays : true
214+ enableAdvancedFilteringOnArrays : true ,
178215 } ,
179- eventDeliverySchema : "EventGridSchema"
216+ eventDeliverySchema : "EventGridSchema" ,
180217 } ,
181- testPollingOptions ) ;
218+ testPollingOptions ,
219+ ) ;
182220 console . log ( res ) ;
183221 assert . equal ( res . name , eventSubscriptionName ) ;
184222 } ) ;
@@ -188,19 +226,27 @@ describe("Eventgrid test", () => {
188226 resourceGroupName ,
189227 domainName ,
190228 topicName ,
191- eventSubscriptionName , testPollingOptions ) ;
229+ eventSubscriptionName ,
230+ testPollingOptions ,
231+ ) ;
192232 const resArray = new Array ( ) ;
193233 for await ( let item of client . domainTopicEventSubscriptions . list (
194234 resourceGroupName ,
195235 domainName ,
196- topicName ) ) {
236+ topicName ,
237+ ) ) {
197238 resArray . push ( item ) ;
198239 }
199240 assert . equal ( resArray . length , 0 ) ;
200241 } ) ;
201242
202243 it ( "domaintopics delete test" , async function ( ) {
203- const res = await client . domainTopics . beginDeleteAndWait ( resourceGroupName , domainName , domaintopicName , testPollingOptions ) ;
244+ const res = await client . domainTopics . beginDeleteAndWait (
245+ resourceGroupName ,
246+ domainName ,
247+ domaintopicName ,
248+ testPollingOptions ,
249+ ) ;
204250 const resArray = new Array ( ) ;
205251 for await ( let item of client . domainTopics . listByDomain ( resourceGroupName , domainName ) ) {
206252 resArray . push ( item ) ;
@@ -209,8 +255,16 @@ describe("Eventgrid test", () => {
209255 } ) ;
210256
211257 it ( "topics delete test" , async function ( ) {
212- const res = await client . topics . beginDeleteAndWait ( resourceGroupName , topicName , testPollingOptions ) ;
213- const res1 = await client . topics . beginDeleteAndWait ( resourceGroupName , domaintopicName , testPollingOptions ) ; // when create a domaintopic, it will create a topic with the same name, so we also need to delete that resource to make test pass.
258+ const res = await client . topics . beginDeleteAndWait (
259+ resourceGroupName ,
260+ topicName ,
261+ testPollingOptions ,
262+ ) ;
263+ const res1 = await client . topics . beginDeleteAndWait (
264+ resourceGroupName ,
265+ domaintopicName ,
266+ testPollingOptions ,
267+ ) ; // when create a domaintopic, it will create a topic with the same name, so we also need to delete that resource to make test pass.
214268 const resArray = new Array ( ) ;
215269 for await ( let item of client . topics . listByResourceGroup ( resourceGroupName ) ) {
216270 resArray . push ( item ) ;
@@ -219,7 +273,11 @@ describe("Eventgrid test", () => {
219273 } ) ;
220274
221275 it ( "domains delete test" , async function ( ) {
222- const res = await client . domains . beginDeleteAndWait ( resourceGroupName , domainName , testPollingOptions ) ;
276+ const res = await client . domains . beginDeleteAndWait (
277+ resourceGroupName ,
278+ domainName ,
279+ testPollingOptions ,
280+ ) ;
223281 const resArray = new Array ( ) ;
224282 for await ( let item of client . domains . listByResourceGroup ( resourceGroupName ) ) {
225283 resArray . push ( item ) ;
0 commit comments