@@ -19,8 +19,8 @@ describe("Template Parser PostProcessor", () => {
19
19
} ) ;
20
20
21
21
it ( "Replaces empty row type with set_variable" , ( ) => {
22
- const res = parser . postProcessRow ( { ...ROW_BASE } ) ;
23
- expect ( res ) . toEqual ( { ... ROW_BASE , type : "set_variable" } ) ;
22
+ const res = parser . postProcessRow ( { ...ROW_BASE , type : "" as any } ) ;
23
+ expect ( res . type ) . toEqual ( "set_variable" ) ;
24
24
} ) ;
25
25
26
26
// TODO - notify authors of change (can now auto gen multiple)
@@ -34,14 +34,15 @@ describe("Template Parser PostProcessor", () => {
34
34
] ,
35
35
} ) ;
36
36
expect ( res . rows ) . toEqual ( [
37
+ // Note - suffix numbers start at 2 as flow sheet would typically have row 1 as header row
37
38
{
38
- _nested_name : "accordion_1 " ,
39
- name : "accordion_1 " ,
39
+ _nested_name : "accordion_2 " ,
40
+ name : "accordion_2 " ,
40
41
type : "accordion" ,
41
42
} ,
42
43
{
43
- _nested_name : "accordion_2 " ,
44
- name : "accordion_2 " ,
44
+ _nested_name : "accordion_3 " ,
45
+ name : "accordion_3 " ,
45
46
type : "accordion" ,
46
47
} ,
47
48
] ) ;
@@ -119,7 +120,6 @@ describe("Template Parser PostProcessor", () => {
119
120
{ trigger : "click" , action_id : "" , args : [ "@local.my_action_list" , "some_value" ] } ,
120
121
] ,
121
122
} ) ;
122
- console . log ( "action" , res . action_list ) ;
123
123
expect ( res . action_list [ 0 ] . args ) . toEqual ( [ "this.value" , "some_value" ] ) ;
124
124
} ) ;
125
125
@@ -148,33 +148,32 @@ describe("Template Parser PostProcessor", () => {
148
148
expect ( res . _dynamicDependencies ) . toEqual ( { "@local.dynamic_value" : [ "value" ] } ) ;
149
149
} ) ;
150
150
151
- fit ( "Creates nested path names for child rows" , ( ) => {
151
+ it ( "Creates nested path names for child rows" , ( ) => {
152
152
const rows : FlowTypes . TemplateRow [ ] = [
153
153
{
154
154
_nested_name : "my_items" ,
155
155
name : "my_items" ,
156
156
type : "items" ,
157
- rows : [ { name : "nested_text" , type : "text" , _nested_name : "nested_text" } ] ,
157
+ // Handle case of both named and unnamed nested row names
158
+ rows : [
159
+ {
160
+ ...ROW_BASE ,
161
+ type : "text" ,
162
+ name : "named_text" ,
163
+ } ,
164
+ { ...ROW_BASE , type : "text" } ,
165
+ ] ,
158
166
} ,
159
167
] ;
160
168
const res = parser . run ( { flow_type : "template" , flow_name : "test_nested" , rows } ) ;
161
169
const itemRows = res . rows [ 0 ] . rows ;
162
- console . log ( "itemRows" , itemRows ) ;
163
- expect ( itemRows ) . toEqual ( [
164
- { name : "nested_text" , type : "text" , _nested_name : "my_items.nested_text" } ,
165
- ] ) ;
166
- // TODO - include auto-gen nested names
170
+ const nestedNames = itemRows . map ( ( n ) => n . _nested_name ) ;
171
+ expect ( nestedNames ) . toEqual ( [ "my_items.named_text" , "my_items.text_2" ] ) ;
167
172
} ) ;
168
173
} ) ;
169
174
170
175
describe ( "Template Parser [QC]" , ( ) => {
171
- it ( "Ensures answer_list parameters refer to list variables" , ( ) => {
172
- const res = parser . postProcessRow ( { ...ROW_BASE } ) ;
173
- expect ( res ) . toEqual ( { ...ROW_BASE } ) ;
174
- } ) ;
175
-
176
- it ( "Warns if " , ( ) => {
177
- const res = parser . postProcessRow ( { ...ROW_BASE } ) ;
178
- expect ( res ) . toEqual ( { ...ROW_BASE } ) ;
179
- } ) ;
176
+ // TODO - confirm what checks to include and add to code
177
+ // it("Ensures answer_list parameters refer to list variables", () => {
178
+ // });
180
179
} ) ;
0 commit comments