@@ -423,7 +423,8 @@ func TestGetWorkflowNode_AudienceFilter(t *testing.T) {
423423 {"type": "property", "key": "plan", "operator": "equals", "value": "pro"}
424424 ]
425425 },
426- "audienceSegmentId": "seg_abc"
426+ "audienceSegmentId": "seg_abc",
427+ "appliesDownstream": true
427428 }`
428429 server := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
429430 w .WriteHeader (http .StatusOK )
@@ -452,6 +453,30 @@ func TestGetWorkflowNode_AudienceFilter(t *testing.T) {
452453 if af .Conditions [0 ].Property == nil || af .Conditions [0 ].Property .Key != "plan" {
453454 t .Errorf ("audienceFilter.Conditions[0] = %+v" , af .Conditions [0 ])
454455 }
456+ if ! node .AudienceFilter .AppliesDownstream {
457+ t .Error ("AppliesDownstream = false, want true" )
458+ }
459+ raw , err := json .Marshal (node )
460+ if err != nil {
461+ t .Fatalf ("Marshal: %v" , err )
462+ }
463+ if ! strings .Contains (string (raw ), `"appliesDownstream":true` ) {
464+ t .Errorf ("marshal dropped appliesDownstream: %s" , raw )
465+ }
466+ }
467+
468+ func TestAudienceFilterWorkflowNode_MarshalKeepsFalseAppliesDownstream (t * testing.T ) {
469+ n := WorkflowNode {
470+ TypeName : WorkflowNodeTypeAudienceFilter ,
471+ AudienceFilter : & AudienceFilterWorkflowNode {ID : "n7" , WorkflowID : "wf_1" , NextNodeIDs : []string {"n9" }},
472+ }
473+ raw , err := json .Marshal (n )
474+ if err != nil {
475+ t .Fatalf ("Marshal: %v" , err )
476+ }
477+ if ! strings .Contains (string (raw ), `"appliesDownstream":false` ) {
478+ t .Errorf ("marshal dropped appliesDownstream: %s" , raw )
479+ }
455480}
456481
457482func TestWorkflowNode_MarshalRoundTrip (t * testing.T ) {
0 commit comments