Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Commit

Permalink
Fail properly
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoPolo committed Oct 7, 2022
1 parent b4ef5df commit 20b39db
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions test/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ import { expect } from 'aegir/chai'
import { multiaddr } from '@multiformats/multiaddr'
import { Noise } from '@chainsafe/libp2p-noise'
import { WebTransport as WebTransportLibp2p } from '../src/index'
import { createEd25519PeerId } from '@libp2p/peer-id-factory'
import { mockUpgrader } from '@libp2p/interface-mocks'
import { Components } from '@libp2p/components'

import { createLibp2p } from 'libp2p'

declare global {
Expand Down Expand Up @@ -44,23 +40,6 @@ describe('libp2p-webtransport', () => {
const maStrP2p = maStr.split('/p2p/')[1]
const ma = multiaddr(maStrNoCerthash + '/p2p/' + maStrP2p)

const peerId = await createEd25519PeerId()
const components = new Components({
peerId: peerId
})
const transport = new WebTransportLibp2p()
transport.init(components)

const err = await expect(transport.dial(ma, { upgrader: mockUpgrader() })).to.eventually.be.rejected()
expect(err.toString()).to.contain('WebTransportError: Opening handshake failed.')
})

it('fails to connect to invalid addr', async () => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const maStr: string = process.env.serverAddr!
const maStrP2p = maStr.split('/p2p/')[1]
const ma = multiaddr('/ip4/127.1.0.1/udp/10000/quic/webtransport/p2p/' + maStrP2p)

const node = await createLibp2p({
transports: [new WebTransportLibp2p()],
connectionEncryption: [new Noise()]
Expand Down

0 comments on commit 20b39db

Please sign in to comment.