diff --git a/src/connect.ts b/src/connect/index.ts similarity index 74% rename from src/connect.ts rename to src/connect/index.ts index 661efc1..2e6ede1 100644 --- a/src/connect.ts +++ b/src/connect/index.ts @@ -1,13 +1,26 @@ import { expect } from 'aegir/chai' -import { runTests } from './utils/test-matrix.js' -import type { Daemon, SpawnOptions, DaemonFactory } from './index.js' +import type { Daemon, DaemonFactory, NodeType, SpawnOptions, TransportType } from '../index.js' export function connectTests (factory: DaemonFactory): void { - runTests('connect', runConnectTests, factory) + const nodeTypes: NodeType[] = ['js', 'go'] + const transportTypes: TransportType[] = ['tcp', 'webtransport'] + + for (const typeA of nodeTypes) { + for (const typeB of nodeTypes) { + transportTypes.forEach(transport => { + runConnectTests( + transport, + factory, + { type: typeA, transport }, + { type: typeB, transport } + ) + }) + } + } } function runConnectTests (name: string, factory: DaemonFactory, optionsA: SpawnOptions, optionsB: SpawnOptions): void { - describe(name, () => { + describe(`connection.${name}`, () => { let daemonA: Daemon let daemonB: Daemon @@ -28,7 +41,7 @@ function runConnectTests (name: string, factory: DaemonFactory, optionsA: SpawnO ) }) - it(`${optionsA.type} peer to ${optionsB.type} peer`, async function () { + it(`${optionsA.type} peer to ${optionsB.type} peer over ${name}`, async function () { this.timeout(10 * 1000) const identify1 = await daemonA.client.identify() diff --git a/src/index.ts b/src/index.ts index c873524..03a3836 100644 --- a/src/index.ts +++ b/src/index.ts @@ -42,7 +42,7 @@ * For an example, see the js-libp2p interop test runner. */ -import { connectTests } from './connect.js' +import { connectTests } from './connect/index.js' import { dhtTests } from './dht/index.js' import { pubsubTests } from './pubsub/index.js' import { relayTests } from './relay/index.js' @@ -59,6 +59,7 @@ export type PeerIdType = 'rsa' | 'ed25519' | 'secp256k1' export type PubSubRouter = 'gossipsub' | 'floodsub' export type Muxer = 'mplex' | 'yamux' export type Encryption = 'noise' | 'tls' +export type TransportType = 'tcp' | 'webtransport' export interface SpawnOptions { type: NodeType @@ -72,6 +73,7 @@ export interface SpawnOptions { // the node will not listen on any // addresses if true noListen?: boolean + transport?: TransportType } export interface DaemonFactory {