@@ -1488,6 +1488,45 @@ describe("Orchestrator", () => {
14881488 ) ;
14891489 } ) ;
14901490
1491+ it ( "schedules a versioned suborchestrator function" , async ( ) => {
1492+ const orchestrator = TestOrchestrations . SayHelloWithVersionedSubOrchestrator ;
1493+ const name = "World" ;
1494+ const id = uuidv1 ( ) ;
1495+ const childId = `${ id } :0` ;
1496+ const mockContext = new DummyOrchestrationContext ( ) ;
1497+ const orchestrationInput = new DurableOrchestrationInput (
1498+ id ,
1499+ TestHistories . GetOrchestratorStart (
1500+ "SayHelloWithVersionedSubOrchestrator" ,
1501+ moment . utc ( ) . toDate ( )
1502+ ) ,
1503+ name
1504+ ) ;
1505+
1506+ const result = await orchestrator ( orchestrationInput , mockContext ) ;
1507+
1508+ expect ( result ) . to . be . deep . equal (
1509+ new OrchestratorState (
1510+ {
1511+ isDone : false ,
1512+ output : undefined ,
1513+ actions : [
1514+ [
1515+ new CallSubOrchestratorAction (
1516+ "SayHelloWithActivity" ,
1517+ childId ,
1518+ name ,
1519+ "v2"
1520+ ) ,
1521+ ] ,
1522+ ] ,
1523+ schemaVersion : ReplaySchema . V1 ,
1524+ } ,
1525+ true
1526+ )
1527+ ) ;
1528+ } ) ;
1529+
14911530 it ( "schedules a suborchestrator function with no instanceId" , async ( ) => {
14921531 const orchestrator = TestOrchestrations . SayHelloWithSubOrchestratorNoSubId ;
14931532 const name = "World" ;
@@ -1661,8 +1700,18 @@ describe("Orchestrator", () => {
16611700 . to . be . an ( "object" )
16621701 . that . deep . include ( {
16631702 isDone : false ,
1703+ // Note: In error paths, actions may be serialized without undefined fields.
1704+ // Using a plain object literal avoids setting expectations on the presence
1705+ // of any property that would cause deep.include to fail.
16641706 actions : [
1665- [ new CallSubOrchestratorAction ( "SayHelloWithActivity" , childId , name ) ] ,
1707+ [
1708+ {
1709+ actionType : ActionType . CallSubOrchestrator ,
1710+ functionName : "SayHelloWithActivity" ,
1711+ instanceId : childId ,
1712+ input : name ,
1713+ } ,
1714+ ] ,
16661715 ] ,
16671716 } ) ;
16681717 expect ( orchestrationState . error ) . to . include ( expectedErr ) ;
@@ -1789,6 +1838,47 @@ describe("Orchestrator", () => {
17891838 ) ;
17901839 } ) ;
17911840
1841+ it ( "schedules a versioned suborchestrator function with retry" , async ( ) => {
1842+ const orchestrator = TestOrchestrations . SayHelloWithVersionedSubOrchestratorRetry ;
1843+ const name = "World" ;
1844+ const id = uuidv1 ( ) ;
1845+ const childId = `${ id } :0` ;
1846+ const mockContext = new DummyOrchestrationContext ( ) ;
1847+ const orchestrationInput = new DurableOrchestrationInput (
1848+ id ,
1849+ TestHistories . GetOrchestratorStart (
1850+ "SayHelloWithVersionedSubOrchestratorRetry" ,
1851+ moment . utc ( ) . toDate ( ) ,
1852+ name
1853+ ) ,
1854+ name
1855+ ) ;
1856+
1857+ const result = await orchestrator ( orchestrationInput , mockContext ) ;
1858+
1859+ expect ( result ) . to . be . deep . equal (
1860+ new OrchestratorState (
1861+ {
1862+ isDone : false ,
1863+ output : undefined ,
1864+ actions : [
1865+ [
1866+ new CallSubOrchestratorWithRetryAction (
1867+ "SayHelloInline" ,
1868+ new RetryOptions ( 10000 , 2 ) ,
1869+ name ,
1870+ childId ,
1871+ "v2"
1872+ ) ,
1873+ ] ,
1874+ ] ,
1875+ schemaVersion : ReplaySchema . V1 ,
1876+ } ,
1877+ true
1878+ )
1879+ ) ;
1880+ } ) ;
1881+
17921882 it ( "retries a failed suborchestrator function if < max attempts" , async ( ) => {
17931883 const orchestrator = TestOrchestrations . SayHelloWithSubOrchestratorRetry ;
17941884 const name = "World" ;
@@ -1864,14 +1954,18 @@ describe("Orchestrator", () => {
18641954 . to . be . an ( "object" )
18651955 . that . deep . include ( {
18661956 isDone : false ,
1957+ // Note: In error paths, actions may be serialized without undefined fields.
1958+ // Using a plain object literal avoids setting expectations on the presence
1959+ // of any property that would cause deep.include to fail.
18671960 actions : [
18681961 [
1869- new CallSubOrchestratorWithRetryAction (
1870- "SayHelloInline" ,
1871- new RetryOptions ( 10000 , 2 ) ,
1872- name ,
1873- childId
1874- ) ,
1962+ {
1963+ actionType : ActionType . CallSubOrchestratorWithRetry ,
1964+ functionName : "SayHelloInline" ,
1965+ retryOptions : new RetryOptions ( 10000 , 2 ) ,
1966+ instanceId : childId ,
1967+ input : name ,
1968+ } ,
18751969 ] ,
18761970 ] ,
18771971 } ) ;
0 commit comments