mirror of
https://github.com/logos-messaging/js-waku.git
synced 2026-01-05 23:33:08 +00:00
Reorg tests, add describe sections
This commit is contained in:
parent
7d595b0c8f
commit
13e941513d
@ -3,7 +3,9 @@ import { NimWaku } from '../test_utils/nim_waku';
|
||||
import Waku from './waku';
|
||||
import { CODEC } from './waku_relay';
|
||||
|
||||
test('Nim-interop: nim-waku node connects to js node', async () => {
|
||||
describe('Waku', () => {
|
||||
describe('Interop: Nim', () => {
|
||||
test('nim connects to js', async () => {
|
||||
const waku = await Waku.create();
|
||||
|
||||
const peerId = waku.libp2p.peerId.toB58String();
|
||||
@ -31,3 +33,5 @@ test('Nim-interop: nim-waku node connects to js node', async () => {
|
||||
|
||||
expect(jsPeers.has(nimPeerId.toB58String())).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -8,8 +8,9 @@ import Waku from './waku';
|
||||
import { Message } from './waku_message';
|
||||
import { CODEC, TOPIC } from './waku_relay';
|
||||
|
||||
describe('Waku Relay', () => {
|
||||
// TODO: Fix this, see https://github.com/ChainSafe/js-libp2p-gossipsub/issues/151
|
||||
test.skip('Publishes message', async () => {
|
||||
test.skip('Publish', async () => {
|
||||
const message = Message.fromUtf8String('Bird bird bird, bird is the word!');
|
||||
|
||||
const [waku1, waku2] = await Promise.all([Waku.create(), Waku.create()]);
|
||||
@ -53,7 +54,8 @@ test('Does not register any sub protocol', async () => {
|
||||
expect(protocols.findIndex((value) => value.match(/sub/))).toBeTruthy();
|
||||
});
|
||||
|
||||
test('Nim-interop: js node receives default subscription from nim node', async () => {
|
||||
describe('Interop: Nim', () => {
|
||||
test('nim subscribes to js', async () => {
|
||||
const waku = await Waku.create();
|
||||
|
||||
const peerId = waku.libp2p.peerId.toB58String();
|
||||
@ -72,7 +74,7 @@ test('Nim-interop: js node receives default subscription from nim node', async (
|
||||
expect(subscribers).toContain(nimPeerId.toB58String());
|
||||
});
|
||||
|
||||
test('Nim-interop: js node sends message to nim node', async () => {
|
||||
test('Js publishes to nim', async () => {
|
||||
const message = Message.fromUtf8String('This is a message');
|
||||
const waku = await Waku.create();
|
||||
|
||||
@ -105,7 +107,7 @@ test('Nim-interop: js node sends message to nim node', async () => {
|
||||
expect(Buffer.compare(payload, message.payload)).toBe(0);
|
||||
});
|
||||
|
||||
test('Nim-interop: nim node sends message to js node', async () => {
|
||||
test('Nim publishes to js', async () => {
|
||||
const message = Message.fromUtf8String('Here is another message.');
|
||||
const waku = await Waku.create();
|
||||
|
||||
@ -138,6 +140,8 @@ test('Nim-interop: nim node sends message to js node', async () => {
|
||||
const payload = Buffer.from(receivedMsg.payload);
|
||||
expect(Buffer.compare(payload, message.payload)).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function waitForNextData(pubsub: Pubsub): Promise<Message> {
|
||||
return new Promise((resolve) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user