@@ -782,8 +782,8 @@ func TestConnectionWithFilterRule(t *testing.T) {
782782 "--destination-name" , destName ,
783783 "--destination-type" , "CLI" ,
784784 "--destination-cli-path" , "/webhooks" ,
785- "--rule-filter-body" , `{"$. type":"payment"}` ,
786- "--rule-filter-headers" , `{"$. content-type":"application/json"}` ,
785+ "--rule-filter-body" , `{"type":"payment"}` ,
786+ "--rule-filter-headers" , `{"content-type":"application/json"}` ,
787787 )
788788 require .NoError (t , err , "Should create connection with filter rule" )
789789 require .NotEmpty (t , conn .ID , "Connection should have an ID" )
@@ -803,8 +803,8 @@ func TestConnectionWithFilterRule(t *testing.T) {
803803
804804 rule := getConn .Rules [0 ]
805805 assert .Equal (t , "filter" , rule ["type" ], "Rule type should be filter" )
806- assert .Equal (t , `{"$. type":"payment"}` , rule ["body" ], "Filter body should match input" )
807- assert .Equal (t , `{"$. content-type":"application/json"}` , rule ["headers" ], "Filter headers should match input" )
806+ assert .Equal (t , `{"type":"payment"}` , rule ["body" ], "Filter body should match input" )
807+ assert .Equal (t , `{"content-type":"application/json"}` , rule ["headers" ], "Filter headers should match input" )
808808
809809 t .Logf ("Successfully created and verified connection with filter rule: %s" , conn .ID )
810810}
@@ -987,7 +987,7 @@ func TestConnectionWithMultipleRules(t *testing.T) {
987987 "--destination-name" , destName ,
988988 "--destination-type" , "CLI" ,
989989 "--destination-cli-path" , "/webhooks" ,
990- "--rule-filter-body" , `{"$. type":"payment"}` ,
990+ "--rule-filter-body" , `{"type":"payment"}` ,
991991 "--rule-retry-strategy" , "exponential" ,
992992 "--rule-retry-count" , "5" ,
993993 "--rule-retry-interval" , "60000" ,
@@ -1015,7 +1015,7 @@ func TestConnectionWithMultipleRules(t *testing.T) {
10151015 assert .Equal (t , "retry" , getConn .Rules [2 ]["type" ], "Third rule should be retry (logical order)" )
10161016
10171017 // Verify filter rule details
1018- assert .Equal (t , `{"$. type":"payment"}` , getConn .Rules [0 ]["body" ], "Filter should have body expression" )
1018+ assert .Equal (t , `{"type":"payment"}` , getConn .Rules [0 ]["body" ], "Filter should have body expression" )
10191019
10201020 // Verify delay rule details
10211021 assert .Equal (t , float64 (1000 ), getConn .Rules [1 ]["delay" ], "Delay should be 1000 milliseconds" )
@@ -1535,7 +1535,7 @@ func TestConnectionUpsertReplaceRules(t *testing.T) {
15351535 assert .Equal (t , "retry" , initialRule ["type" ], "Initial rule should be retry type" )
15361536
15371537 // Upsert to REPLACE retry rule with filter rule (using proper JSON format)
1538- filterBody := `{"$. type":"payment"}`
1538+ filterBody := `{"type":"payment"}`
15391539 var upserted Connection
15401540 err = cli .RunJSON (& upserted ,
15411541 "connection" , "upsert" , connName ,
@@ -1591,3 +1591,62 @@ func TestConnectionUpsertValidation(t *testing.T) {
15911591
15921592 t .Logf ("Successfully verified validation errors" )
15931593}
1594+
1595+ // TestConnectionCreateOutputStructure tests the human-readable output format
1596+ func TestConnectionCreateOutputStructure (t * testing.T ) {
1597+ if testing .Short () {
1598+ t .Skip ("Skipping acceptance test in short mode" )
1599+ }
1600+
1601+ cli := NewCLIRunner (t )
1602+ timestamp := generateTimestamp ()
1603+
1604+ connName := "test-output-" + timestamp
1605+ sourceName := "test-src-output-" + timestamp
1606+ destName := "test-dst-output-" + timestamp
1607+
1608+ // Create connection without --output json to get human-readable format
1609+ stdout := cli .RunExpectSuccess (
1610+ "connection" , "create" ,
1611+ "--name" , connName ,
1612+ "--source-name" , sourceName ,
1613+ "--source-type" , "WEBHOOK" ,
1614+ "--destination-name" , destName ,
1615+ "--destination-type" , "CLI" ,
1616+ "--destination-cli-path" , "/webhooks" ,
1617+ )
1618+
1619+ // Parse connection ID from output for cleanup (it appears in multiple places)
1620+ // Look for pattern "Successfully created connection with ID: conn_xxxxx"
1621+ lines := strings .Split (stdout , "\n " )
1622+ var connID string
1623+ for _ , line := range lines {
1624+ if strings .Contains (line , "Successfully created connection with ID:" ) {
1625+ parts := strings .Split (line , ":" )
1626+ if len (parts ) >= 2 {
1627+ connID = strings .TrimSpace (parts [1 ])
1628+ break
1629+ }
1630+ }
1631+ }
1632+ require .NotEmpty (t , connID , "Should be able to parse connection ID from output" )
1633+
1634+ // Cleanup
1635+ t .Cleanup (func () {
1636+ deleteConnection (t , cli , connID )
1637+ })
1638+
1639+ // Verify output structure contains expected elements from create command
1640+ assert .Contains (t , stdout , "Successfully created connection with ID:" , "Should show success message" )
1641+ assert .Contains (t , stdout , "Connection:" , "Should show Connection label" )
1642+ assert .Contains (t , stdout , connName , "Should include connection name" )
1643+ assert .Contains (t , stdout , connID , "Should include connection ID" )
1644+ assert .Contains (t , stdout , "Source:" , "Should show Source label" )
1645+ assert .Contains (t , stdout , sourceName , "Should include source name" )
1646+ assert .Contains (t , stdout , "Source URL:" , "Should show source URL label" )
1647+ assert .Contains (t , stdout , "https://hkdk.events/" , "Should include Hookdeck event URL" )
1648+ assert .Contains (t , stdout , "Destination:" , "Should show Destination label" )
1649+ assert .Contains (t , stdout , destName , "Should include destination name" )
1650+
1651+ t .Logf ("Successfully verified connection create output structure" )
1652+ }
0 commit comments