11// Copyright (c) Microsoft Corporation.
22// Licensed under the MIT license.
3- import { Recorder , isPlaybackMode } from "@azure-tools/test-recorder" ;
3+ import { Recorder , isPlaybackMode , testPollingOptions } from "@azure-tools/test-recorder" ;
44import { assert } from "chai" ;
55import { Context } from "mocha" ;
66import { AppConfigurationClient } from "../../src/appConfigurationClient" ;
@@ -59,7 +59,7 @@ describe("AppConfigurationClient snapshot", () => {
5959 describe ( "createSnapshot" , ( ) => {
6060 it ( "create a snapshot" , async ( ) => {
6161 // creating a new snapshot
62- const poller = await client . beginCreateSnapshot ( snapshot1 ) ;
62+ const poller = await client . beginCreateSnapshot ( snapshot1 , testPollingOptions ) ;
6363 newSnapshot = await poller . pollUntilDone ( ) ;
6464 assertEqualSnapshot ( newSnapshot , snapshot1 ) ;
6565
@@ -68,7 +68,7 @@ describe("AppConfigurationClient snapshot", () => {
6868
6969 it ( "service throws error when tried to create a snapshot with same name" , async ( ) => {
7070 // creating a new snapshot
71- newSnapshot = await client . beginCreateSnapshotAndWait ( snapshot1 ) ;
71+ newSnapshot = await client . beginCreateSnapshotAndWait ( snapshot1 , testPollingOptions ) ;
7272 assertEqualSnapshot ( newSnapshot , snapshot1 ) ;
7373
7474 const errorExpected = {
@@ -80,7 +80,7 @@ describe("AppConfigurationClient snapshot", () => {
8080
8181 // attempt to add the same snapshot
8282 try {
83- await client . beginCreateSnapshotAndWait ( snapshot1 ) ;
83+ await client . beginCreateSnapshotAndWait ( snapshot1 , testPollingOptions ) ;
8484 throw new Error ( "Test failure" ) ;
8585 } catch ( err : any ) {
8686 assert . equal ( err . message , JSON . stringify ( errorExpected ) ) ;
@@ -98,6 +98,7 @@ describe("AppConfigurationClient snapshot", () => {
9898 requestOptions : {
9999 timeout : 1 ,
100100 } ,
101+ updateIntervalInMs : testPollingOptions . updateIntervalInMs ,
101102 } ) ;
102103 } ) ;
103104 } ) ;
@@ -106,7 +107,7 @@ describe("AppConfigurationClient snapshot", () => {
106107 describe ( "listConfigurationSettings of a Snapshot" , ( ) => {
107108 it ( "list configuration settings" , async ( ) => {
108109 // creating a new snapshot
109- newSnapshot = await client . beginCreateSnapshotAndWait ( snapshot1 ) ;
110+ newSnapshot = await client . beginCreateSnapshotAndWait ( snapshot1 , testPollingOptions ) ;
110111
111112 // change the value of the setting
112113 await client . setConfigurationSetting ( { ...filter1 , value : "value2" } ) ;
@@ -129,7 +130,7 @@ describe("AppConfigurationClient snapshot", () => {
129130 describe ( "archiveSnapshot" , ( ) => {
130131 it ( "archive a snapshot" , async ( ) => {
131132 // creating a new snapshot
132- newSnapshot = await client . beginCreateSnapshotAndWait ( snapshot1 ) ;
133+ newSnapshot = await client . beginCreateSnapshotAndWait ( snapshot1 , testPollingOptions ) ;
133134 const archivedSnapshot = await client . archiveSnapshot ( newSnapshot ) ;
134135
135136 assert . equal (
@@ -154,7 +155,7 @@ describe("AppConfigurationClient snapshot", () => {
154155 describe ( "getSnapshot" , ( ) => {
155156 it ( "get a snapshot" , async ( ) => {
156157 // creating a new snapshot
157- newSnapshot = await client . beginCreateSnapshotAndWait ( snapshot1 ) ;
158+ newSnapshot = await client . beginCreateSnapshotAndWait ( snapshot1 , testPollingOptions ) ;
158159
159160 const snapshot = await client . getSnapshot ( newSnapshot . name ) ;
160161 assertEqualSnapshot ( snapshot , newSnapshot ) ;
@@ -165,7 +166,7 @@ describe("AppConfigurationClient snapshot", () => {
165166 it . skip ( "accepts operation options" , async function ( ) {
166167 if ( isPlaybackMode ( ) ) this . skip ( ) ;
167168 // creating a new snapshot
168- newSnapshot = await client . beginCreateSnapshotAndWait ( snapshot1 ) ;
169+ newSnapshot = await client . beginCreateSnapshotAndWait ( snapshot1 , testPollingOptions ) ;
169170 await assertThrowsAbortError ( async ( ) => {
170171 await client . getSnapshot ( newSnapshot . name , {
171172 requestOptions : {
@@ -194,14 +195,14 @@ describe("AppConfigurationClient snapshot", () => {
194195 assert . equal ( num , 0 , "There should be no snapshot in ready status" ) ;
195196
196197 // creating a new snapshot 1
197- await client . beginCreateSnapshotAndWait ( snapshot1 ) ;
198+ await client . beginCreateSnapshotAndWait ( snapshot1 , testPollingOptions ) ;
198199
199200 // create a new snapshot 2
200201 const snapshot2 = {
201202 name : recorder . variable ( "snapshot2" , `snapshot-${ new Date ( ) . getTime ( ) } ` ) ,
202203 filters : [ filter1 , filter2 ] ,
203204 } ;
204- await client . beginCreateSnapshotAndWait ( snapshot2 ) ;
205+ await client . beginCreateSnapshotAndWait ( snapshot2 , testPollingOptions ) ;
205206
206207 // new snapshot lists
207208 const listAfter = await client . listSnapshots ( { statusFilter : [ "ready" ] } ) ;
0 commit comments