@@ -51,6 +51,62 @@ describe("workflow builder", () => {
5151 } ) ;
5252
5353
54+ it ( "should create a workflow with all fields" , ( ) => {
55+ const workflow : Workflow =
56+ new WorkflowBuilder ( )
57+ . withId ( "helloworld" )
58+ . withName ( "hello world" )
59+ . withVersion ( "0.6" )
60+ . withStart ( "hello builder" )
61+ . withStates ( [ new InjectStateBuilder ( )
62+ . withName ( "Hello State" )
63+ . withData ( {
64+ "result" : "Hello World!" ,
65+ } )
66+ . withEnd ( true ) . build ( ) ] )
67+ . withDescription ( "hello builder description" )
68+ . withSchemaVersion ( "0.6" )
69+ . withSchemaVersion ( "1.0" )
70+ . withExpressionLang ( "jq" )
71+ . withExecTimeout ( { duration : 'PT2M' } )
72+ . withKeepActive ( true )
73+ . withMetadata ( {
74+ "key1" : "value1" ,
75+ "key2" : "value2" ,
76+ } )
77+ . withEvents ( "http://myhost:8080/eventsdefs.json" )
78+ . withFunctions ( "http://myhost:8080/functionsdefs.json" )
79+ . withRetries ( "http://myhost:8080/retriesdefs.json" )
80+ . build ( ) ;
81+
82+ expect ( workflow ) . toEqual ( {
83+ "id" : "helloworld" ,
84+ "name" : "hello world" ,
85+ "version" : "0.6" ,
86+ "start" : "hello builder" ,
87+ "states" : [ {
88+ "type" : "inject" , "name" : "Hello State" ,
89+ "data" : { "result" : "Hello World!" } ,
90+ "end" : true ,
91+ } ] ,
92+ "description" : "hello builder description" ,
93+ "schemaVersion" : "1.0" ,
94+ "expressionLang" : "jq" ,
95+ "execTimeout" : { duration : 'PT2M' } ,
96+ "keepActive" : true ,
97+ "metadata" : {
98+ "key1" : "value1" ,
99+ "key2" : "value2" ,
100+ } ,
101+ "events" : "http://myhost:8080/eventsdefs.json" ,
102+ "functions" : "http://myhost:8080/functionsdefs.json" ,
103+ "retries" : "http://myhost:8080/retriesdefs.json" ,
104+ } ,
105+ ) ;
106+
107+ } ) ;
108+
109+
54110 it ( "should invoke validator class" , ( ) => {
55111
56112 const workflowValidator = new WorkflowValidator ( { } ) ;
0 commit comments