Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Commit

Permalink
chore: add ts-ignore after using updated ipfsd-ctl
Browse files Browse the repository at this point in the history
  • Loading branch information
SgtPooki committed Sep 21, 2022
1 parent a2cbc2a commit f6b921f
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 37 deletions.
66 changes: 29 additions & 37 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions test/cid-version-agnostic.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,17 @@ describe('CID version agnostic', function () {
Object.assign(daemons, { js0, js1, go0, go1 })

await Promise.all([
// @ts-ignore
js0.api.swarm.connect(js1.peer.addresses[0]),
// @ts-ignore
js1.api.swarm.connect(js0.peer.addresses[0]),
// @ts-ignore
go0.api.swarm.connect(go1.peer.addresses[0]),
// @ts-ignore
go1.api.swarm.connect(go0.peer.addresses[0]),
// @ts-ignore
js0.api.swarm.connect(go0.peer.addresses[0]),
// @ts-ignore
go0.api.swarm.connect(js0.peer.addresses[0])
])
})
Expand Down
12 changes: 12 additions & 0 deletions test/circuit/v1/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,14 @@ export default {
* @param {Controller} relay
*/
connect: async (nodeA, nodeB, relay) => {
// @ts-ignore
await relay.api.swarm.connect(await getWsAddr(nodeA.api))
// @ts-ignore
await relay.api.swarm.connect(await getWrtcStarAddr(nodeB.api))
// TODO: needed until https://github.com/ipfs/interop/issues/17 is resolved
await delay(5000)
const nodeBCircuitAddr = new Multiaddr(`${await getWrtcStarAddr(relay.api)}/p2p-circuit/p2p/${nodeB.peer.id.toString()}`)
// @ts-ignore
await nodeA.api.swarm.connect(nodeBCircuitAddr)
},
skip: () => true // go-ipfs does not know what p2p-webrtc-star is
Expand All @@ -164,11 +167,14 @@ export default {
* @param {Controller} relay
*/
connect: async (nodeA, nodeB, relay) => {
// @ts-ignore
await relay.api.swarm.connect(await getWsAddr(nodeA.api))
// @ts-ignore
await relay.api.swarm.connect(await getWrtcStarAddr(nodeB.api))
// TODO: needed until https://github.com/ipfs/interop/issues/17 is resolved
await delay(3000)
const nodeBCircuitAddr = new Multiaddr(`${await getWrtcStarAddr(relay.api)}/p2p-circuit/p2p/${(await nodeB.api.id()).id.toString()}`)
// @ts-ignore
await nodeA.api.swarm.connect(nodeBCircuitAddr)
},
skip: () => isWebWorker // no webrtc support in webworkers
Expand All @@ -188,11 +194,14 @@ export default {
* @param {Controller} relay
*/
connect: async (nodeA, nodeB, relay) => {
// @ts-ignore
await relay.api.swarm.connect(await getWrtcStarAddr(nodeA.api))
// @ts-ignore
await relay.api.swarm.connect(await getWsAddr(nodeB.api))
// TODO: needed until https://github.com/ipfs/interop/issues/17 is resolved
await delay(5000)
const nodeBCircuitAddr = new Multiaddr(`${await getWrtcStarAddr(relay.api)}/p2p-circuit/p2p/${(await nodeB.api.id()).id.toString()}`)
// @ts-ignore
await nodeA.api.swarm.connect(nodeBCircuitAddr)
},
skip: () => isWebWorker // no webrtc support in webworkers
Expand All @@ -212,11 +221,14 @@ export default {
* @param {Controller} relay
*/
connect: async (nodeA, nodeB, relay) => {
// @ts-ignore
await relay.api.swarm.connect(await getWrtcStarAddr(nodeA.api))
// @ts-ignore
await relay.api.swarm.connect(await getWsAddr(nodeB.api))
// TODO: needed until https://github.com/ipfs/interop/issues/17 is resolved
await delay(3000)
const nodeBCircuitAddr = new Multiaddr(`${await getWrtcStarAddr(relay.api)}/p2p-circuit/p2p/${(await nodeB.api.id()).id.toString()}`)
// @ts-ignore
await nodeA.api.swarm.connect(nodeBCircuitAddr)
},
skip: () => isWebWorker // no webrtc support in webworkers
Expand Down
2 changes: 2 additions & 0 deletions test/exchange-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ describe('exchange files', function () {
before('connect', async function () {
this.timeout(timeout); // eslint-disable-line

// @ts-ignore
await daemon1.api.swarm.connect(daemon2.peer.addresses[0])
// @ts-ignore
await daemon2.api.swarm.connect(daemon1.peer.addresses[0])

const [peer1, peer2] = await Promise.all([
Expand Down
5 changes: 5 additions & 0 deletions test/ipns-pubsub.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,16 @@ describe('ipns-pubsub', function () {
// Connect nodes and wait for republish
beforeEach('connect the nodes', async function () {
this.timeout(60e3)
// @ts-ignore
await goNode0.api.swarm.connect(goNode1.peer.addresses[0])
// @ts-ignore
await goNode0.api.swarm.connect(jsNode0.peer.addresses[0])
// @ts-ignore
await goNode0.api.swarm.connect(jsNode1.peer.addresses[0])

// @ts-ignore
await jsNode0.api.swarm.connect(jsNode1.peer.addresses[0])
// @ts-ignore
await jsNode0.api.swarm.connect(goNode1.peer.addresses[0])
})

Expand Down
9 changes: 9 additions & 0 deletions test/kad-dht.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ const createBootstrappedNetwork = function (name, createBootstrapper, createNode
createNetwork(name, async factory => {
const bootstrapper = await createBootstrapper(factory)
const bootstrapAddr = await getNodeAddr(bootstrapper)
// @ts-ignore
const nodes = await createNodes(factory, bootstrapAddr)

await delay(5000)
Expand Down Expand Up @@ -211,8 +212,11 @@ const createLinearNetwork = function (name, createNodes) {
* +-+ +-+
*/

// @ts-ignore
await node3.api.swarm.connect(node0.peer.addresses[0])
// @ts-ignore
await node0.api.swarm.connect(node1.peer.addresses[0])
// @ts-ignore
await node1.api.swarm.connect(node2.peer.addresses[0])

// ensure nodes have their peers in their routing tables
Expand Down Expand Up @@ -248,15 +252,19 @@ const createDisjointNetwork = function (name, createNodes) {
// Make connections between nodes

// 0 -> 1 -> 2
// @ts-ignore
await node0.api.swarm.connect(node1.peer.addresses[0])
// @ts-ignore
await node1.api.swarm.connect(node2.peer.addresses[0])

// ensure nodes have their peers in their routing tables
await inRoutingTable(node0, node1)
await inRoutingTable(node1, node2)

// 3 -> 4 -> 5
// @ts-ignore
await node3.api.swarm.connect(node4.peer.addresses[0])
// @ts-ignore
await node4.api.swarm.connect(node5.peer.addresses[0])

// ensure nodes have their peers in their routing tables
Expand All @@ -281,6 +289,7 @@ const createDisjointNetwork = function (name, createNodes) {
* Make connections between nodes
* 0 -> 1 -> 2 -> 5 -> 4 -> 3
*/
// @ts-ignore
await node2.api.swarm.connect(node5.peer.addresses[0])
await inRoutingTable(node2, node5)

Expand Down
2 changes: 2 additions & 0 deletions test/pubsub.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ describe('pubsub', function () {
})

before('connect', async function () {
// @ts-ignore
await daemon1.api.swarm.connect(daemon2.peer.addresses[0])
// @ts-ignore
await daemon2.api.swarm.connect(daemon1.peer.addresses[0])

const peers = await Promise.all([
Expand Down
3 changes: 3 additions & 0 deletions test/utils/circuit.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,15 +280,18 @@ export async function connect (nodeA, nodeB, relay, timeout = 1000) {
const nodeBId = (await nodeB.api.id()).id

if (process.env.DEBUG) console.log(`connect A (${nodeAId.toString()}) to relay at`, relayWsAddr.toString())
// @ts-ignore
await nodeA.api.swarm.connect(relayWsAddr)

if (process.env.DEBUG) console.log(`connect B (${nodeBId.toString()}) to relay at`, relayWsAddr.toString())
// @ts-ignore
await nodeB.api.swarm.connect(relayWsAddr)

// TODO: needed until https://github.com/ipfs/interop/issues/17 is resolved
await delay(timeout)
const nodeBCircuitAddr = new Multiaddr(`${relayWsAddr}/p2p-circuit/p2p/${nodeBId.toString()}`)
if (process.env.DEBUG) console.log('connect A to B over circuit', nodeBCircuitAddr.toString())
// @ts-ignore
await nodeA.api.swarm.connect(nodeBCircuitAddr)

if (process.env.DEBUG) {
Expand Down

0 comments on commit f6b921f

Please sign in to comment.