File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -2123,5 +2123,37 @@ describe("Lro Engine", function () {
21232123 assert . isTrue ( run ) ;
21242124 assert . isUndefined ( poller . getOperationState ( ) . isCancelled ) ;
21252125 } ) ;
2126+
2127+ it ( "cancelled poller gives access to partial results" , async ( ) => {
2128+ const pollingPath = "/LROPostDoubleHeadersFinalAzureHeaderGetDefault/asyncOperationUrl" ;
2129+ const poller = createPoller ( {
2130+ routes : [
2131+ {
2132+ method : "POST" ,
2133+ path : `/LROPostDoubleHeadersFinalAzureHeaderGetDefault` ,
2134+ status : 202 ,
2135+ body : "" ,
2136+ headers : {
2137+ "Operation-Location" : pollingPath ,
2138+ } ,
2139+ } ,
2140+ {
2141+ method : "GET" ,
2142+ path : pollingPath ,
2143+ status : 200 ,
2144+ body : `{ "status": "running"}` ,
2145+ } ,
2146+ {
2147+ method : "GET" ,
2148+ path : pollingPath ,
2149+ status : 200 ,
2150+ body : `{ "status": "canceled", "results": [1,2] }` ,
2151+ } ,
2152+ ] ,
2153+ } ) ;
2154+ await assertError ( poller . pollUntilDone ( ) , { messagePattern : / P o l l e r c a n c e l l e d / } ) ;
2155+ const result = poller . getResult ( ) ;
2156+ assert . deepEqual ( result ! . results , [ 1 , 2 ] ) ;
2157+ } ) ;
21262158 } ) ;
21272159} ) ;
You can’t perform that action at this time.
0 commit comments