mirror of https://github.com/waku-org/js-waku.git
Remove dupe test
This commit is contained in:
parent
5bc6173cb8
commit
27540fae47
|
@ -239,77 +239,6 @@ describe('Waku Relay', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Js connects to nim', function () {
|
|
||||||
let waku: Waku;
|
|
||||||
let nimWaku: NimWaku;
|
|
||||||
|
|
||||||
beforeEach(async function () {
|
|
||||||
this.timeout(10_000);
|
|
||||||
waku = await Waku.create({ staticNoiseKey: NOISE_KEY_1 });
|
|
||||||
|
|
||||||
nimWaku = new NimWaku(makeLogFileName(this));
|
|
||||||
await nimWaku.start();
|
|
||||||
|
|
||||||
await waku.dial(await nimWaku.getMultiaddrWithId());
|
|
||||||
|
|
||||||
await new Promise((resolve) =>
|
|
||||||
waku.libp2p.pubsub.once('gossipsub:heartbeat', resolve)
|
|
||||||
);
|
|
||||||
|
|
||||||
await waku.relay.subscribe();
|
|
||||||
|
|
||||||
await new Promise((resolve) =>
|
|
||||||
waku.libp2p.pubsub.once('gossipsub:heartbeat', resolve)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(async function () {
|
|
||||||
nimWaku ? nimWaku.stop() : null;
|
|
||||||
waku ? await waku.stop() : null;
|
|
||||||
});
|
|
||||||
|
|
||||||
it('nim subscribes to js', async function () {
|
|
||||||
const subscribers = waku.libp2p.pubsub.getSubscribers(
|
|
||||||
RelayDefaultTopic
|
|
||||||
);
|
|
||||||
|
|
||||||
const nimPeerId = await nimWaku.getPeerId();
|
|
||||||
expect(subscribers).to.contain(nimPeerId.toB58String());
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Js publishes to nim', async function () {
|
|
||||||
const message = WakuMessage.fromUtf8String('This is a message');
|
|
||||||
|
|
||||||
await waku.relay.publish(message);
|
|
||||||
|
|
||||||
await nimWaku.waitForLog('WakuMessage received');
|
|
||||||
|
|
||||||
const msgs = await nimWaku.messages();
|
|
||||||
|
|
||||||
expect(msgs[0].contentTopic).to.equal(message.contentTopic);
|
|
||||||
expect(msgs[0].version).to.equal(message.version);
|
|
||||||
|
|
||||||
const payload = Buffer.from(msgs[0].payload);
|
|
||||||
expect(Buffer.compare(payload, message.payload!)).to.equal(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Nim publishes to js', async function () {
|
|
||||||
const message = WakuMessage.fromUtf8String('Here is another message.');
|
|
||||||
|
|
||||||
const receivedPromise = waitForNextData(waku.libp2p.pubsub);
|
|
||||||
|
|
||||||
await nimWaku.sendMessage(message);
|
|
||||||
|
|
||||||
const receivedMsg = await receivedPromise;
|
|
||||||
|
|
||||||
expect(receivedMsg.contentTopic).to.eq(message.contentTopic);
|
|
||||||
expect(receivedMsg.version).to.eq(message.version);
|
|
||||||
|
|
||||||
const payload = Buffer.from(receivedMsg.payload!);
|
|
||||||
expect(Buffer.compare(payload, message.payload!)).to.eq(0);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('js to nim to js', function () {
|
describe('js to nim to js', function () {
|
||||||
let waku1: Waku;
|
let waku1: Waku;
|
||||||
let waku2: Waku;
|
let waku2: Waku;
|
||||||
|
|
Loading…
Reference in New Issue