@@ -42,8 +42,18 @@ describe("basic test of publish and subscribe", () => {
42
42
expect ( done ) . toBe ( false ) ;
43
43
} ) ;
44
44
45
+ it ( "publishing undefined is not allowed" , async ( ) => {
46
+ await expect (
47
+ async ( ) => await cn . publish ( subject , undefined ) ,
48
+ ) . rejects . toThrowError ( "must not be undefined" ) ;
49
+
50
+ expect ( ( ) => cn . publishSync ( subject , undefined ) ) . toThrow (
51
+ "must not be undefined" ,
52
+ ) ;
53
+ } ) ;
54
+
45
55
it ( "publishes using a second client" , async ( ) => {
46
- const data = "client2" ;
56
+ const data = null ;
47
57
cn2 = connect ( ) ;
48
58
expect ( cn === cn2 ) . toEqual ( false ) ;
49
59
await cn2 . publish ( subject , data ) ;
@@ -202,7 +212,7 @@ describe("basic tests of request/respond", () => {
202
212
it ( "create a requestMany server that iterates over what you send it" , async ( ) => {
203
213
// This example illustrates how to define a requestMany server
204
214
// and includes error handling. Note the technique of using
205
- // the *headers* for control signalling (e.g., when we're done, or if
215
+ // the *headers* for control signalling (e.g., when we're done, or if
206
216
// there is an error) and using the message payload for the actual data.
207
217
// In Conat headers are very well supported, encouraged, and easy to use
208
218
// (and arbitrary JSON), unlike NATS.js.
0 commit comments