@@ -71,7 +71,7 @@ describe("ChaosHandler.ts", () => {
7171 } ) ;
7272 } ) ;
7373
74- describe ( "sendRequest" , async ( ) => {
74+ describe ( "sendRequest" , ( ) => {
7575 const cxt : Context = {
7676 request : "https://graph.microsoft.com/v1.0/me" ,
7777 options : {
@@ -80,19 +80,19 @@ describe("ChaosHandler.ts", () => {
8080 } ;
8181
8282 const manualMap : Map < string , Map < string , number > > = new Map ( [ [ "/me" , new Map ( [ [ "GET" , 500 ] ] ) ] ] ) ;
83- const tempManualOptions : ChaosHandlerOptions = new ChaosHandlerOptions ( ChaosStrategy . MANUAL ) ;
83+ const tempManualOptions : ChaosHandlerOptions = new ChaosHandlerOptions ( ChaosStrategy . MANUAL , undefined , undefined , 100 ) ;
8484 const tempChaosHandler = new ChaosHandler ( tempManualOptions , manualMap ) ;
8585
8686 const dummyHTTPHandler = new DummyHTTPMessageHandler ( ) ;
8787 const handler = new ChaosHandler ( ) ;
8888 handler . setNext ( dummyHTTPHandler ) ;
8989
90- it ( "Should return a response after creating it" , async ( ) => {
90+ it ( "Should return a response after creating it" , ( ) => {
9191 tempChaosHandler [ "sendRequest" ] ( tempManualOptions , cxt ) ;
9292 assert . isDefined ( cxt . response ) ;
9393 } ) ;
9494
95- it ( "Should send the request to the graph" , async ( ) => {
95+ it ( "Should send the request to the graph" , ( ) => {
9696 handler [ "sendRequest" ] ( new ChaosHandlerOptions ( ChaosStrategy . RANDOM , "I generated the error" , undefined , 100 ) , cxt ) ;
9797 assert . isDefined ( cxt . response ) ;
9898 } ) ;
@@ -215,7 +215,7 @@ describe("ChaosHandler.ts", () => {
215215 } ) ;
216216 } ) ;
217217
218- describe ( "execute" , async ( ) => {
218+ describe ( "execute" , ( ) => {
219219 const manualMap : Map < string , Map < string , number > > = new Map ( [
220220 [
221221 "/me" ,
@@ -233,7 +233,7 @@ describe("ChaosHandler.ts", () => {
233233 tempChaosHandlerRandom . setNext ( dummyHTTPHandler ) ;
234234 tempChaosHandlerManual . setNext ( dummyHTTPHandler ) ;
235235
236- it ( "Should return response for Default Case" , async ( ) => {
236+ it ( "Should return response for Default Case" , ( ) => {
237237 const options = new ChaosHandlerOptions ( ChaosStrategy . RANDOM ) ;
238238 const cxt : Context = {
239239 request : "https://graph.microsoft.com/v1.0/me" ,
@@ -245,7 +245,7 @@ describe("ChaosHandler.ts", () => {
245245 assert . isDefined ( tempChaosHandlerDefault [ "execute" ] ( cxt ) ) ;
246246 } ) ;
247247
248- it ( "Should return response for Random case" , async ( ) => {
248+ it ( "Should return response for Random case" , ( ) => {
249249 const cxt : Context = {
250250 request : "https://graph.microsoft.com/v1.0/me" ,
251251 options : {
@@ -255,7 +255,7 @@ describe("ChaosHandler.ts", () => {
255255 assert . isDefined ( tempChaosHandlerRandom [ "execute" ] ( cxt ) ) ;
256256 } ) ;
257257
258- it ( "Should return response for Manual Global case" , async ( ) => {
258+ it ( "Should return response for Manual Global case" , ( ) => {
259259 const cxt : Context = {
260260 request : "https://graph.microsoft.com/v1.0/me" ,
261261 options : {
@@ -265,7 +265,7 @@ describe("ChaosHandler.ts", () => {
265265 assert . isDefined ( tempChaosHandlerManual [ "execute" ] ( cxt ) ) ;
266266 } ) ;
267267
268- it ( "Should return response for Manual Request Level case" , async ( ) => {
268+ it ( "Should return response for Manual Request Level case" , ( ) => {
269269 const options = new ChaosHandlerOptions ( ChaosStrategy . MANUAL , "Manual Request level case" , 200 ) ;
270270 const cxt : Context = {
271271 request : "https://graph.microsoft.com/v1.0/me" ,
@@ -276,5 +276,17 @@ describe("ChaosHandler.ts", () => {
276276 } ;
277277 assert . isDefined ( tempChaosHandlerManual [ "execute" ] ( cxt ) ) ;
278278 } ) ;
279+
280+ it ( "Should return response for Manual Request Level case 100%" , ( ) => {
281+ const options = new ChaosHandlerOptions ( ChaosStrategy . MANUAL , "Manual Request level case" , 429 , 100 ) ;
282+ const cxt : Context = {
283+ request : "https://graph.microsoft.com/v1.0/me" ,
284+ options : {
285+ method : "GET" ,
286+ } ,
287+ middlewareControl : new MiddlewareControl ( [ options ] ) ,
288+ } ;
289+ assert . isDefined ( tempChaosHandlerManual [ "execute" ] ( cxt ) ) ;
290+ } ) ;
279291 } ) ;
280292} ) ;
0 commit comments