Skip to content

Commit 95a42f9

Browse files
committed
improve onError test failure message to diagnose why events are empty or wrong
1 parent 7fa08af commit 95a42f9

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

tests/WebSocketClientTest.cfc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,17 @@ component extends="org.lucee.cfml.test.LuceeTestCase" labels="websocketclient" {
9696
}
9797
catch ( any e ) {
9898
var events = listener.getEvents();
99+
if ( !arrayLen( events ) )
100+
fail( "listener events empty — onError callback never fired (exception was: #e.message#)" );
99101
var found = false;
100102
for ( var entry in events ) {
101103
if ( entry == "onError:connect" ) {
102104
found = true;
103105
break;
104106
}
105107
}
106-
expect( found ).toBeTrue();
108+
if ( !found )
109+
fail( "expected 'onError:connect' in events, got: " & events.toJSON() );
107110
}
108111
});
109112
});

0 commit comments

Comments
 (0)