@@ -12,7 +12,11 @@ import {
12
12
createEncoder ,
13
13
generateSymmetricKey
14
14
} from "@waku/message-encryption/symmetric" ;
15
- import { createLightNode , createRelayNode } from "@waku/sdk" ;
15
+ import {
16
+ createLightNode ,
17
+ createEncoder as createPlainEncoder ,
18
+ createRelayNode
19
+ } from "@waku/sdk" ;
16
20
import { bytesToUtf8 , utf8ToBytes } from "@waku/utils/bytes" ;
17
21
import { expect } from "chai" ;
18
22
@@ -25,6 +29,8 @@ import {
25
29
26
30
const TestContentTopic = "/test/1/waku/utf8" ;
27
31
32
+ const TestEncoder = createPlainEncoder ( { contentTopic : TestContentTopic } ) ;
33
+
28
34
describe ( "Waku Dial [node only]" , function ( ) {
29
35
describe ( "Interop: NimGoNode" , function ( ) {
30
36
let waku : Waku ;
@@ -60,6 +66,39 @@ describe("Waku Dial [node only]", function () {
60
66
const nimPeerId = await nwaku . getPeerId ( ) ;
61
67
expect ( await waku . libp2p . peerStore . has ( nimPeerId ) ) . to . be . true ;
62
68
} ) ;
69
+
70
+ it ( "Does not throw an exception when node disconnects" , async function ( ) {
71
+ this . timeout ( 20_000 ) ;
72
+
73
+ process . on ( "unhandledRejection" , ( e ) =>
74
+ expect . fail ( "unhandledRejection" , e )
75
+ ) ;
76
+ process . on ( "uncaughtException" , ( e ) =>
77
+ expect . fail ( "uncaughtException" , e )
78
+ ) ;
79
+
80
+ nwaku = new NimGoNode ( makeLogFileName ( this ) ) ;
81
+ await nwaku . start ( {
82
+ filter : true ,
83
+ store : true ,
84
+ lightpush : true
85
+ } ) ;
86
+ const multiAddrWithId = await nwaku . getMultiaddrWithId ( ) ;
87
+
88
+ waku = await createLightNode ( {
89
+ staticNoiseKey : NOISE_KEY_1
90
+ } ) ;
91
+ await waku . start ( ) ;
92
+ await waku . dial ( multiAddrWithId ) ;
93
+ await nwaku . stop ( ) ;
94
+ try {
95
+ await waku . lightPush ?. send ( TestEncoder , {
96
+ payload : utf8ToBytes ( "hello world" )
97
+ } ) ;
98
+ } catch ( e ) {
99
+ // We are not checking this exception
100
+ }
101
+ } ) ;
63
102
} ) ;
64
103
65
104
describe ( "Bootstrap" , function ( ) {
0 commit comments