Skip to content

Commit cb43460

Browse files
change expects
1 parent d53eddb commit cb43460

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

packages/tests/tests/metadata.spec.ts

+5-9
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { shardInfoToPubsubTopics } from "@waku/utils";
55
import chai, { expect } from "chai";
66
import chaiAsPromised from "chai-as-promised";
77

8-
import { tearDownNodes } from "../src/index.js";
8+
import { delay, tearDownNodes } from "../src/index.js";
99
import { makeLogFileName } from "../src/log_file.js";
1010
import { NimGoNode } from "../src/node/node.js";
1111

@@ -117,15 +117,13 @@ describe.only("Metadata Protocol", () => {
117117
});
118118

119119
const nwaku1Ma = await nwaku1.getMultiaddrWithId();
120-
const nwaku1PeerId = await nwaku1.getPeerId();
121120

122121
waku = await createLightNode({ shardInfo: shardInfo2 });
123122
await waku.start();
124123
await waku.libp2p.dialProtocol(nwaku1Ma, MetadataCodec);
125124

126-
await expect(
127-
waku.libp2p.services.metadata?.query(nwaku1PeerId)
128-
).to.be.rejectedWith("the connection is being closed");
125+
// add a delay to make sure the connection is closed from the other side
126+
await delay(100);
129127

130128
const activeConnections = waku.libp2p.getConnections();
131129
expect(activeConnections.length).to.equal(0);
@@ -153,15 +151,13 @@ describe.only("Metadata Protocol", () => {
153151
});
154152

155153
const nwaku1Ma = await nwaku1.getMultiaddrWithId();
156-
const nwaku1PeerId = await nwaku1.getPeerId();
157154

158155
waku = await createLightNode({ shardInfo: shardInfo2 });
159156
await waku.start();
160157
await waku.libp2p.dialProtocol(nwaku1Ma, MetadataCodec);
161158

162-
await expect(
163-
waku.libp2p.services.metadata?.query(nwaku1PeerId)
164-
).to.be.rejectedWith("the connection is being closed");
159+
// add a delay to make sure the connection is closed from the other side
160+
await delay(100);
165161

166162
const activeConnections = waku.libp2p.getConnections();
167163
expect(activeConnections.length).to.equal(0);

0 commit comments

Comments
 (0)