-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: respect trustless gateway options for sessions (#566)
pass down trustless gateway options to session subclass --------- Co-authored-by: Daniel N <[email protected]> Co-authored-by: Alex Potsides <[email protected]>
- Loading branch information
1 parent
f16c9ea
commit 5643b1d
Showing
2 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
packages/block-brokers/test/trustless-gateway-utils.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { uriToMultiaddr } from '@multiformats/uri-to-multiaddr' | ||
import { expect } from 'aegir/chai' | ||
import { filterNonHTTPMultiaddrs } from '../src/trustless-gateway/utils.js' | ||
|
||
describe('trustless-gateway-block-broker-utils', () => { | ||
it('filterNonHTTPMultiaddrs respects allowInsecure multiaddrs correctly', async function () { | ||
const nonSecureMaddr = uriToMultiaddr('http://mygw.com') | ||
const secureMaddr = uriToMultiaddr('https://mygw.com') | ||
|
||
const filtered = filterNonHTTPMultiaddrs([nonSecureMaddr, secureMaddr], true, true) | ||
|
||
expect(filtered.length).to.deep.equal(2) | ||
}) | ||
|
||
it('filterNonHTTPMultiaddrs filters local multiaddrs correctly', async function () { | ||
const localMaddr = uriToMultiaddr('http://localhost') | ||
|
||
const filtered = filterNonHTTPMultiaddrs([localMaddr], true, true) | ||
|
||
expect(filtered.length).to.deep.equal(1) | ||
}) | ||
|
||
it('filterNonHTTPMultiaddrs filters multiaddrs correctly', async function () { | ||
const localMaddr = uriToMultiaddr('http://localhost') | ||
|
||
const filtered = filterNonHTTPMultiaddrs([localMaddr], false, false) | ||
|
||
expect(filtered.length).to.deep.equal(0) | ||
}) | ||
}) |