@@ -538,6 +538,28 @@ export function runIntegrationTests(codec?: PayloadCodec): void {
538
538
t . regex ( event . workflowTaskCompletedEventAttributes ! . binaryChecksum ! , / @ t e m p o r a l i o \/ w o r k e r @ \d + \. \d + \. \d + / ) ;
539
539
} ) ;
540
540
541
+ test ( 'WorkflowHandle.describe result is wrapped' , async ( t ) => {
542
+ const { client } = t . context ;
543
+ const workflow = await client . start ( workflows . argsAndReturn , {
544
+ args : [ 'hey' , undefined , Buffer . from ( 'def' ) ] ,
545
+ taskQueue : 'test' ,
546
+ workflowId : uuid4 ( ) ,
547
+ searchAttributes : {
548
+ CustomKeywordField : 'test-value' ,
549
+ } ,
550
+ memo : {
551
+ note : 'foo' ,
552
+ } ,
553
+ } ) ;
554
+ await workflow . result ( ) ;
555
+ const execution = await workflow . describe ( ) ;
556
+ t . deepEqual ( execution . type , 'argsAndReturn' ) ;
557
+ t . deepEqual ( execution . memo , { note : 'foo' } ) ;
558
+ t . true ( execution . startTime instanceof Date ) ;
559
+ t . is ( execution . searchAttributes ! . CustomKeywordField , 'test-value' ) ;
560
+ t . regex ( ( execution . searchAttributes ! . BinaryChecksums as string [ ] ) [ 0 ] , / @ t e m p o r a l i o \/ w o r k e r @ / ) ;
561
+ } ) ;
562
+
541
563
test ( 'WorkflowOptions are passed correctly with defaults' , async ( t ) => {
542
564
const { client } = t . context ;
543
565
const workflow = await client . start ( workflows . argsAndReturn , {
@@ -547,22 +569,23 @@ export function runIntegrationTests(codec?: PayloadCodec): void {
547
569
} ) ;
548
570
await workflow . result ( ) ;
549
571
const execution = await workflow . describe ( ) ;
550
- t . deepEqual (
551
- execution . workflowExecutionInfo ?. type ,
552
- new iface . temporal . api . common . v1 . WorkflowType ( { name : 'argsAndReturn' } )
553
- ) ;
554
- t . deepEqual ( execution . workflowExecutionInfo ?. memo , new iface . temporal . api . common . v1 . Memo ( { fields : { } } ) ) ;
555
- t . deepEqual ( Object . keys ( execution . workflowExecutionInfo ! . searchAttributes ! . indexedFields ! ) , [ 'BinaryChecksums' ] ) ;
572
+ t . deepEqual ( execution . type , 'argsAndReturn' ) ;
573
+ t . deepEqual ( Object . keys ( execution . raw . workflowExecutionInfo ! . searchAttributes ! . indexedFields ! ) , [
574
+ 'BinaryChecksums' ,
575
+ ] ) ;
556
576
557
577
const checksums = defaultPayloadConverter . fromPayload (
558
- execution . workflowExecutionInfo ! . searchAttributes ! . indexedFields ! . BinaryChecksums !
578
+ execution . raw . workflowExecutionInfo ! . searchAttributes ! . indexedFields ! . BinaryChecksums !
559
579
) ;
560
580
t . true ( checksums instanceof Array && checksums . length === 1 ) ;
561
581
t . regex ( ( checksums as string [ ] ) [ 0 ] , / @ t e m p o r a l i o \/ w o r k e r @ \d + \. \d + \. \d + / ) ;
562
- t . is ( execution . executionConfig ?. taskQueue ?. name , 'test' ) ;
563
- t . is ( execution . executionConfig ?. taskQueue ?. kind , iface . temporal . api . enums . v1 . TaskQueueKind . TASK_QUEUE_KIND_NORMAL ) ;
564
- t . is ( execution . executionConfig ?. workflowRunTimeout , null ) ;
565
- t . is ( execution . executionConfig ?. workflowExecutionTimeout , null ) ;
582
+ t . is ( execution . raw . executionConfig ?. taskQueue ?. name , 'test' ) ;
583
+ t . is (
584
+ execution . raw . executionConfig ?. taskQueue ?. kind ,
585
+ iface . temporal . api . enums . v1 . TaskQueueKind . TASK_QUEUE_KIND_NORMAL
586
+ ) ;
587
+ t . is ( execution . raw . executionConfig ?. workflowRunTimeout , null ) ;
588
+ t . is ( execution . raw . executionConfig ?. workflowExecutionTimeout , null ) ;
566
589
} ) ;
567
590
568
591
test ( 'WorkflowOptions are passed correctly' , async ( t ) => {
@@ -584,22 +607,25 @@ export function runIntegrationTests(codec?: PayloadCodec): void {
584
607
} ) ;
585
608
const execution = await workflow . describe ( ) ;
586
609
t . deepEqual (
587
- execution . workflowExecutionInfo ?. type ,
610
+ execution . raw . workflowExecutionInfo ?. type ,
588
611
new iface . temporal . api . common . v1 . WorkflowType ( { name : 'sleeper' } )
589
612
) ;
590
- t . deepEqual ( await fromPayload ( execution . workflowExecutionInfo ! . memo ! . fields ! . a ! ) , 'b' ) ;
613
+ t . deepEqual ( await fromPayload ( execution . raw . workflowExecutionInfo ! . memo ! . fields ! . a ! ) , 'b' ) ;
591
614
t . deepEqual (
592
615
await defaultPayloadConverter . fromPayload (
593
- execution . workflowExecutionInfo ! . searchAttributes ! . indexedFields ! . CustomIntField !
616
+ execution . raw . workflowExecutionInfo ! . searchAttributes ! . indexedFields ! . CustomIntField !
594
617
) ,
595
618
3
596
619
) ;
597
- t . is ( execution . executionConfig ?. taskQueue ?. name , 'test2' ) ;
598
- t . is ( execution . executionConfig ?. taskQueue ?. kind , iface . temporal . api . enums . v1 . TaskQueueKind . TASK_QUEUE_KIND_NORMAL ) ;
620
+ t . is ( execution . raw . executionConfig ?. taskQueue ?. name , 'test2' ) ;
621
+ t . is (
622
+ execution . raw . executionConfig ?. taskQueue ?. kind ,
623
+ iface . temporal . api . enums . v1 . TaskQueueKind . TASK_QUEUE_KIND_NORMAL
624
+ ) ;
599
625
600
- t . is ( tsToMs ( execution . executionConfig ! . workflowRunTimeout ! ) , ms ( options . workflowRunTimeout ) ) ;
601
- t . is ( tsToMs ( execution . executionConfig ! . workflowExecutionTimeout ! ) , ms ( options . workflowExecutionTimeout ) ) ;
602
- t . is ( tsToMs ( execution . executionConfig ! . defaultWorkflowTaskTimeout ! ) , ms ( options . workflowTaskTimeout ) ) ;
626
+ t . is ( tsToMs ( execution . raw . executionConfig ! . workflowRunTimeout ! ) , ms ( options . workflowRunTimeout ) ) ;
627
+ t . is ( tsToMs ( execution . raw . executionConfig ! . workflowExecutionTimeout ! ) , ms ( options . workflowExecutionTimeout ) ) ;
628
+ t . is ( tsToMs ( execution . raw . executionConfig ! . defaultWorkflowTaskTimeout ! ) , ms ( options . workflowTaskTimeout ) ) ;
603
629
} ) ;
604
630
605
631
test ( 'WorkflowHandle.result() throws if terminated' , async ( t ) => {
@@ -667,7 +693,7 @@ export function runIntegrationTests(codec?: PayloadCodec): void {
667
693
} ) ;
668
694
await workflow . result ( ) ;
669
695
const info = await workflow . describe ( ) ;
670
- t . is ( info . workflowExecutionInfo ?. type ?. name , 'sleeper' ) ;
696
+ t . is ( info . raw . workflowExecutionInfo ?. type ?. name , 'sleeper' ) ;
671
697
const { history } = await client . service . getWorkflowExecutionHistory ( {
672
698
namespace,
673
699
execution : { workflowId : workflow . workflowId , runId : err . newExecutionRunId } ,
@@ -753,14 +779,7 @@ export function runIntegrationTests(codec?: PayloadCodec): void {
753
779
return ;
754
780
}
755
781
t . is ( failure . message , 'unhandled rejection' ) ;
756
- t . true (
757
- failure . stackTrace ?. includes (
758
- dedent `
759
- Error: unhandled rejection
760
- at eval (webpack-internal:///./lib/workflows/unhandled-rejection.js
761
- `
762
- )
763
- ) ;
782
+ t . true ( failure . stackTrace ?. includes ( `Error: unhandled rejection` ) ) ;
764
783
t . is ( failure . cause ?. message , 'root failure' ) ;
765
784
} ,
766
785
{ minTimeout : 300 , factor : 1 , retries : 100 }
@@ -815,8 +834,8 @@ export function runIntegrationTests(codec?: PayloadCodec): void {
815
834
} ) ;
816
835
await t . throwsAsync ( handle . result ( ) ) ;
817
836
const handleForSecondAttempt = client . getHandle ( workflowId ) ;
818
- const { workflowExecutionInfo } = await handleForSecondAttempt . describe ( ) ;
819
- t . not ( workflowExecutionInfo ?. execution ?. runId , handle . originalRunId ) ;
837
+ const { raw } = await handleForSecondAttempt . describe ( ) ;
838
+ t . not ( raw . workflowExecutionInfo ?. execution ?. runId , handle . originalRunId ) ;
820
839
} ) ;
821
840
822
841
test ( 'Workflow RetryPolicy ignored with nonRetryable failure' , async ( t ) => {
@@ -835,7 +854,7 @@ export function runIntegrationTests(codec?: PayloadCodec): void {
835
854
await t . throwsAsync ( handle . result ( ) ) ;
836
855
const res = await handle . describe ( ) ;
837
856
t . is (
838
- res . workflowExecutionInfo ?. status ,
857
+ res . raw . workflowExecutionInfo ?. status ,
839
858
iface . temporal . api . enums . v1 . WorkflowExecutionStatus . WORKFLOW_EXECUTION_STATUS_FAILED
840
859
) ;
841
860
} ) ;
0 commit comments