File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -198,9 +198,9 @@ See: https://github.com/cloudevents/spec/blob/v1.0/spec.md#type-system`);
198198
199199 /**
200200 * The native `console.log` value of the CloudEvent.
201- * @return The string representation of the CloudEvent.
201+ * @return { string } The string representation of the CloudEvent.
202202 */
203- [ Symbol . for ( "nodejs.util.inspect.custom" ) ] ( ) {
203+ [ Symbol . for ( "nodejs.util.inspect.custom" ) ] ( ) : string {
204204 return this . toString ( ) ;
205205 }
206206}
Original file line number Diff line number Diff line change @@ -57,7 +57,9 @@ describe("A CloudEvent", () => {
5757
5858 it ( "serializes as JSON with raw log" , ( ) => {
5959 const ce = new CloudEvent ( { ...fixture , data : { lunch : "tacos" } } ) ;
60- expect ( ce . toString ( ) ) . to . deep . equal ( JSON . stringify ( ce ) ) ;
60+ const inspectSymbol = ( Symbol . for ( "nodejs.util.inspect.custom" ) as unknown ) as string ;
61+ const ceToString = ( ce [ inspectSymbol ] as CallableFunction ) . bind ( ce ) ;
62+ expect ( ce . toString ( ) ) . to . deep . equal ( ceToString ( ) ) ;
6163 } ) ;
6264
6365 it ( "Throw a validation error for invalid extension names" , ( ) => {
You can’t perform that action at this time.
0 commit comments