@@ -10,8 +10,9 @@ import { Client } from '@temporalio/client';
1010import { toCanonicalString , WorkerDeploymentVersion } from '@temporalio/common' ;
1111import { temporal } from '@temporalio/proto' ;
1212import { Worker } from './helpers' ;
13- import { makeTestFunction } from './helpers-integration' ;
13+ import { Context , makeTestFunction } from './helpers-integration' ;
1414import { unblockSignal , versionQuery } from './workflows' ;
15+ import { ExecutionContext } from 'ava' ;
1516
1617const test = makeTestFunction ( { workflowsPath : __filename } ) ;
1718
@@ -242,7 +243,11 @@ test('Worker deployment based versioning with ramping', async (t) => {
242243 t . pass ( ) ;
243244} ) ;
244245
245- test ( 'Worker deployment with dynamic workflow on run' , async ( t ) => {
246+ async function testWorkerDeploymentWithDynamicBehavior (
247+ t : ExecutionContext < Context > ,
248+ workflowName : string ,
249+ expectedResult : string
250+ ) {
246251 if ( t . context . env . supportsTimeSkipping ) {
247252 t . pass ( "Test Server doesn't support worker deployments" ) ;
248253 return ;
@@ -276,17 +281,15 @@ test('Worker deployment with dynamic workflow on run', async (t) => {
276281 const describeResp = await waitUntilWorkerDeploymentVisible ( client , version ) ;
277282 await setCurrentDeploymentVersion ( client , describeResp . conflictToken , version ) ;
278283
279- const wf = await client . workflow . start ( 'cooldynamicworkflow' , {
284+ const wf = await client . workflow . start ( workflowName , {
280285 taskQueue,
281286 workflowId : 'dynamic-workflow-versioning-' + randomUUID ( ) ,
282287 } ) ;
283288
284289 const result = await wf . result ( ) ;
285- assert . equal ( result , 'dynamic' ) ;
290+ assert . equal ( result , expectedResult ) ;
286291
287- // Check history for versioning behavior
288292 const history = await wf . fetchHistory ( ) ;
289-
290293 const hasPinnedVersioningBehavior = history . events ! . some (
291294 ( event ) =>
292295 event . workflowTaskCompletedEventAttributes &&
@@ -298,6 +301,14 @@ test('Worker deployment with dynamic workflow on run', async (t) => {
298301 worker . shutdown ( ) ;
299302 await workerPromise ;
300303 t . pass ( ) ;
304+ }
305+
306+ test ( 'Worker deployment with dynamic workflow static behavior' , async ( t ) => {
307+ await testWorkerDeploymentWithDynamicBehavior ( t , 'cooldynamicworkflow' , 'dynamic' ) ;
308+ } ) ;
309+
310+ test ( 'Worker deployment with behavior in getter' , async ( t ) => {
311+ await testWorkerDeploymentWithDynamicBehavior ( t , 'usesGetter' , 'usesGetter' ) ;
301312} ) ;
302313
303314test ( 'Workflows can use default versioning behavior' , async ( t ) => {
0 commit comments